SSD icon indicating copy to clipboard operation
SSD copied to clipboard

BUG: UserWarning: No NMS is available. Please upgrade torchvision to 0.3.0+

Open xmdszzz opened this issue 2 years ago • 1 comments

The TorchVision's version check uses dictionary order. When the version number is '0.17.0+cpu', an incorrect judgment occurs, causing the code to enter the else branch, throwing an error and interrupting the program abnormally. incorrect code in ssd/utils/nms.py:

if torchvision.__version__ >= '0.3.0':
    _nms = torchvision.ops.nms
else:
    warnings.warn('No NMS is available. Please upgrade torchvision to 0.3.0+')
    sys.exit(-1)

my suggestion is import package : packaging, and than:

from packaging import version
if version.parse(torchvision.__version__) >= version.parse('0.3.0'):
    _nms = torchvision.ops.nms
else:
    warnings.warn('No NMS is available. Please upgrade torchvision to 0.3.0+')
    sys.exit(-1)

xmdszzz avatar Apr 11 '24 11:04 xmdszzz

I think this works.

ax1an9 avatar Apr 18 '24 07:04 ax1an9