Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read "model_file" with object_detection_demo from a Docker image on a Raspberry Pi 4 #2042

Open
jomoengineer opened this issue Feb 1, 2021 · 18 comments
Assignees
Labels
ARM ARM based platform RaspberryPi OpenVINO for RapsberryPi package

Comments

@jomoengineer
Copy link

I am attempting to run a Open Model Zoo example from a OpenVINO Docker image on a Raspberry Pi 4 but each attempt results in "Can't read" the input file.
I've downloaded the models using the downloader.py script and placed then in a 'models' folder under the default user folder but I can not seem to get the demo to work

This is how I am running the demo and the output.

root@raspberrypi:~/open_model_zoo/demos/build/armv7l/Release# ./object_detection_demo -i /root/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.bin -at ssd -m /root/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.xml -d MYRIAD
[ INFO ] InferenceEngine: 	API version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ ERROR ] [ ERROR ] Can't read /root/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.bin

Most examples I have seen show the use of a "object_detection_demo_ssd_async" demo, however this is not available with the latest Release of Open Model Zoo demos.

Am I running this correctly?

@vladimir-dudnik
Copy link
Contributor

@jomoengineer It seems you apply models's .BIN file instead of image or video when using -i /root/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.bin option.

@jomoengineer
Copy link
Author

@vladimir-dudnik
Thanks. I get the same result when I reference a .mp4 file

root@raspberrypi:~/open_model_zoo/demos/build/armv7l/Release# ./object_detection_demo -i /root/Downloads/person-bicycle-car-detection.mp4 -at ssd -m /root/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.xml -d MYRIAD
[ INFO ] InferenceEngine: 	API version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ ERROR ] [ ERROR ] Can't read /root/Downloads/person-bicycle-car-detection.mp4

Am I doing something wrong here?

I can run the openvino_fd_myriad.py script and it does not fail, so I am assuming the env is okay.

root@raspberrypi:~/Downloads# python3 openvino_fd_myriad.py 
Detection results in out.png

root@raspberrypi:~/Downloads# ls -lt out.png 
-rw-r--r-- 1 root root 1298282 Feb  1 16:43 out.png

It would be helpful if there were an examples showing the files used which are available via downloader.py script like there is/was for "object_detection_demo_ssd_async" demo. Perhaps update the "Building Open Model Zoo Demos on Raspberry Pi*" Support page.

@jomoengineer
Copy link
Author

I think what might be happening is that I copy and pasted the example from the web page to the console which added unseen characters. If I remove the "-i" and retype it , it seems to be fine. This was done on a non Docker instance as well. I had a similar issue with the git '--depth 1' option when cloning the Open Model Zoo example from the "Install OpenVINO™ toolkit for Raspbian* OS" page but that might be another issue post.

However, I did follow the OpenVINO install from "Install OpenVINO™ toolkit for Raspbian* page, and combined with what is shown on the Raspberry Pi Docker, I tried the 'object_detection_demo' but ran into another issue. Perhaps I should open another issue for this.
I am running this via remote desktop into the Pi so I am not sure if that is part of the issue.

Error.

pi@raspberrypi:~/open_model_zoo/demos/build/armv7l/Release $ ./object_detection_demo -i ~/models/person-bicycle-car-detection.mp4 -at ssd -m ~/models/intel/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.xml -d MYRIAD
[ INFO ] InferenceEngine: 	API version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (919) open OpenCV | GStreamer warning: unable to query duration of stream
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (956) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1
[ INFO ] Loading Inference Engine
[ INFO ] Device info: 
[ INFO ] 	MYRIAD
	myriadPlugin version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
Loading network files
[ INFO ] Batch size is forced to 1.
[ INFO ] Checking that the inputs are as the demo expects
[ INFO ] Checking that the outputs are as the demo expects
[ ERROR ] [ ERROR ] This demo accepts networks having only one output

@jomoengineer
Copy link
Author

Okay, I guess person-attributes-recognition-crossroad model is not supported with the object_detection_demo according to the models.lst. I ran with the face-detection-adas model and it did not fail but still gets the GStreamer warning.

$ ./object_detection_demo -i ~/models/person-bicycle-car-detection.mp4 -at ssd -m ~/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml -d MYRIAD
[ INFO ] InferenceEngine: 	API version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (919) open OpenCV | GStreamer warning: unable to query duration of stream
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (956) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1
[ INFO ] Loading Inference Engine
[ INFO ] Device info: 
[ INFO ] 	MYRIAD
	myriadPlugin version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
Loading network files
[ INFO ] Batch size is forced to 1.
[ INFO ] Checking that the inputs are as the demo expects
[ INFO ] Checking that the outputs are as the demo expects
[ INFO ] Loading model to the device

