frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

mvncStatus.TIMEOUT

I get" raise Exception(Status(status)) Exception: mvncStatus.TIMEOUT" when I run graph.GetResult(), does anyone know why?

from mvnc import mvncapi as mvnc
import numpy as np
import cv2
import os
import sys
import tensorflow as tf

IMAGE_PATH =os.path.dirname(os.path.realpath(__file__))+'/disparity.png'
GRAPH_PATH=os.path.dirname(os.path.realpath(__file__))+'/model/CCNN.graph'
PAD=4

def do_initialize() -> (mvnc.Device, mvnc.Graph):
    # ***************************************************************
    # Get a list of ALL the sticks that are plugged in
    # ***************************************************************
    devices = mvnc.EnumerateDevices()
    if len(devices) == 0:
            print('Error - No devices found')
            return (None, None)

    device.OpenDevice()


    # Load graph file
    try :
        with open(GRAPH_PATH, mode='rb') as f:
            in_memory_graph = f.read()
    except :
        print ("Error reading graph file: " + graph_filename)

    graph = device.AllocateGraph(in_memory_graph)

    return device, graph


def forward(graph: mvnc.Graph, image_filename: str):

    print("[*] Forwarding....")


    # Load image from disk and preprocess it to prepare it for the network
    disparity = np.expand_dims(np.expand_dims(cv2.imread(image_filename, cv2.IMREAD_GRAYSCALE), 0), -1)
    padded_disparity = np.pad(disparity, ((0, 0), (PAD, PAD), (PAD, PAD), (0, 0)), "reflect")

    # Start the inference by sending to the device/graph
  graph.LoadTensor(padded_disparity, "user object for this inference")

    output, userobj = graph.GetResult()

    result = (output*65535.).astype(np.uint16)
    cv2.imwrite('test.png', result[0])

Comments

Sign In or Register to comment.