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

YoloX is not detecting any objects #613

Open
mfoglio opened this issue Jan 23, 2025 · 1 comment
Open

YoloX is not detecting any objects #613

mfoglio opened this issue Jan 23, 2025 · 1 comment

Comments

@mfoglio
Copy link

mfoglio commented Jan 23, 2025

EDIT: solved

The Yolo-X model does not seem to detect any objects.

I am following the repository instructions to use Yolo-X. I edited the deepstream_app_config.txt to save the output to video file because I am using a remote instance and I don't have a screen. There are no bounding boxes drawn on the output video. I verified that my deepstream_app_config.txt is correct by also trying to use a DeepStream sample model.

I am using DeepStream 7.0

How to reproduce the issue

Prerequisites

First, generate the ONNX file for YoloX-S as described in the instructions in this repository:

# Make sure you use python3.10
python3 -m venv venv
source venv/bin/activate

git clone https://github.com/Megvii-BaseDetection/YOLOX.git
cd YOLOX
pip3 install -r requirements.txt
python3 setup.py develop
pip3 install onnx onnxslim onnxruntime

cd ..

git clone https://github.com/marcoslucianops/DeepStream-Yolo/
cp DeepStream-Yolo/utils/export_yolox.py YOLOX/export_yolox.py

cd YOLOX
wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
python3 export_yolox.py -w yolox_s.pth -c exps/default/yolox_s.py --dynamic

Then, build the postprocessing library:

git clone https://github.com/marcoslucianops/DeepStream-Yolo.git

cd DeepStream-Yolo
export CUDA_VER=12.2
make -C nvdsinfer_custom_impl_Yolo clean && make -C nvdsinfer_custom_impl_Yolo

cd ..
cp DeepStream-Yolo/nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so libnvdsinfer_custom_impl_Yolo.so

Create a folder that contains:

  • deepstream_app_config.txt
  • labels.txt
  • config_infer_primary_yolox.txt
  • yolo_s.onnx (this was renamed yolo_s.pth.onnx generated by the script above)

Run the following command:

deepstream-app -c deepstream_app_config.txt

deepstream_app_config.txt :

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[source0]
enable=1
type=3
uri=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0

[streammux]
gpu-id=0
live-source=0
batch-size=1
batched-push-timeout=40000
width=1920
height=1080
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=/src/src/tools/DeepStream-YoloX/config_infer_primary_yolox.txt
# If you use the following sample config-file, the objects will be detected:
# config-file=/opt/nvidia/deepstream/deepstream-7.0/samples/configs/deepstream-app/config_infer_primary.txt

[osd]
enable=1
gpu-id=0
border-width=5
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[sink1]
enable=1
type=3
container=1
codec=1
enc-type=0
sync=0
bitrate=4000000
profile=0
output-file=output.mp4
source-id=0

config_infer_primary_yolox.txt (this is the same file that can be found on this repository here - only paths are changed):

[property]
gpu-id=0
net-scale-factor=1
model-color-format=1
onnx-file=yolox_s.onnx
model-engine-file=model_b1_gpu0_fp32.engine
#int8-calib-file=calib.table
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=80
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
symmetric-padding=0
#workspace-size=2000
parse-bbox-func-name=NvDsInferParseYolo
#parse-bbox-func-name=NvDsInferParseYoloCuda
custom-lib-path=libnvdsinfer_custom_impl_Yolo.so
engine-create-func-name=NvDsInferYoloCudaEngineGet

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25
topk=300

labels.txt (this is the same file that can be found in this repository here)

person
bicycle
car
motorbike
aeroplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
sofa
pottedplant
bed
diningtable
toilet
tvmonitor
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush
@mfoglio
Copy link
Author

mfoglio commented Jan 24, 2025

Apologies, I believe it was an issue with file paths.

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

1 participant