[ INFO ] Metric reports:
Latency: 142.8 ms
FPS: 13.0
[ INFO ] 

[ INFO ] The execution has completed successfully

@jomoengineer
Copy link
Author

I tried the same exercise within the Raspberry Pi Docker image and I still get the " Can't read " error.

root@raspberrypi:~/open_model_zoo/demos/build# ./armv7l/Release/object_detection_demo -i ~/models/person-bicycle-car-detection.mp4 -at ssd -m ~/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml -d MYRIAD
[ INFO ] InferenceEngine: 	API version ......... 2.1
	Build ........... 2021.2.0-1877-176bdf51370-releases/2021/2
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ ERROR ] [ ERROR ] Can't read /root/models/person-bicycle-car-detection.mp4

The file appears to be fine.

root@raspberrypi:~/open_model_zoo/demos/build# file /root/models/person-bicycle-car-detection.mp4 

root@raspberrypi:~/open_model_zoo/demos/build# ls -lt ~/models/person-bicycle-car-detection.mp4 
-rw-r--r-- 1 root root 6031199 Feb  2 00:33 /root/models/person-bicycle-car-detection.mp4

/root/models/person-bicycle-car-detection.mp4: ISO Media, MP4 v2 [ISO 14496-14]

@vladimir-dudnik
Copy link
Contributor

vladimir-dudnik commented Feb 4, 2021

@jomoengineer not sure what may cause this issue. Open Model Zoo demos use OpenCV to read media files. Could you please try any of OpenCV samples with this video file?

@eizamaliev @Wovchena @fzhar do we hide error messages from underlying OpenCV VideoCapture, so that become difficult to troubleshoot issues with demo input access?

@terfendail @alalek could you please consult when we may meet messages, like below on RasperryPi board?

[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (919) open OpenCV | GStreamer warning: unable to query duration of stream
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (956) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1

@jomoengineer
Copy link
Author

In the Raspberry Pi Docker container, I built the opencv samples as shown in the opencv samples README,and ran the 'openvino_sample_peopledetect' sample using the same .mp4 file and it produced the error listed below.

ReadMe referenced:

/opt/intel/openvino/opencv/samples/README.md
root@raspberrypi:~/Downloads/samples_build# ./openvino_sample_peopledetect -v ~/Downloads/person-bicycle-car-detection.mp4
[ WARN:0] global ../opencv/modules/core/src/utils/samples.cpp (59) findFile cv::samples::findFile('true') => ''
[ERROR:0] global ../opencv/modules/videoio/src/cap.cpp (142) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.1-openvino) ../opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): true in function 'icvExtractPattern'


Can not open video stream: 'true'

Hopefully I did that right.

@vladimir-dudnik
Copy link
Contributor

@jomoengineer This error message basically says that sample is using OpenCV image reader (imread function), it is not able to open video files. For video files OpenCV has VideoCapture object, I'm not sure if there is relevant sample in OpenCV which comes precompiled with OpenVINO package.

Demo in OMZ determine what type of file used as an input and call appropriate OpenCV objects, like image reader for images and VideoCapture for video file or USB camera. OpenCV VideoCapture do not implements video decoder by itself, instead it call to underlaying media backend, which OpenCV detects at initialization time. On Linux systems it might be ffmpeg library or gstreamer. I suspect that on RaspberryPi something wrong with media backends (might be it can't configure gstreamer or can't initialize ffmpeg library by some reason). Unfortunately we do not see exact error message from OpenCV, that is why I ask to try to run some OpenCV sample which can open video file, to ensure that it is able to work with media backends available on the system.

@fzhar
Copy link
Contributor

fzhar commented Feb 4, 2021

