Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmdszzz opened this issue Apr 11, 2024 · 1 comment

Comments

@xmdszzz
Copy link

xmdszzz commented Apr 11, 2024

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)
@ax1an9
Copy link

ax1an9 commented Apr 18, 2024

I think this works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants