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.

Device enumerate

idata
Employee
681 Views

Hi,

 

I have a solution where I start lots of different docker containers (video2rabbitmq, rabbitmq, movidius object detector, identified object classification for good or bad object). All is started with docker-compose.

 

From the movidius object detector I am running more than one container to speed up the processing. In this process I am also managing device disconnection ( someone pull out the device from te usb) and reconnect.

 

But when one of the container want to reconnect I would need to know what device to use or what device is free.

 

So how can I find out from the device enumerate if one device is already used by an other container?

 

Thanx in advance

 

S&|
0 Kudos
1 Reply
idata
Employee
405 Views

Hi,

 

I have solved it.

 

Currently I have 3 MOVIDIUS worker in separate docker container (docker-compose scale) and they i enumerate the available devices n parallel. If the same device (at the same time) was selected by more than one container then one will use it, while the other will get an error, then it start to iterate again while no device is found.

 

I am using the same to re-initiate if one of the device is disconnected while it was in use.

 

# Open the defined MOVIDIUS Neural Computing Stick def openDevice(self): # grab a list of all NCS devices plugged in to USB while True: print("[INFO] finding NCS devices...") devices = mvnc.EnumerateDevices() print("[INFO] NCS devices check done...") # if no devices found, exit the script if len(devices) == 0: print("[INFO] No devices found. Please plug in a NCS") time.sleep(1) continue opened = False for i in range(0,len(devices)) : try : self.device = mvnc.Device(devices[i]) self.device.OpenDevice() # open the CNN graph file defining the model print("[INFO] loading the graph file( %s ) into memory..." % os.environ["GRAPH"]) with open(os.environ["GRAPH"], mode="rb") as f: graph_in_memory = f.read() # load the graph into the NCS print("[INFO] allocating the graph on the NCS...") self.graph = self.device.AllocateGraph(graph_in_memory) opened = True print("[INFO] Device ready") break except Exception as e: continue if opened : break else : print("[ERROR] from device Opening. Will retry...") time.sleep(1) continue
0 Kudos
Reply