Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
19.72k stars 4.1k forks source link

Yolact results unstable! #2400

Open areebsyed opened 3 years ago

areebsyed commented 3 years ago

These are my results using Yolact.cpp. I dont understand this issue where the mask is extending to the bounding box edges. Why is that and what is the reason. How can I confine the extra spots to the detected object?

I think it is depending on the bounding box rectangles. See the edges of bounding box. Mask is only spreading till the bounding box rectangle. Can I reduce this effect?

image35 image16

nihui commented 3 years ago

Hi, the yolact example should produce identical result as the original YOLACT project https://github.com/dbolya/yolact Please test your image with the original YOLACT model If the original YOLACT produces the same output as you posted here, then you may have to train your own YOLACT model. Otherwise, it may be a bug in ncnn library then

areebsyed commented 3 years ago

Hi, the yolact example should produce identical result as the original YOLACT project https://github.com/dbolya/yolact Please test your image with the original YOLACT model If the original YOLACT produces the same output as you posted here, then you may have to train your own YOLACT model. Otherwise, it may be a bug in ncnn library then

@nihui thanlkyou so much for your reply. In Yolact with Pytorch the result is perfect and I changed everything according to your tutorial only the yolact.onnx generated from yolact.pth as written in your instructions in the tutorial wasnt converting to yolact-sim.onnx so I used https://github.com/Ma-Dan/yolact for yolact.onnx --> yolact-sim.onnx and the rest I did as you wrote, But the results are different. Maybe theres a problem in my onnx files or I missed something in the yolact.cpp

Here is some of my documents you can check in my google drive! It will be a great help! Thankyou so much!

https://drive.google.com/file/d/16kgoJnNcIErtSfA5ZPl-UCuyDFD8MHHP/view?usp=sharing

chingi071 commented 3 years ago

@areebsyed Hello, I would like to ask if you use https://github.com/Ma-Dan/yolact for yolact.onnx ->yolact-sim.onnx , do you use the model( yolact-sim.onnx ) to do ncnn2onnx and ncnnoptimize? When I execute ncnnoptimize, there will be no output. Do you want to ask if you encounter this situation? I see that your file Yolact_test/ncnn_weights contains yolact_custom.bin and yolact_custom.param. How did you convert to ncnn? Could you please tell me the steps? Thank you very much.

areebsyed commented 3 years ago

@chingi071 yes i used MaDan yolact to convert to onnx then I converted to yolact-sim.onnx as mentioned in the steps here... https://zhuanlan.zhihu.com/p/128974102

Put your yolact-sim.onnx in the /ncnn/build/tools/onnx/yolact-sim.onnx where the executable file onnx2ncnn is there. and run the command ./onnx2ncnn yolact-sim.onnx yolact.param yolact.bin

then 2 files .param and .bin will be generated in the same folder/

chingi071 commented 3 years ago

@areebsyed Thank you very much for your reply. I execute "./onnx2ncnn yolact-sim.onnx yolact.param yolact.bin" and successfully converted. But after executing "./ncnnoptimize yolact.param yolact.bin yolact-opt.param yolact-opt.bin 0", I cannot output the optimized model. Do you optimize the model? Or use the onnx2ncnn model directly?

areebsyed commented 3 years ago

I dont optimize the model. I just use the .param and .bin files in the yolact.cpp code. You can just paste the link directory in yolact.cpp where these 2 are loaded

chingi071 commented 3 years ago

I understand, thank you very much :)

rgkannan676 commented 2 years ago

@areebsyed Hi, where you able to find out why the results are unstable. I am also facing the same issue. Works prefect in pytorch, followed https://github.com/Ma-Dan/yolact for yolact.onnx --> yolact-sim.onnx and created the optimized ncnn files.

rgkannan676 commented 2 years ago

@nihui I tried to follow -https://zhuanlan.zhihu.com/p/128974102 for onnx creation. The onnx creation failed when I used "opset_version=11", without any error. But when I removed "opset_version=11", onnx file was created but is different from the netron graph provided in your blog. When using the onnx, it gave inconsistent results. Can you lease advise on this.

74284853 commented 1 year ago

@nihui I tried to follow -https://zhuanlan.zhihu.com/p/128974102 for onnx creation. The onnx creation failed when I used "opset_version=11", without any error. But when I removed "opset_version=11", onnx file was created but is different from the netron graph provided in your blog. When using the onnx, it gave inconsistent results. Can you lease advise on this.

In the process of converting pth to onnx, I encountered the same problem when used'opset_version=11'. How do you solve this problem? Look forward to your reply!