Open DogukanAltay opened 5 years ago
Update: I have resolved the problem. The reason is that, I am using a tensorflow implementation of Mobilenet SSDv2. Therefore after the conversion with the openvino model optimizer, the input layers and output layers are actually different from the model here.
In my case, I have changed the lines above in the MultiStickSSDwithUSBCamera_OpenVINO_NCS2.py
# Lines 147-154
def image_preprocessing(self, color_image):
prepimg = cv2.resize(color_image, (300, 300))
# Commented out the below lines to match the input format of my model. Edit yours accordingly.
# prepimg = prepimg - 127.5
# prepimg = prepimg * 0.007843
prepimg = prepimg[np.newaxis, :, :, :] # Batch size axis add
prepimg = prepimg.transpose((0, 3, 1, 2)) # NHWC to NCHW
return prepimg
and
# Line 179
# For my model, output dict returns with "DetectionOutput" key. You can find yours and replace accordingly.
out = self.exec_net.requests[dev].outputs["DetectionOutput"].flatten()
Device: Raspberry Pi 3 B+
CPU Arch.: armv7l
OS: Raspbian
I have trained a custom 1 class mobile net ssd v2 network using Tensorflow Object Detection API and successfully converted to to IR model using OpenVino 2019 R1.1. Then I substituted the model files in the MultiStickWithPiCamera.py example with my custom model. The predict_async thread raises an error.
Error message:
line 174, in predict_async cnt, dev = heapq.heappop(self.heap_request) IndexError: index out of range