Closed niaoyu closed 2 years ago
I have the same bug as you've proposed, wish to see the way to solve it.
The number of targets should match the size of your batch. I'm assuming that you're using a batch size of 1? I believe that ConfusionMeter expects a prediction of the shape NxK
where N is the batch size. Even when using a batch size of one, predicted
and `target should be 2D arrays.
Does this fix the problem?
predicted = np.array([predicted])
target = np.array([predicted])
Actually,my batch size is 1,maybe thats the problem. Thanks for your answer!
Incorrect assertation will shown when the target shape is 1 (means only one input per batch).
line43-44: assert predicted.shape[0] == target.shape[0], \ 'number of targets and predicted outputs do not match'
Example:
this will cause an error in my program