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

How to run my own caffe model on the neural stick2?

Shaw__Louis
Beginner
481 Views

here are my preprocess code:

 

def TransmissionEstimate(im_path, height, width):
    caffe.set_mode_cpu()
    #net = caffe.Net('DehazeNet-new122.prototxt', 'solver-new122_iter_57198.caffemodel', caffe.TEST)
    plugin = IEPlugin(device="MYRIAD")
        
    net = IENetwork.from_ir(model="/home/louis/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer/solver-new122_iter_100000.xml", weights="/home/louis/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer/solver-new122_iter_100000.bin")
    input_blob = next(iter(net.inputs))
    out_blob = next(iter(net.outputs))
    exec_net = plugin.load(network=net)
    im = caffe.io.load_image(im_path)
    im = im*255
    npad = ((7,8), (7,8), (0,0))
    im = np.pad(im, npad, 'symmetric')
    transformers = caffe.io.Transformer({'data':net.inputs[input_blob].shape})
    transformers.set_transpose('data', (2,0,1))
    transformers.set_raw_scale('data',255)
    transformers.set_channel_swap('data', (2,1,0))
    test_im = {input_blob:np.array([transformers.preprocess('data', im)])}
    out = exec_net.start_async(request_id=0,inputs={input_blob:np.array([transformers.preprocess('data', im)])})
    infer_status = out.wait()
    out1 = out.outputs[out_blob]
    transmission = np.reshape(out1, (height,width))
    return transmission

 

the error is:

Traceback (most recent call last):
  File "DehazeNet-new1222.py", line 100, in <module>
    te = TransmissionEstimate(im_path, height, width)
  File "DehazeNet-new1222.py", line 36, in TransmissionEstimate
    transmission = np.reshape(out1, (height,width))
  File "/home/louis/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 279, in reshape
    return _wrapfunc(a, 'reshape', newshape, order=order)
  File "/home/louis/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 51, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
ValueError: cannot reshape array of size 329889 into shape (480,680)

 

someone who can help me...I am begging you!!

0 Kudos
2 Replies
Shaw__Louis
Beginner
481 Views

come on..help!

0 Kudos
Shubha_R_Intel
Employee
481 Views

Dear Shaw, Louis,

Sorry I didn't mean to ignore you. But the error in your model is related to transmission = np.reshape(out1, (height,width)) . numpy is not part of OpenVino.

Thanks,

Shubha

0 Kudos
Reply