- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try to run the SSD-lite mobilenetv2 model on raspberry pi 3B+, however, some errors occur:
[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
VIDIOC_REQBUFS: Inappropriate ioctl for device
The test script is as follows:
import cv2 import numpy as np from openvino.inference_engine import IENetwork, IECore model_xml = "./frozen_inference_graph.xml" model_bin = "./frozen_inference_graph.bin" # Read labels filename = './labels.txt' with open(filename, 'r') as f: s = [i[:-1].split() for i in f.readlines()] ie = IECore() net = IENetwork(model=model_xml, weights=model_bin) exec_net = ie.load_network(network=net, device_name="MYRIAD") input_blob = next(iter(net.inputs)) output_blob = next(iter(net.outputs)) net.batch_size = 1 #print(net.outputs['DetectionOutput'].shape) n, c, h, w = net.inputs[input_blob].shape #print(n, c, h, w) font = cv2.FONT_HERSHEY_DUPLEX cap = cv2.VideoCapture("video.mp4") ret, frame = cap.read() while cap.isOpened(): ret, frame = cap.read() in_frame = cv2.resize(frame, (w, h)) in_frame = in_frame.transpose((2, 0, 1)) # Change data layout from HWC to CHW in_frame = in_frame.reshape((n, c, h, w)) res = exec_net.infer(inputs={input_blob: in_frame}) #print(res) out = res['DetectionOutput'][0][0] #print(out) # Draw detected faces on the frame. for detection in out: confidence = float(detection[2]) xmin = int(detection[3] * frame.shape[1]) ymin = int(detection[4] * frame.shape[0]) xmax = int(detection[5] * frame.shape[1]) ymax = int(detection[6] * frame.shape[0]) if confidence > 0.7: cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0)) print("index:", int(detection[1])-1) cv2.putText(frame, (s[int(detection[1])-1])[1], (xmin+3, ymin-3), font, 1, (0, 0, 0), 1,) # Save the frame to an image file. cv2.imshow('out.jpg', frame) key = cv2.waitKey(1) if key == 27: break cv2.destroyAllWindows()
It seems that I can't open the video.mp4 with the opencv in openvino, how can I solve this problem?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi es, we,
I believe this may be related to a known issue with the GStreamer backend not handling relative paths. The issue has been fixed and will be implemented on the next software release. Meanwhile, you can use the absolute file path as a workaround.
Please let me know if this works for you.
#Change this line: cap = cv2.VideoCapture("video.mp4") #to cap = cv2.VideoCapture("/home/pi/<PATH>/video.mp4")
Regards,
Jesus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jesus E. (Intel) wrote:Hi es, we,
I believe this may be related to a known issue with the GStreamer backend not handling relative paths. The issue has been fixed and will be implemented on the next software release. Meanwhile, you can use the absolute file path as a workaround.
Please let me know if this works for you.
#Change this line: cap = cv2.VideoCapture("video.mp4") #to cap = cv2.VideoCapture("/home/pi/<PATH>/video.mp4")Regards,
Jesus
Thanks, it works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi es,we,
Great, I am glad it worked for you! This should be fixed in the next software release.
Regards,
Jesus
![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page