ziqinyeow / juxtapose

juxtapose: Multi-Person Pose Tracking Inference SDK with RTMDet, YOLOv8, GDino, RTMPose (ONNX) & Trackers (ByteTrack & BotSORT) & Tapnet with custom ROIs + FastAPI GPU exe
https://sdk.juxt.space
MIT License
27 stars 4 forks source link

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

Open Minghao-Han opened 3 months ago

Minghao-Han commented 3 months ago

Search before asking

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

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?

ziqinyeow commented 3 months ago

@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.