Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

Unable to run a program on NCS2, however same program runs when device is selected as CPU

SDhim3
Beginner
454 Views

Created a custom model using tensorflow

used mo.py to convert my model to .bin and .xml

 

 

import cv2 as cv

# Load the model.

net = cv.dnn.readNet('face-detection-adas-0001.xml',

           'face-detection-adas-0001.bin')

# Specify target device.

net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)

# Read an image.

frame = cv.imread('face.jpg')

if frame is None:

  raise Exception('Image not found!')

# Prepare input blob and perform an inference.

blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U)

net.setInput(blob)

out = net.forward()

# Draw detected faces on the frame.

for detection in out.reshape(-1, 7):

  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.5:

    cv.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))

# Save the frame to an image file.

cv.imwrite('out.png', frame)

 

 

When Device is MYRIAD, program throws error at out = net.forward() , step

Error:

AssertionFailed: weights->desc().totalDimSize() >=kernelSizeX * kernelSizeY * (input->desc().dim(Dim::C)/groupSize) * output->desc().dim(Dim ::C) in function initPlugin

 

but when same program being run on CPU, it works fine.

OS: Ubuntu 16.04 LTS

 

please suggest, what needs to be done.

 

0 Kudos
1 Reply
JesusE_Intel
Moderator
231 Views

Hi SDhim3,

 

I have a couple of questions regarding your setup:

 

  • What OpenVINO toolkit version are you using?
  • What is the size of your model?
  • What topology is your custom trained model based on?
  • Could you share the Tensorflow model and converted IR model?
    • How did you convert the model to IR format? Please provide model optimizer command.

 

You can share the files through a private message by clicking on my user name and clicking the "message" button.

 

Regards,

Jesus

 

0 Kudos
Reply