sacmehta / EdgeNets

This repository contains the source code of our work on designing efficient CNNs for computer vision
MIT License
411 stars 82 forks source link

Segmentation Fault Espnetv2 on RPI #18

Closed marcusvlc closed 5 years ago

marcusvlc commented 5 years ago

Hello guys, after reading your article on ESPNETv2 I was very excited about your optimizations in convolutional operations, and would very much like to make the network run on a raspberry pi.

After much effort, I was able to compile all the necessary dependencies on raspberry pi, and was able to successfully execute the detection_demo.py script, which by default makes inferences on the images in your repository. However, when I use another set of images (passed as a parameter in --im-dir) the network ends up running with the following message: Segmentation Fault.

Do you have any idea what might be generating this? I tried to use several other image sets, and the only one the network could run without any problems was the default image set from its repository.

I am using the raspberry pi 3 model B + with the Raspibian Buster Lite operating system.

sacmehta commented 5 years ago

What are image extensions? The one supported in demo file are jpg and png.

marcusvlc commented 5 years ago

Im using .jpg only

sacmehta commented 5 years ago

Image sizes?

sacmehta commented 5 years ago

Could you share a sample image?

marcusvlc commented 5 years ago

I tested on a few different image sets, but I have a few examples:

The network can execute normally, but after an X number of inferences it ends with the message Segmentation Fault.

marcusvlc commented 5 years ago

@sacmehta I have uploaded a set of images that I am trying to perform inference. In this specific case, the network ends its execution with a Segmentation Fault after 3 inferences.

Link to images: https://drive.google.com/drive/folders/10yexD1aSjLEsmi3PLRQv4AFcnX3l59hv?usp=sharing

sacmehta commented 5 years ago

I am able to run the detection algorithm on all the images that you provided, so there is no problem in the codebase. Maybe something wrong in your setup. 001_00041

marcusvlc commented 5 years ago

I found the reason for being getting Segmentation Fault in the raspberry pi environment after inference on some images. After manually isolating the operations performed by box_predictor.py, I realized that the error happened precisely in multiplying the height / width of the image by the predicted values, which were within a tensor. To solve this, I used the simplest approach, since there is no need for these tensor multiplications to be performed at that time, I removed them and returned the predicted values ​​in their normalized form, and at the moment of drawing the bouding boxes on the images, I multiplied the values ​​received by box_predictor by the respective height / width of the image.

I can't say exactly why such directly tensor multiplications may be generating Segmentation Fault, but my best guess is because of the limited hardware of the raspberry pi 3, and the system on which it is running, which is an operating system. 32 bits.

It is in my best interest to contribute to the construction of this model, so I made a pull request with the changes I mentioned above, and would be very happy if you were interested in expanding the model compatibility with the more limited edge devices!

sacmehta commented 5 years ago

Thanks @marcusvlc . I will check and merge your changes. Many thanks!