-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMovidius.py
57 lines (40 loc) · 1.89 KB
/
Movidius.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
############################################################################################
#
# Project: Peter Moss Acute Myeloid & Lymphoblastic Leukemia AI Research Project
# Repository: ALL Detection System 2019
# Project: Facial Authentication Server
#
# Author: Adam Milton-Barker (AdamMiltonBarker.com)
# Contributors:
# Title: Movidius Class
# Description: Movidius class for the ALL Detection System 2019 Facial Authentication Server.
# License: MIT License
# Last Modified: 2020-07-16
#
############################################################################################
import os, json, cv2
from mvnc import mvncapi as mvnc
from Classes.Helpers import Helpers
class Movidius():
""" ALL Detection System 2019 Movidius Class
Movidius helper functions for the ALL Detection System 2019 Facial Authentication Server project.
"""
def __init__(self, LogPath):
""" Initializes the Movidius class. """
self.Helpers = Helpers()
self.LogFile = self.Helpers.setLogFile(LogPath+"/Movidius")
self.ncsDevices = None
self.ncsDevice = None
def checkNCS(self):
""" Checks for NCS devices and returns True if devices are found. """
self.ncsDevices = mvnc.EnumerateDevices()
if len(self.ncsDevices) == 0:
self.Helpers.logMessage(self.LogFile, "Movdius", "Status", "No NCS devices found, TASS exiting!")
quit()
self.ncsDevice = mvnc.Device(self.ncsDevices[0])
self.ncsDevice.OpenDevice()
self.Helpers.logMessage(self.LogFile, "Movdius", "Status", "Connected To NCS")
def allocateGraph(self, graphfile):
""" Allocates the NCS graph. """
self.Graph = self.ncsDevice.AllocateGraph(graphfile)
self.Helpers.logMessage(self.LogFile, "Movdius", "Status", "Graph Allocated")