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

demo结果有问题 #48

Closed
deepage opened this issue Jul 21, 2021 · 20 comments
Closed

demo结果有问题 #48

deepage opened this issue Jul 21, 2021 · 20 comments

Comments

@deepage
Copy link

deepage commented Jul 21, 2021

你好,我直接下载官方提供的yolox-nano模型跑demo程序,测试dog.jpg,发现输出结果稍微有点问题,多了一个目标。调用代码如下:
python tools/demo.py image -n yolox-nano -c ./models/yolox_nano.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 416 --save_result
显示结果如下图所示:
image
我打印输出outputs的结果如下:
tensor([[ 71.5272, 116.8364, 172.1584, 295.3528, 0.9587, 0.8872, 16.0000], [ 60.9691, 75.9739, 307.4900, 231.2223, 0.9442, 0.8800, 1.0000], [252.5838, 41.6913, 375.4042, 91.2227, 0.7677, 0.8870, 2.0000], [252.0094, 41.5889, 375.6715, 93.2385, 0.4352, 0.8493, 7.0000]], device='cuda:0')
另外,比较奇怪的是,我把pytorch模型转换成ncnn之后检测结果正常。直接使用的是官方提供的yolox.cpp文件,参数设置和上面相同,检测结果如下图所示:
image
16 = 0.84702 at 132.07 215.84 185.92 x 329.64 1 = 0.82856 at 113.21 140.14 454.67 x 286.03 2 = 0.68373 at 466.35 77.03 226.64 x 91.41
非常感谢您的工程!

@juechenzp
Copy link

两个的阈值一样吗

@deepage
Copy link
Author

deepage commented Jul 21, 2021

一样呀,都是--conf 0.3 --nms 0.65

@HHaa-gif
Copy link

你好,我直接下载官方提供的yolox-nano模型跑demo程序,测试dog.jpg,发现输出结果稍微有点问题,多了一个目标。调用代码如下:
python tools/demo.py image -n yolox-nano -c ./models/yolox_nano.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 416 --save_result
显示结果如下图所示:
image
我打印输出outputs的结果如下:
tensor([[ 71.5272, 116.8364, 172.1584, 295.3528, 0.9587, 0.8872, 16.0000], [ 60.9691, 75.9739, 307.4900, 231.2223, 0.9442, 0.8800, 1.0000], [252.5838, 41.6913, 375.4042, 91.2227, 0.7677, 0.8870, 2.0000], [252.0094, 41.5889, 375.6715, 93.2385, 0.4352, 0.8493, 7.0000]], device='cuda:0')
另外,比较奇怪的是,我把pytorch模型转换成ncnn之后检测结果正常。直接使用的是官方提供的yolox.cpp文件,参数设置和上面相同,检测结果如下图所示:
image
16 = 0.84702 at 132.07 215.84 185.92 x 329.64 1 = 0.82856 at 113.21 140.14 454.67 x 286.03 2 = 0.68373 at 466.35 77.03 226.64 x 91.41
非常感谢您的工程!

你好,请问测试完demo,在哪看测试图片结果呀?

@deepage
Copy link
Author

deepage commented Jul 21, 2021

现在版本的运行完成之后结果会存储在/YOLOX-ROOT/YOLOX_outputs/nano/vis_res/下面,而且会打印输出结果存储位置

@Joker316701882
Copy link
Member

Hi @deepage and all. It's because the ncnn demo and PyTorch demo use different NMS implementations (implemented by different people). So it's normal they have minor differences. Feel free to work around with our code! Any suggestion or bug report is welcomed.

@HHaa-gif
Copy link

现在版本的运行完成之后结果会存储在/YOLOX-ROOT/YOLOX_outputs/nano/vis_res/下面,而且会打印输出结果存储位置

我这里面运行完了是空的

@Joker316701882
Copy link
Member

@HHaa-gif Could you share your log?

@HHaa-gif
Copy link

@HHaa-gif Could you share your log?
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)

@Joker316701882
Copy link
Member

@HHaa-gif Please provide your command and the full log.

@HHaa-gif
Copy link

@HHaa-gif Please provide your command and the full log.
Command:
python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result
demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)

@yancie-yjr
Copy link
Contributor

@HHaa-gif Please provide your command and the full log.
Command:
python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result
demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)

Can you check your checkpoint file in right path?

@huolianchu
Copy link

@HHaa-gif Please provide your command and the full log.
Command:

demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result

Can you check your checkpoint file in right path?

I have the same problem, my model path is fine

@deepage
Copy link
Author

deepage commented Jul 22, 2021

@HHaa-gif Please provide your command and the full log.
Command:
demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result