Hello. Speaking about openvino_sample_peopledetect, you should use this form of command line:
./openvino_sample_peopledetect -v=~/Downloads/person-bicycle-car-detection.mp4
(It's kinda non-standard, true).

Let's stick to open model zoo samples, they are easier to work with.
As I understand from the thread, this execution was completed successfully:
./object_detection_demo -i ~/models/person-bicycle-car-detection.mp4 -at ssd -m ~/models/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml -d MYRIAD
You should be able to see rendered images if you use X-windows. If you use console only, please add -r option key to print found objects. Note that there's no too many large faces on that video, so there will be few detections.
As for GStreamer warnings, as @vladimir-dudnik mentioned, OpenCV video reader that we use relies on different video backends (FFMPEG, GStreamer, MSDK) - some of them might throw warnings. According to these 2 warnings, GStreamer cannot calculate duration of stream (probably due to lack of information in video container), but as long as it works, it's fine.

I've tried face-detection-adas on that video and it found nothing (due to perspective of camera). You might want to try YOLO-V3 for instance, it gives more interesting results:

 ./object_detection_demo -m ../../../../tools/downloader/public/yolo-v3-tiny-tf/FP16/yolo-v3-tiny-tf.xml -i /home/fzharino/Videos/person-bicycle-car-detection.mp4 -at yolo -r

(put proper path to converted yolo-v3-tf or yolo-v3-tiny-tf models)

Please check if this example works fine, if it won't show any result - I'll debug the problem deeper.

@jomoengineer
Copy link
Author

@fzhar This is the result of running the openvino_sample_peopledetect as you show. I do not believe this is correct.

root@raspberrypi:~/Downloads/samples_build# ./openvino_sample_peopledetect -v=~/Downloads/person-bicycle-car-detection.mp4
[ WARN:0] global ../opencv/modules/core/src/utils/samples.cpp (59) findFile cv::samples::findFile('~/Downloads/person-bicycle-car-detection.mp4') => ''
Can not open video stream: '~/Downloads/person-bicycle-car-detection.mp4

With regards to the "object_detection_demo", this runs on the Raspberry Pi 4 proper but with the GStreamer warnings.
However, in the Docker instance running on a Raspberry Pi 4, it still gets the 'Can't read' error.

I'll try the Yolo example but not sure what the point is.

@fzhar
Copy link
Contributor

fzhar commented Feb 4, 2021

And speaking about docker problem (sorry I missed it in the first message). @jomoengineer, do you have GStreamer or FFMPEG installed in docker image ? Do you use some standard image (please provide a link where you've taken it from, to make sure) or is it custom-built ?

@jomoengineer
Copy link
Author

@fzhar The instructions from this link is what I followed to install the Docker image on the Raspberry Pi 4:
https://www.intel.com/content/www/us/en/support/articles/000055220/boards-and-kits.html

@fzhar
Copy link
Contributor

fzhar commented Feb 4, 2021

@jomoengineer, I'll add verbose output for video reading utilities to get better logs and will come up with new version to try.

@jomoengineer
Copy link
Author

Just a note, perhaps another topic, on the Raspberry Pi 4 proper, the 'openvino_sample_peopledetect' sample does run and detects people but with the GStreamer warnings as well:

pi@raspberrypi:~/Downloads/samples_build $ ./openvino_sample_peopledetect -v=/home/pi/models/person-bicycle-car-detection.mp4 
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (919) open OpenCV | GStreamer warning: unable to query duration of stream
[ WARN:0] global ../opencv/modules/videoio/src/cap_gstreamer.cpp (956) open OpenCV | GStreamer warning: Cannot query video position: status=1, value=0, duration=-1
Press 'q' or <ESC> to quit.
Press <space> to toggle between Default and Daimler detector
Finished reading: empty frame

Also, looking at the help, there is no indication that the use of '-v=" is required to run this, just '-v' or '--video',

pi@raspberrypi:~/Downloads/samples_build $ ./openvino_sample_peopledetect -h
This sample demonstrates the use of the HoG descriptor.
Usage: openvino_sample_peopledetect [params] 

	-c, --camera (value:0)
		capture video from camera (device index starting from 0)
	-h, --help (value:true)
		print help message
	-v, --video
		use video as input

@vladimir-dudnik
Copy link
Contributor

vladimir-dudnik commented Apr 1, 2022

@jomoengineer have you resolved that issue? OpenCV does not decode video data by itself, it use some media backends instead. And we do not know what media backends available on your system. Could you try to play this .MP4 file with any system application?

cc @alalek @mshabunin @alvoron FYI

@jomoengineer
Copy link
Author

@vladimir-dudnik This issue is over a year old and not something I have come back to since.
The original issue is regarding "Open Model Zoo example from a OpenVINO Docker image on a Raspberry Pi 4" so that should give you a clue as to the backend that was used. Other than that, I have not idea. My suggestion is to try running the Docker Image as stated on a Raspberry Pi 4 and see what happens. That is if it interests you.

@vadymeng0
Copy link

I met the same issue on x86 arch. Seems that OpenCV cannot open video file as expected. Does anyone resolve it?

@vladimir-dudnik
Copy link
Contributor

vladimir-dudnik commented Jan 25, 2023

@vadymeng0 Not sure that is the same issue. What video file can't be opened by OpenCV on x86 system? Note, OpenCV does not decode video by itself, it use some media framworks as backends instead. For example, on Windows it could be Microsoft Media Foundation or ffmpeg (downloaded separately). On Linux it can be gstreamer with its plugins. In any case it not Open Model Zoo or OpenVINO issue. If you can share this video file, some of OpenCV experts might help you to rootcause the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM ARM based platform RaspberryPi OpenVINO for RapsberryPi package
Projects
None yet
Development

No branches or pull requests

4 participants