Forums - Is Object detection using MobilenetSSD model and Drawing the bounding boxes possible with SNPE?

2 posts / 0 new
Last post
Is Object detection using MobilenetSSD model and Drawing the bounding boxes possible with SNPE?
piyalgeorge
Join Date: 29 Apr 20
Posts: 5
Posted: Fri, 2020-05-08 22:45
Hi I'm trying to perform object detection using MobilenetSSD caffe model with SNPE APIs.(I have already tested the SNPE setup with Alexnet and Inception models, and i'm getting the results without any issue). I'm have converted the caffemodel to .DLC file. I have tested with using snpe-net-run tool, I am getting output for that also, output is some .raw files. How can i get the detection coordinates of  objects for drawing the bounding boxes ?
 
Please Help on this.
  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Mon, 2020-05-18 22:40
 

Kindly read the date from the raw file generated with the following python code and find the explanation below on how to parse the output.

$ python3.5
>>import numpy as np
>>res = np.fromfile('detection_out.raw', dtype="float32")
>>print(res)
[[0.,         6.,         0.99923944, 0.05772871 0.1193189,  0.9643268, 0.8045521 ]]

Explanation:
res[0, 1] will be ID for the label, as it was trained on VOC Label 6 which belongs to the bus.
res[0, 2] represent the probability of the predicted object, it is 0.9992 here
res[0, 3:7] are the scaled X1, Y1 & X2, Y2 Values respectively.
For re-scaling it Multiply X1 & X2 with Width of image & Y1 & Y2 with the Height of the image, and cast it to the Integer.
This gives the bounding box for the object predicted.

Command to convert the caffe model to dlc:
$ snpe-caffe-to-dlc --input_network MobileNetSSD_deploy.prototxt --caffe_bin MobileNetSSD_deploy.caffemodel --output_path caffe_mobilenet_ssd.dlc

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.