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

ImportError: cannot import name 'non_max_suppression' from 'supervision.detection.utils' #16

Open
1 of 2 tasks
Minghao-Han opened this issue Jul 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Minghao-Han
Copy link

Search before asking

  • I have searched the JUXTAPOSE issues and found no similar bug report.

JUXTAPOSE Component

Detector

Bug

after i installed juxtapose as https://sdk.juxt.space/installation says and try to test the installation

pip install juxtapose
python test.py

i encountered a problem

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from juxtapose import RTM
  File "/usr/local/miniconda3/lib/python3.8/site-packages/juxtapose/__init__.py", line 3, in <module>
    from .rtm import RTM
  File "/usr/local/miniconda3/lib/python3.8/site-packages/juxtapose/rtm.py", line 14, in <module>
    from juxtapose.detectors import get_detector
  File "/usr/local/miniconda3/lib/python3.8/site-packages/juxtapose/detectors/__init__.py", line 2, in <module>
    from .rtmdet import RTMDet
  File "/usr/local/miniconda3/lib/python3.8/site-packages/juxtapose/detectors/rtmdet/__init__.py", line 7, in <module>
    from juxtapose.utils.core import Detections
  File "/usr/local/miniconda3/lib/python3.8/site-packages/juxtapose/utils/core.py", line 9, in <module>
    from supervision.detection.utils import non_max_suppression, xywh_to_xyxy
ImportError: cannot import name 'non_max_suppression' from 'supervision.detection.utils' (/usr/local/miniconda3/lib/python3.8/site-packages/supervision/detection/utils.py)

I went to the https://github.com/roboflow/supervision/blob/develop/supervision/detection/utils.py and found there is no 'non_max_suppression' method. Maybe they delete it. By the way, could it be the my python version(3.8) that caused this problem?

Environment

  • OS: ubuntu 20.04
  • Python: 3.8.10

Minimal Reproducible Example

pip install juxtapose
create a test.py then paste

from juxtapose import RTM
 
# you can view type hinting for each argument
model = RTM(
  det="rtmdet-s",
  tracker="bytetrack",
  pose="rtmpose-l"
)
 
# run inference
model(
  source="https://raw.githubusercontent.com/ziqinyeow/juxtapose-sdk/main/asset/football.jpeg",
  show=True, # this will create an cv2 window to show the inference result
  save=True # this will save a copy of inference images/videos and its keypoints in csv format
)
 

run

python test.py

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@Minghao-Han Minghao-Han added the bug Something isn't working label Jul 9, 2024
@ziqinyeow
Copy link
Owner

@Minghao-Han, thanks for raising the issue, I can reproduce it in python==3.8, but not python==3.9, for a quick fix, can you install it in python>=3.9 since the jax requires 3.9 and above.

# use python>=3.9
pip install juxtapose

# If still not working (with the above err)
pip install supervision==0.17.1 # check pip list | grep supervision

I am pretty sure there's some poetry tool issue, I specified the supervision version 0.17.1 here which surely contains that non_max_suppresion function. However, poetry didn't capture that version during build time and it installs the latest version which is 0.21.0 (to the date I commented).

I suspect the issue is related to the jax installation in python==3.8 breaking the entire dependency tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants