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

ValueError: cannot reshape array of size 2097152 into shape (128,128,1)

idata
Employee
2,719 Views

Hi

 

I am trying to run a UNET architecture (built using keras using tensorflow as backend) on myriad2 using NCSDK2.05. I have ubuntu 16.04.

 

I converted the keras model to tensorflow graph. When I try to use .meta file with mvncProfile (-s 12 -in=Images -on=PredictionMask/Sigmoid ) I get the following error:

 

Blob generated

 

USB: Transferring Data…

 

Time to Execute : 231.29 ms

 

USB: Myriad Execution Finished

 

Time to Execute : 189.13 ms

 

USB: Myriad Execution Finished

 

Traceback (most recent call last):

 

File "/usr/local/bin/mvNCProfile", line 159, in

 

profile_net(args.network, args.inputnode, args.outputnode, args.nshaves, args.inputsize, args.weights, args.device_no, args.explicit_concat, args.ma2480, args.scheduler, args)

 

File "/usr/local/bin/mvNCProfile", line 145, in profile_net

 

timings, myriad_output = run_myriad(graph_file, args)

 

File "/usr/local/bin/ncsdk/Controllers/MiscIO.py", line 321, in run_myriad

 

myriad_output = myriad_output.reshape(sz[1], sz[2], sz[3])

 

ValueError: cannot reshape array of size 2097152 into shape (128,128,1)

 

Any help will be appreciated.

 

-Regards

 

Baishali
0 Kudos
5 Replies
idata
Employee
1,515 Views

does there a concat layer at your network's end?

0 Kudos
idata
Employee
1,515 Views

hi @zufeifei my last layer is the prediction layer ((Sigmoid ) Have a look at the last 3 layers: Its a keras using tensorflow as backend)

 

up9 = K.layers.concatenate([up, conv1], axis=concat_axis)

 

conv9 = K.layers.Conv2D(name="conv9a", filters=32, **params)(up9) conv9 = K.layers.Conv2D(name="conv9b", filters=32, **params)(conv9) prediction = K.layers.Conv2D(name="PredictionMask", filters=num_chan_out, kernel_size=(1, 1), data_format=data_format, activation="sigmoid")(conv9) model = K.models.Model(inputs=[inputs], outputs=[prediction])

 

I did go through all the forum contents concerning your prroblem. And I saw that you tried using a reshape layer after concat. Did that help?

0 Kudos
idata
Employee
1,515 Views

@baishali

 

a reshape layer can help you to bypass the concat layer's problem,

 

a concay layer sometimes cause the output's shape innormal
0 Kudos
idata
Employee
1,515 Views

hi @ zulfeifei I am not sure where to add the reshape layer as i have multiple concat layers at different levels. And also I have a doubt what size of the reshape layer should I use

0 Kudos
idata
Employee
1,515 Views

the shape of output is (128, 128,128), but not (128, 128, 1). I met the same error, where the active fn is sigmoid

0 Kudos
Reply