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.
6404 Discussions

Raspbian: bad_alloc in function 'initPlugin' on VGG19

gomes__antonio
Beginner
708 Views

Hello, 

I'm using RaspBerry + NCS2

 

I downloaded the VGG19 model through model_downloader and converted to IR.

when I try to run the model I have this  error:

 

File "teste1_vgg.py", line 45, in <module>

out = net.forward()
cv2.error: OpenCV(4.0.1-openvino) /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/dnn/src/op_inf_engine.cpp:553: error: (-215:Assertion failed) Failed to initialize Inference Engine backend: std::bad_alloc in function 'initPlugin'

So I have an memory error in the function forward() but I don´t know why. 

 Can you help please?

 

Python Code: 

import cv2 as cv

net = cv.dnn.readNet('vgg19.xml', 'vgg19.bin') 
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)

frame_i = cv.imread('/home/pi/Desktop/modelos/classificacao/vgg19/car.bmp')
dim=(224,224)
frame = cv.resize(frame_i, dim)

blob = cv.dnn.blobFromImage(frame, size=(224, 224), ddepth=cv.CV_8U)
net.setInput(blob)
out = net.forward()

 

0 Kudos
3 Replies
Shubha_R_Intel
Employee
708 Views

Dear gomes, antonio,

Before trying your hand at coding from scratch, why not try one of our classification samples on the Model Optimizer Generated IR for VGG19 ?

You can try the classification_sample or classification_sample_async (both available in Python or C++) for example. 

Shubha

 

0 Kudos
gomes__antonio
Beginner
708 Views

Hi Shubha,

Thanks for reply.

Yes, I already tried the classification sample and it worked. But not matters I switched the VGG19 for the Resnet and it work fine for what I want.

Now, I need a segmention model and I'm trying to convert the mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28 on link https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html but I have always a error:

I already tried the follow commands but none worked:

mo_tf.py --input_model D:\MYRIAD\mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28\frozen_inference_graph.pb

or

mo_tf.py --input_model D:\MYRIAD\mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28\frozen_inference_graph.pb --input_shape (1,640,425,3) --data_type=FP16

or

mo_tf.py --input_meta_graph D:\MYRIAD\mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28\model.ckpt.meta --input_shape (1,640,425,3) --data_type=FP16

or

mo_tf.py --input_model D:\MYRIAD\mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28\frozen_inference_graph.pb  --data_type=FP16

 

Is there a command missing? Thanks

Antonio

 

 

0 Kudos
Shubha_R_Intel
Employee
707 Views

Dear gomes, antonio,

Your mo_tf.py commands are not correct. Please follow the instructions here for converting Tensorflow Object Detection APIs via Model Optimizer:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html

Thanks,

Shubha

0 Kudos
Reply