sacmehta / EdgeNets

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

Making changes to avoid Segmentation Fault on raspberry pi #19

Closed marcusvlc closed 4 years ago

marcusvlc commented 5 years ago

When I tried to run ESPNETv2 in a raspberry pi environment I was having a problem trying to run it for a large amount of images. The network stopped running with the following message: Segmentation Fault.

After a debug process, I found that the problem was on the following lines:

    filtered_box_probs [:, 0] * = width
    filtered_box_probs [:, 1] * = height
    filtered_box_probs [:, 2] * = width
    filtered_box_probs [:, 3] * = height

In the box_predictor.py file

I believe these multiplication operations directly with tensors may be causing some problems in more limited environments (eg raspberry with 1gb ram and a 32 bit system). To do this, I made some changes to work around this issue, and succeeded in running ESPNETv2 on raspberry pi.

Summary of Changes: Basically excludes the above lines that were generating Segmentation Fault, and within the demo_detection.py file I added the multiplications in the coordinate values ​​directly. Since the multiplications are now with values ​​and not tensors, I got no error running the network for a large amount of time and with a large amount of images.

sacmehta commented 4 years ago

I have incorporated your suggestions by adding a flag to BoxPredictor class