Remove Extraneous Loop for Loss Gradients Calculation in `PyTorchObjectDetector`
f4str opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
Due to the issue reported in pytorch/vision#4153, the current implementation of the PyTorchObjectDetector
loops through each input to calculate the gradients. However, this issue has been resolved in torch>=1.10
and torchvision>=0.11
which no longer makes this loop necessary.
Describe the solution you'd like
The loss_gradient
method in the PyTorchObjectDetector
should be simplified to no longer need to loop through each individual input and use the entire batch similar to what is done in the PyTorchYolo
estimator. Since the estimator already raises an exception when torch==[1.8, 1.9]
and torchvision==[0.9, 0.10]
is used, no other version checks are needed since the bug has been fixed in torch>=1.10
and torchvision>=0.11
.
This will most likely change the gradient values as the entire batch is being processed at once, so the unit tests will need to be updated as well.
Describe alternatives you've considered
N/A
Additional context
N/A