qfgaohao / pytorch-ssd

MobileNetV1, MobileNetV2, VGG based SSD/SSD-lite implementation in Pytorch 1.0 / Pytorch 0.4. Out-of-box support for retraining on Open Images dataset. ONNX and Caffe2 support. Experiment Ideas like CoordConv.
https://medium.com/@smallfishbigsea/understand-ssd-and-implement-your-own-caa3232cd6ad
MIT License
1.39k stars 530 forks source link

GPU tensor to int conversion bugs #148

Open tensorturtle opened 3 years ago

tensorturtle commented 3 years ago

Fixes #147 and related bugs. Issue #147 happens because when running on GPU, some tensors are moved to GPU while others are still in CPU. This becomes a problem in /vision/utils/box_utils.py, when an operation tries to work on tensors that are in different places. I fixed another bug which happened because OpenCV's cv2.rectangle does not accept tensors as arguments. I fixed it by getting the python numerical value of the tensor with .item() and converting it to int.