PeizeSun / TransTrack

Multiple Object Tracking with Transformer
MIT License
629 stars 109 forks source link

fix an error caused by parsing torchvision version number incorrectly #49

Closed simonwu53 closed 2 years ago

simonwu53 commented 2 years ago

Issue Description

Torchvision version number will not be recognized correctly when it is greater than 0.10.0 in util/misc.py.

Cause

torchvision.__version__ provides torchvision version number in string format of major.minor.patch (e.g. 0.5.0 or 0.11.1). float(torchvision.__version__[:3]) can get the correct major.minor version number when the minor value is less than 10 (e.g. can get "0.5" from "0.5.0"). But when the version is 0.11.1 it will get 0.1, which is incorrect and will import old deprecated ops. Even when you get the correct version number 0.11, the float number 0.11 is still less than 0.5 if you compare them by values.

Solution

In order to prevent this issue and work with future versions, we have to compare the major number first, then the minor number, etc.