def detect_post(shared_output_arrs, face_q): start_time = None frame_cnt = 0 while True: read_slot = shared_output_arrs.openReadId() if start_time is None: start_time = time.time() if read_slot is None: break read_slot_arrs = shared_output_arrs.accessNumpyBuffer(read_slot) face_rects = det_postprocess(read_slot_arrs[1], read_slot_arrs[2], [320, 320, 3]) shared_output_arrs.closeReadId(read_slot) frame_cnt += 1 face_q.put(face_rects) end_time = time.time() face_q.put(None) print('detect post processing time: {0} seconds'.format(end_time - start_time)) total_time = end_time - start_time print('Total run: {0} frames in {1} seconds ({2} fps)'.format( frame_cnt, total_time, frame_cnt / total_time))
def detect(runner, fpgaBlobs, image): fpgaInput = fpgaBlobs[0][0] c, h, w = fpgaInput[0].shape szs = det_preprocess(image, w, h, fpgaInput[0]) jid = runner.execute_async(fpgaBlobs[0], fpgaBlobs[1]) runner.wait(jid) rects = det_postprocess(fpgaBlobs[1][1], fpgaBlobs[1][0], [h, w, c], szs) return rects