HornedSungem / SungemSDK

Horned Sungem
http://www.hornedsungem.org/
Apache License 2.0
33 stars 14 forks source link

How to run SqueezeNet ssd model in your product? #21

Closed RamatovInomjon closed 5 years ago

RamatovInomjon commented 5 years ago

image = graph.GetImage(True) # Use the built-in camera as input to return images File "../../../hsapi/core/graph.py", line 140, in GetImage mean_value = c_float(self.mean_value) TypeError: a float is required

Single-device Single-model

import cv2, numpy, sys sys.path.append('../../../') import hsapi as hs # import libs

scale = 1 # Image preprocessing parameters mean = [104.0, 117.0, 123.0] # Image preprocessing parameters

device_list = hs.EnumerateDevices() # Get all connected devices device = hs.Device(device_list[0]) # Get a Device instance

device.OpenDevice() # Open device

with open('/home/inomjon/Projects/Movidius/Sungem/SungemSDK-Python/examples/graphs/pet_magic', mode='rb') as f: data = f.read() graph = device.AllocateGraph(data, scale, mean) # Get a Graph instance

try: while True:

Use the built-in camera of the Horned Sungem as input

    image = graph.GetImage(True) # Use the built-in camera as input to return images
    output, _ = graph.GetResult() # Read neural network output
    print(output)
    cv2.imshow("horned-sungem", image)
    cv2.waitKey(1)

finally: graph.DeallocateGraph() # Release neural network resources device.CloseDevice() # Close device

Above my code and error i have got, please guide me how to solve the issue, Thanks in advance

shaomang commented 5 years ago

change mean = [104.0, 117.0, 123.0] to mean = 117.0 and try again the hs device may only accept single float as mean value