PRBonn / bonnetal

Bonnet and then some! Deep Learning Framework for various Image Recognition Tasks. Photogrammetry and Robotics Lab, University of Bonn
MIT License
234 stars 60 forks source link

Worse accuracy with ONNX version (inferenced in C++ by OpenCV) #23

Closed mcwoojcik closed 4 years ago

mcwoojcik commented 4 years ago

Hello,

I used your script "make_deploy_model.py" to create ONNX version of person segmentation models (for all three versions). After I inferenced it using OpenCV:

cv::dnn::Net net = cv::dnn::readNetFromONNX("my_path/erf/model.onnx"); cv::Mat inpBlob = cv::dnn::blobFromImage(image, ...) //necessary blob image net.setInput(inpBlob); cv::Mat output = net.forward(); cv::Mat mask(H, W, CV_32F, output.ptr(0, 1)); and after some processes on obtained mask from inference otput based on your source code (necessary information like image_means for extract proper pixels I taked from cfg.yaml).

I would like to ask you if ONNX version can have worse accuracy or if I'm doing something wrong in postprocess step on obtained output from network? I was also thinking if maybe blob image step can cause some information loss.

Please let me know your opinion

sample results comparison: resssss

tano297 commented 4 years ago

Hi,

The network is not the only step taken to segment the image. Before the network you need to put the images in RGB (opencv uses BGR), and normalize the images. You can check the python script and check every step taken before the model inference happens. This happens in the User class if I am not mistaken. I am on my phone and can't check no

tano297 commented 4 years ago

I suggest you use our C++ library in your project instead of opencv. It takes care of all this for you, and it uses tensor RT which makes this model run at 200fps when infering in int8

mcwoojcik commented 4 years ago

Thank you for your answer. I was trying to build your library follow instructions (by catkin) but I've got errors which I wasn't able to fix :( I would like to exploit TensorRT library but I'm forced to run it on PC without GPU. Furthermore, I have to work on windows... I will try to apply changes :)

mcwoojcik commented 4 years ago

I have another question... I'm also working on keypoint detection (for human pose estimation) and I've read that you're going add this algorithm to your library. I would like to ask you how is it going :) ?

tano297 commented 4 years ago

Unfortunately, since we started working with lidar, this project became stagnant (some people in the lab are still adding tasks though). I will remove those placeholders now, since it probably won't happen in the near future