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.

exec_net.infer returns -1

donthireddy__bindu
673 Views

hi ,

i'm trying to run a script with NCS2 stick .i converted facenet model using model optimiser with datatype FP16 and while executing i should get array of embedding with size (1,512) but i got an array with of -1 with shape (1,512) ,could u help me how to resolve that error.

openvino version (2019.1.144)

ubuntu version(16.04)

 

Thanks

bindu sri.

0 Kudos
5 Replies
Shubha_R_Intel
Employee
673 Views

Dear donthireddy, bindu,

I don't understand your error message. Did you get a specific error or exception from Inference Engine ?

Thanks,

Shubha

0 Kudos
donthireddy__bindu
673 Views

hi shubha ,

if u go through the script in that i am using facenet.xml  to extract 512 embeddings of an image but i got this array exec_net============= {'normalize': array([[ 1., -1., -1.,  1., -1.,  1., -1.,  1., -1., -1.,  1.,  1., -1.,
        -1., -1., -1.,  1., -1.,  1., -1., -1.,  1.,  1., -1., -1., -1.,
        -1.,  1.,  1.,  1., -1.,  1.,  1., -1., -1., -1., -1., -1., -1.,
        -1., -1.,  1.,  1., -1., -1.,  1., -1., -1., -1., -1.,  1.,  1.,
         1., -1., -1.,  1., -1.,  1.,  1.,  1., -1.,  1., -1., -1., -1.,
         1.,  1., -1.,  1., -1.,  1.,  1., -1.,  1., -1., -1., -1., -1.,
        -1.,  1.,  1., -1., -1., -1.,  1., -1., -1.,  1., -1.,  1.,  1.,
        -1.,  1., -1.,  1.,  1.,  1., -1., -1.,  1.,  1., -1., -1.,  1.,
         1.,  1.,  1., -1., -1., -1.,  1., -1., -1., -1., -1., -1.,  1.,
        -1.,  1.,  1., -1.,  1., -1., -1., -1., -1.,  1., -1., -1., -1.,
        -1., -1.,  1., -1., -1.,  1., -1.,  1.,  1.,  1., -1., -1.,  1.,
        -1.,  1., -1., -1., -1., -1., -1.,  1., -1., -1.,  1.,  1., -1.,
         1., -1.,  1., -1.,  1., -1., -1., -1.,  1., -1.,  1., -1., -1.,
         1., -1.,  1., -1., -1.,  1., -1.,  1., -1., -1., -1., -1., -1.,
        -1.,  1., -1.,  1., -1.,  1., -1.,  1.,  1., -1.,  1., -1.,  1.,
        -1.,  1., -1., -1., -1.,  1.,  1., -1., -1., -1., -1., -1., -1.,
        -1.,  1., -1., -1., -1., -1., -1., -1., -1.,  1., -1.,  1., -1.,
        -1., -1., -1., -1., -1., -1., -1., -1.,  1.,  1., -1., -1., -1.,
        -1., -1.,  1., -1., -1., -1.,  1.,  1.,  1., -1.,  1.,  1., -1.,
         1., -1., -1., -1.,  1.,  1.,  1., -1., -1.,  1., -1.,  1.,  1.,
        -1., -1.,  1., -1., -1., -1., -1.,  1., -1., -1., -1.,  1.,  1.,
        -1., -1., -1., -1., -1., -1., -1., -1.,  1., -1., -1., -1., -1.,
        -1.,  1., -1., -1., -1., -1., -1., -1., -1., -1.,  1.,  1., -1.,
        -1.,  1., -1.,  1., -1., -1., -1., -1., -1.,  1., -1., -1., -1.,
        -1.,  1.,  1., -1., -1., -1., -1., -1.,  1., -1., -1.,  1., -1.,
        -1.,  1., -1.,  1.,  1.,  1.,  1., -1.,  1.,  1.,  1., -1., -1.,
         1.,  1.,  1., -1.,  1., -1., -1., -1.,  1., -1.,  1.,  1., -1.,
        -1., -1.,  1., -1., -1.,  1., -1., -1., -1., -1., -1., -1., -1.,
        -1.,  1.,  1., -1., -1.,  1., -1., -1., -1.,  1.,  1.,  1., -1.,
        -1., -1., -1., -1., -1., -1.,  1.,  1., -1.,  1., -1., -1., -1.,
         1.,  1., -1., -1., -1.,  1.,  1., -1.,  1.,  1., -1.,  1., -1.,
         1., -1., -1., -1., -1.,  1., -1.,  1., -1.,  1., -1., -1., -1.,
         1.,  1., -1., -1.,  1.,  1., -1.,  1., -1., -1.,  1., -1., -1.,
        -1.,  1.,  1., -1., -1., -1.,  1.,  1., -1., -1., -1., -1., -1.,
         1., -1., -1., -1., -1.,  1., -1., -1., -1., -1.,  1., -1., -1.,
        -1.,  1.,  1.,  1.,  1., -1., -1., -1., -1.,  1., -1., -1., -1.,
        -1., -1.,  1., -1.,  1., -1., -1., -1.,  1., -1.,  1.,  1.,  1.,
         1.,  1., -1., -1., -1., -1.,  1., -1., -1., -1., -1., -1., -1.,
         1., -1.,  1., -1., -1., -1., -1.,  1., -1.,  1., -1., -1., -1.,
         1., -1., -1., -1., -1.]], dtype=float32)}

 

so i would like to know how ill get embeddings with that .xml

thanks

bindusri.

0 Kudos
Shubha_R_Intel
Employee
673 Views

Dear donthireddy, bindu,

I studied your code and there is a lot of pre-processing going on. For instance, this function:

def prewhiten(x):
    mean = np.mean(x)
    std = np.std(x)
    std_adj = np.maximum(std, 1.0/np.sqrt(x.size))
    y = np.multiply(np.subtract(x, mean), 1/std_adj)
    return y  

Not to mention cropping and so on.

As I mentioned to this poster with a similar question and similar code also the reason you're getting these garbage values is because you are not properly telling model optimizer about the pre-processing of your images. Once you do that, you should not get these garbage values.

Hope it helps,

Thanks,

Shubha

 

0 Kudos
donthireddy__bindu
673 Views

hello shubha,

As you said i removed all the preprocesing functions and just executed the following code i got the same result.could just go through it and let me know the changes.

img ='deepu.jpg'    
image = cv2.imread(img)
face_path = '/home/icsltd/Desktop/deepika/facenet-master/facenet-master/facenet.xml'
weights_file = face_path[:face_path.rfind('.')] + '.bin'
net = ie.IENetwork(face_path, weights_file)
plugin = ie.IEPlugin("MYRIAD")
input_name = list(net.inputs.keys())[0]
output_name = list(net.outputs.keys())[0]
exec_net = plugin.load(net)
print('first__________________________',image.shape)     
n, c, h, w = net.inputs[input_name].shape
print('before__________________________',image.shape)       
if image.shape[:-1] != (h, w):
    print('__________________________',image.shape)
    image = np.resize(image,(n,c,w, h))
    print(image.shape)
# Transpose image for channel first format
    #image = image.transpose([0,1, 3, 2])
    
    feed_dict = {input_name: image}
    print('++++++++++++++++++++++++====',feed_dict)
    
    emb_outputs=exec_net.infer(feed_dict)
    print('exec_net=============',emb_outputs)

 thanks,

bindu sri.

0 Kudos
Shubha_R_Intel
Employee
673 Views

Dear donthireddy, bindu,

Please download 2019R2 which was just released last week and try again.

Thanks,

Shubha

 

0 Kudos
Reply