I have a working ignite setup - precision, recall accuracy all work. However, I am getting a bizarre error when I try to add in ConfusionMatrix(num_classes=1)
. Note the batch size is 5, and this pertains to a binary classifier.
/usr/local/lib/python3.7/site-packages/ignite/metrics/confusion_matrix.py in update(self, output)
92 @reinit__is_reduced
93 def update(self, output: Sequence[torch.Tensor]) -> None:
—> 94 self._check_shape(output)
95 y_pred, y = output
96
/usr/local/lib/python3.7/site-packages/ignite/metrics/confusion_matrix.py in _check_shape(self, output)
78 "y_pred must have shape (batch_size, num_categories, …) and y must have "
79 "shape of (batch_size, …), "
—> 80 “but given {} vs {}.”.format(y.shape, y_pred.shape)
81 )
82
ValueError: y_pred must have shape (batch_size, num_categories, ...) and y must have shape of (batch_size, ...), but given torch.Size([5, 1]) vs torch.Size([5, 1]).
As you can see, the y_pred
and y
shapes match…any ideas what might be going on here?