MeanAveragePrecision
update method does not accept torchvision.datapoints.BoundingBox
arguments
#2169
Labels
MeanAveragePrecision
update method does not accept torchvision.datapoints.BoundingBox
arguments
#2169
🐛 Bug
When the
preds
ortarget
arguments toMeanAveragePrecision.update
method are not of the typelist[dict[str,Tensor]]
a ValueError is raised, but this precludes dictionary values of typetorchvision.datapoints.BoundingBox
which inherit from Tensor.The ValueError is raised in the function
torchmetrics.detection.helpers._input_validator
. I think this could be fixed by changing all the lines likeif any(type(target[ivn]) is not Tensor for target in targets):
to be something like
if not all(isinstance(target[ivn], Tensor) for target in targets):
One could also validate that the
BoundingBox.format
is the same asMeanAveragePrecision.box_format
whenever a BoundingBox class is passed to the update method.To Reproduce
Expected behavior
MeanAveragePrecision.update
should accepttorchvision.datapoints.BoundingBox
arguments.Environment
python 3.11.4
pytorch 2.0.1
torchmetrics 1.2.0
torchvision 0.15.2
The text was updated successfully, but these errors were encountered: