Forums - Object detection with TensorFlow Lite

18 posts / 0 new
Last post
Object detection with TensorFlow Lite
zmonteci
Join Date: 22 May 18
Posts: 14
Posted: Tue, 2021-03-30 11:13

Object detection with TensorFlow Lite - Qualcomm Developer Network

I am following the instructions on the link above for the Object Detection with Tensorflow and I am running into issues when try to run the application 

root@qrb5165-rb5:/# cd home/src/webcam-detect-tflite/build
root@qrb5165-rb5:/# ./webcam-detector
I am getting the following error
sh-4.4# ./webcam-detector
Loading model: mobilenet_quant_v1_224.tflite
ERROR: Could not open 'mobilenet_quant_v1_224.tflite'.
Failed to load the model.

Any suggestions on this?

Zilmara

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Wed, 2021-04-07 15:39

I will try to reprodece this test? by the way, do you use USB Camera for this test?

  • Up0
  • Down0
zmonteci
Join Date: 22 May 18
Posts: 14
Posted: Wed, 2021-04-07 21:42

I tried using both the USB camera and also the on device camera. thanks for the help

 

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Tue, 2021-04-13 18:54

The mobilenet_quant_v1_224.tflite is at /home/src/webcam-detect-tflite/

you can copy it to build folder, however there is another issue with opencv.

 

Can you try if you have such issue?

sh-4.4# cp ../mobilenet_quant_v1_224.tflite .
sh-4.4# 
sh-4.4# 
sh-4.4# ./webcam-detector 
Loading model: mobilenet_quant_v1_224.tflite
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Failed to open VideoCapture.
sh-4.4# 
sh-4.4# 
sh-4.4# ./webcam-detector 
Loading model: mobilenet_quant_v1_224.tflite
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Failed to open VideoCapture.
sh-4.4# 
 

 

  • Up0
  • Down0
zmonteci
Join Date: 22 May 18
Posts: 14
Posted: Wed, 2021-04-14 06:44

I moved mobilenet_quant_v1_224.tflite to the build folder and now I dont get the error of failed to open file. My new error is

sh-4.4# ./webcam-detector
Loading model: mobilenet_quant_v1_224.tflite
Unable to stop the stream: Inappropriate ioctl for device
Failed to open VideoCapture.

I rebooted the device  and I got the error that it couldnt load labels.txt so I moved that filed to the build folder as well and now I am gettting the following error

sh-4.4# ./webcam-detector
Loading model: mobilenet_quant_v1_224.tflite
Loading labels: labels.txt
Failed to read font file
sh-4.4#

Any Suggestions?

Zilmara

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Wed, 2021-04-14 13:55

have you run 

#weston --tty=1 --connector=29

 

 

  • Up0
  • Down0
zmonteci
Join Date: 22 May 18
Posts: 14
Posted: Wed, 2021-04-14 15:01

Yes I tried running that and i still get the same error

failed to read font file.

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Mon, 2021-04-26 09:40

HI Zilmara

 

Can you try the object detection this sample app in github? It is same as "object detection with TensorFlow Lite", it use the camera on borad.

The sample code is here:

https://github.com/quic/sample-apps-for-Qualcomm-Robotics-RB5-platform/t...

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-05-19 01:23

Hello,

I followed the tutorial at https://developer.qualcomm.com/project/object-detection-tensorflow-lite but I am getting the following error:

sh-4.4# ./webcam-detector
Loading model: mobilenet_quant_v1_224.tflite

(process:3510): GStreamer-CRITICAL **: 15:20:34.255: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
OpenCV | GStreamer warning: GStreamer: unable to query pipeline state (/home/src/opencv-wayland/modules/videoio/src/cap_gstreamer.cpp:421)
(DEBUG) try_init_v4l2 VIDIOC_QUERYCAP "/dev/video0": Inappropriate ioctl for device
Unable to stop the stream: Inappropriate ioctl for device
Failed to open VideoCapture.

What may be the cause if this and how could I resolve it?

Thanks in advance.

 

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Wed, 2021-05-19 03:27

Hi I tried the example in https://github.com/quic/sample-apps-for-Qualcomm-Robotics-RB5-platform/t...

But I am getting the following error:

sh-4.4# make
gcc -Wall snpe_detection.c -o snpe_detection `pkg-config --cflags --libs gstreamer-1.0`
sh-4.4# ./snpe_detection
gbm_create_device(156): Info: backend name is: msm_drm
Not all elements could be created.

Why would this be and how could I resolve it?

Thanks in advance.

  • Up0
  • Down0
mistry Moderator
Join Date: 18 Apr 18
Posts: 56
Posted: Wed, 2021-05-19 12:08

Hi,

We have recently updated the instructions for the TFLite sample demo posted here:

https://developer.qualcomm.com/project/object-detection-tensorflow-lite

There were a few gaps in the instructions.
The CMakeLists.txt file had a line for OpenCV wayland commented, so that path was not getting set.
There was a font file that was missing, and couple of paths that were incorrect.

Can you please try this sample again? 
It works with a USB webcam, so be sure to connect one.

If it gives you the following error,

Unable to stop the stream: Inappropriate ioctl for device
Failed to open VideoCapture.

You will need to find the correct video source in /dev/video* and set the correct video source in main.cxx on line 146:

cv::VideoCapture cap(0);

Recompile and run the app agian.

Hope this helps.

  • Up0
  • Down0
pe.ostad
Join Date: 21 May 21
Posts: 14
Posted: Tue, 2021-08-10 03:49

Hi everyone,

We are using the main camera for this sample app based on this answer

However, we are getting the following error:

Gdk-Message: 10:20:12.003: Error flushing display: Broken pipe

Any Suggestions?

Thanks in Advance

 

  • Up0
  • Down0
kevin.dai
Join Date: 21 Oct 20
Posts: 137
Posted: Tue, 2021-08-10 10:13

Can you use this sample code for object detection?

https://github.com/quic/sample-apps-for-Qualcomm-Robotics-RB5-platform/t...

Thanks

Kevin

  • Up0
  • Down0
pe.ostad
Join Date: 21 May 21
Posts: 14
Posted: Wed, 2021-08-11 02:25

Hi Kevin,

Thank you for your response. This sample code works fine. The point is that we need to use OpenCV for our project. Since this project  uses OpenCV Wayland, we wanted to use it as a starting point to implement our own project. We are not using a USB camera, instead we use on-board cameras since we want to switch between main camera and tracking camera. 

  • Up0
  • Down0
22imonreal
Join Date: 10 Feb 21
Posts: 80
Posted: Mon, 2021-09-06 05:34

I am alos interested in using OpenCV with the onboard cameras, but as far as I understood from other responses to my questions in the forum, onboard cameras are expected to be used with GStreamer and not V4L2? Can someone confirm that onboard cameras only work with GStreamer or how would I use OpenCV otherwise?

Thanks

  • Up0
  • Down0
sunt
Join Date: 26 Apr 22
Posts: 3
Posted: Sat, 2022-07-16 03:06

Hi mistry!

In this demo:

https://developer.qualcomm.com/project/object-detection-tensorflow-lite

model run on CPU, is that right?

How to config to make model run on GPU, DSP mode?

Thank you!

  • Up0
  • Down0
cris.thomas.sky...
Join Date: 12 Aug 22
Posts: 7
Posted: Mon, 2022-09-12 02:21

Hi all,

When running this example, it crashes with a segmentation fault error.

root@qrb5165-rb5:~#./webcam-detector 
Loading model: mobilenet_quant_v1_224.tflite
(process:25933): GStreamer-CRITICAL **: 11:02:03.618: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
OpenCV | GStreamer warning: GStreamer: unable to query pipeline state (/data/opencv-wayland/modules/videoio/src/cap_gstreamer.cpp:421)
Loading labels: labels.txt
[*] DEBUG: handle_toplevel_configure: maximized=0 fullscreen=0 resizing=0 focused=0 size=[0 x 0]
Segmentation fault
 
On backtracing, it seems to be triggered from the cv::waitkey() function.

Any information on how to resolve this issue?

  • Up0
  • Down0
cris.thomas.sky...
Join Date: 12 Aug 22
Posts: 7
Posted: Mon, 2022-09-12 02:52

Solved. The waitkey() polls for key press and needs a keyboard to be connected.

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