| import vision |
| |
| def run_detector_example(): |
| detector = vision.Detector('ssd_mobilenet_v2_face_quant_postprocess_edgetpu.tflite') |
| for frame in vision.get_frames('Face Detector', size=(640, 480)): |
| faces = detector.get_objects(frame) |
| vision.draw_objects(frame, faces, color=(255, 0, 255), thickness=5) |
| |
| def run_classifier_example(): |
| labels = vision.load_labels('imagenet_labels.txt') |
| classifier = vision.Classifier('mobilenet_v2_1.0_224_quant_edgetpu.tflite') |
| for frame in vision.get_frames('Object Classifier', size=(640, 480)): |
| classes = classifier.get_classes(frame) |
| vision.draw_classes(frame, classes, labels, color=(255, 0, 255)) |
| |
| if __name__ == '__main__': |
| #run_classifier_example() |
| run_detector_example() |