def main(imageDirectory): fileExtension = ('*.jpg', '*.JPEG', '*.png') images = [] for ext in fileExtension: images.extend(glob.glob(imageDirectory + '/' + ext)) kernelDir = "kernel_zoo" graphJson = "graph_zoo/graph_tinyyolov3.json" graphName = "tinyyolov3" sysMan = aks.SysManager() sysMan.loadKernels(kernelDir) sysMan.loadGraphs(graphJson) graph = sysMan.getGraph(graphName) print("[INFO] Starting enqueue... ") print("[INFO] Running", len(images), "images") sysMan.resetTimer() t0 = time.time() for i, img in enumerate(images): sysMan.enqueueJob(graph, img) sysMan.waitForAllResults() t1 = time.time() print("[INFO] Overall FPS : ", len(images)/(t1-t0)) sysMan.report(graph) # Destroy SysMan sysMan.clear()
def main(imageDirectory): imgDir = os.path.abspath(imageDirectory) with open(os.path.join(imgDir, 'FDDB_list.txt'), 'r') as f: images = f.readlines() kernelDir = "kernel_zoo" graphJson = "graph_zoo/graph_facedetect.json" graphName = "facedetect" sysMan = aks.SysManager() sysMan.loadKernels(kernelDir) sysMan.loadGraphs(graphJson) graph = sysMan.getGraph(graphName) print("[INFO] Starting enqueue... ") print("[INFO] Running", len(images), "images") sysMan.resetTimer() t0 = time.time() for i, img in enumerate(images): imgPath = os.path.join(imgDir, img.strip() + '.jpg') sysMan.enqueueJob(graph, imgPath) sysMan.waitForAllResults() t1 = time.time() print("[INFO] Overall FPS : ", len(images) / (t1 - t0)) sysMan.report(graph) # Destroy SysMan sysMan.clear()
def main(imageDirectory, graphs): fileExtension = ('*.jpg', '*.JPEG', '*.png') kernelDir = "kernel_zoo" sysMan = aks.SysManager() sysMan.loadKernels(kernelDir) lgraphs = {} images = {} # Load graphs for graphName, graphJson in graphs.items(): sysMan.loadGraphs(graphJson) lgraphs[graphName] = sysMan.getGraph(graphName) images = {} for graphName in lgraphs.keys(): images[graphName] = [] for ext in fileExtension: images[graphName].extend( glob.glob(imageDirectory[graphName] + '/' + ext)) pushThreads = [] sysMan.resetTimer() t0 = time.time() for name, gr in lgraphs.items(): th = threading.Thread(target=enqJobThread, args=( name, gr, images[name], )) th.start() pushThreads.append(th) for th in pushThreads: th.join() sysMan.waitForAllResults() t1 = time.time() print("\n[INFO] Overall FPS:", len(images) * 2 / (t1 - t0)) for name, gr in lgraphs.items(): print("\n[INFO] Graph:", name) sysMan.report(gr) print("") # Destroy SysMan sysMan.clear()
def enqJobThread(name, graph, images): # Get AKS Sys Manager sysMan = aks.SysManager() print("[INFO] Starting Enqueue:", name) for img in images: sysMan.enqueueJob(graph, img)