Forums - Using SNPE with camera

2 posts / 0 new
Last post
Using SNPE with camera
yanbophx
Join Date: 16 Oct 17
Posts: 17
Posted: Fri, 2017-11-17 22:20

I would like to feed video stream to SNPE so that the neural network model can infer the object in the video frames live, can anyone enlighten me on what is the best way to achieve this goal? I am quite new to Android development and relatively new to Linux development as well. Any advice would be very much appreciated.

The development board that I am using is Qualcomm S820a ADP.

Best regards,

  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Tue, 2019-09-24 03:29

Hi,
Yes, Image pre-processing can be done within the Android Application. 
Here is the sample code for an Android Application using Mobilenet SSD for object detection. The model is provided with the pre-processed images where the input is received from the camera feed.

Steps followed for pre-processing the image in Android App:
1. Resize the image/bitmap size according to the input size required by the model.
2. Convert Bitmap to buffer(RGBA byte array)
3. Process pixels RGBA(0..255) to BGR(-1..1)
This will convert Bitmap (300,300,4 ints) to Float Input Tensor (300,300,3 floats)

For code reference for the above steps, please follow this class https://github.com/globaledgesoft/AIML-DashCam-App/blob/master/app/src/main/java/com/qc/dashcam/Helpers/BitmapToFloatArrayHelper.java

Hope this helps!
Thanks

  • 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.