pytorch-ssd
pytorch-ssd copied to clipboard
Fix size mismatch if the prediction is empty
Currently, if the model output empty predictions like (tensor([]), tensor([]), tensor([]))
, the evaluation script would output errors like
Traceback (most recent call last):
File "eval_ssd.py", line 243, in <module>
mean_ap, class_ap = eval.compute()
File "eval_ssd.py", line 66, in compute
results = torch.cat(results)
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 7 but got size 3 for tensor number 472 in the list.
This fix adds an empty box with probability 0 to fix such errors, which would IMO not affect the final evaluation results.