Can you check your checkpoint file in right path?

I have the same problem, my model path is fine

If your model path is fine or model is right,you can see the log like that:

2021-07-21 16:01:01 | INFO     | __main__:233 - Model Summary: Params: 0.91M, Gflops: 1.08
2021-07-21 16:01:05 | INFO     | __main__:244 - loading checkpoint
2021-07-21 16:01:06 | INFO     | __main__:249 - loaded checkpoint done.
2021-07-21 16:01:06 | INFO     | __main__:131 - Infer time: 0.0761s
2021-07-21 16:01:06 | INFO     | __main__:169 - Saving detection result in ./YOLOX_outputs/nano/vis_res/2021_07_21_16_01_06/dog.jpg

And, this demo maybe only get result with gpu but not cpu.

@StephenStorm
Copy link

@HHaa-gif Please provide your command and the full log.
Command:
demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result

Can you check your checkpoint file in right path?

I have the same problem, my model path is fine

If your model path is fine or model is right,you can see the log like that:

2021-07-21 16:01:01 | INFO     | __main__:233 - Model Summary: Params: 0.91M, Gflops: 1.08
2021-07-21 16:01:05 | INFO     | __main__:244 - loading checkpoint
2021-07-21 16:01:06 | INFO     | __main__:249 - loaded checkpoint done.
2021-07-21 16:01:06 | INFO     | __main__:131 - Infer time: 0.0761s
2021-07-21 16:01:06 | INFO     | __main__:169 - Saving detection result in ./YOLOX_outputs/nano/vis_res/2021_07_21_16_01_06/dog.jpg

And, this demo maybe only get result with gpu but not cpu.

i have the same problem, and i found that this line in demo.py can't be executed successfully.
'model = exp.get_model()'

@liuwei3612
Copy link

2021-07-22 11:38:21.478 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='/pth/yolox_s.pth.tar', conf=None, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=None, path='assets/dog.jpg', save_result=False, trt=False, tsize=None)

我也遇到了这个问题,你们是怎么解决的啊?

@liuwei3612
Copy link

(base) lw@lw-System:~/work/YOLOX$ python3 tools/demo.py image -n yolox-s -c path/to/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result
2021-07-22 12:13:29 | INFO | main:219 - Args: Namespace(camid=0, ckpt='path/to/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)
/home/lw/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
2021-07-22 12:13:29 | INFO | main:229 - Model Summary: Params: 8.97M, Gflops: 26.81

大家遇到这样的问题了吗?是怎么解决的?

@HHaa-gif
Copy link

@HHaa-gif Please provide your command and the full log.
Command:
demo_log.txt:
2021-07-21 18:51:21.085 | INFO | main:main:219 - Args: Namespace(camid=0, ckpt='models/yolox_s.pth.tar', conf=0.3, demo='image', exp_file=None, experiment_name='yolox_s', fp16=False, fuse=False, name='yolox-s', nms=0.65, path='assets/dog.jpg', save_result=True, trt=False, tsize=640)python tools/demo.py image -n yolox-s -c models/yolox_s.pth.tar --path assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result

Can you check your checkpoint file in right path?

I have the same problem, my model path is fine

If your model path is fine or model is right,you can see the log like that:

2021-07-21 16:01:01 | INFO     | __main__:233 - Model Summary: Params: 0.91M, Gflops: 1.08
2021-07-21 16:01:05 | INFO     | __main__:244 - loading checkpoint
2021-07-21 16:01:06 | INFO     | __main__:249 - loaded checkpoint done.
2021-07-21 16:01:06 | INFO     | __main__:131 - Infer time: 0.0761s
2021-07-21 16:01:06 | INFO     | __main__:169 - Saving detection result in ./YOLOX_outputs/nano/vis_res/2021_07_21_16_01_06/dog.jpg

And, this demo maybe only get result with gpu but not cpu.

i have the same problem, and i found that this line in demo.py can't be executed successfully.
'model = exp.get_model()'

I read the author's source code, only nano. Py (Exps / default) has get_ Model () method, the others are not, so I suspect that the author's code has not been updated

@Joker316701882
Copy link
Member

Hi @liuwei3612 @deepage @StephenStorm @huolianchu @HHaa-gif , we have updated the demo.py, many bug are fixed!
Please pull our latest branch and try the demo again.

Notes:
In the new demo.py, you can use --device to specify the device (cpu/gpu), cpu is the default device. Good luck.

@Joker316701882
Copy link
Member

@KangChou I saw the result here:
image
what do you mean?

@Joker316701882
Copy link
Member

@HHaa-gif The get_model() method of other models inherits from yolox/exp/yolox_base.py. So they are fine.

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

9 participants