Open kminemur opened 5 months ago
@Wovchena I guess, this issue occurs due to mismatch between the expected input shape of the model and the actual input shape provided by the background_subtraction_demo_gapi
demo.
you may try these steps and do let me know if it works:-
[1, 3, height, width].
import cv2
import numpy as np
def preprocess_frame(frame, target_height, target_width):
resized_frame = cv2.resize(frame, (target_width, target_height))
# Convert the frame to the format [1, 3, height, width]
input_frame = np.expand_dims(resized_frame.transpose(2, 0, 1), axis=0)
return input_frame
cap = cv2.VideoCapture('person-bicycle-car-detection.mp4')
ret, frame = cap.read() if not ret: print("Failed to read the video file") exit()
input_frame = preprocess_frame(frame, 432, 768) # Replace with the target height and width
np.save('preprocessed_frame.npy', input_frame)
cap.release()
3. update the demo script with the above change and execute it
plz let me know, if the above works or not
Thanks
Hi team, background_subtraction_demo_gapi failed with person-bicycle-car-detection.mp4 from Media Files: https://storage.openvinotoolkit.org/data/test_data/videos.
How to download: wget https://storage.openvinotoolkit.org/data/test_data/videos/person-bicycle-car-detection.mp4
[Environment] OS: Ubuntu 22.04.2 LTS Kernel: 5.15.0-86-generic Openvino: 2023.3.0 OpenCV: 4.9.0
[Log] $ ./background_subtraction_demo_gapi -m $HOME/workshop/kazuki/open_model_zoo/demos/background_subtraction_demo/cpp_gapi/intel/instance-segmentation-security-0002/FP32/instance-segmentation-security-0002.xml -i person-bicycle-car-detection.mp4 -at maskrcnn [ INFO ] OpenVINO [ INFO ] version: 2023.3.0 [ INFO ] build: 2023.3.0-13775-ceeafaf64f3 [ INFO ] The background matting model /home/yuzhang3/workshop/kazuki/open_model_zoo/demos/background_subtraction_demo/cpp_gapi/intel/instance-segmentation-security-0002/FP32/instance-segmentation-security-0002.xml is loaded to CPU device. [ ERROR ] [ GENERAL_ERROR ] Exception from src/plugins/intel_cpu/src/infer_request.cpp:393: Can't set the input tensor with name: image, because the model input (shape=[1,3,?,?]) and the tensor (shape=(1.432.768.3)) are incompatible