Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
33 Views

Raspbian: bad_alloc in function 'initPlugin' on VGG19

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
Highlighted
Employee
33 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
Highlighted
Beginner
33 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_T... 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
Highlighted
Employee
33 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_...

Thanks,

Shubha

0 Kudos