コード例 #1
0
 def __init__(self):
     # Initialize Webcam
     self.stream = cv2.VideoCapture(0)
     # Starting TensorFlow API with SSD Mobilenet
     self.detection = DetectionObj(model='ssd_mobilenet_v1_coco_11_06_2017')
     # Start capturing video so the Webca, will tune itself
     _, self.frame = self.stream.read()
     # Set the stop flag to False
     self.stop = False
     #
     Thread(target=self.refresh, args=()).start()
コード例 #2
0
class WebcamStream:
    def __init__(self):
        # Initialize Webcam
        self.stream = cv2.VideoCapture(0)
        # Starting TensorFlow API with SSD Mobilenet
        self.detection = DetectionObj(model='ssd_mobilenet_v1_coco_11_06_2017')
        # Start capturing video so the Webca, will tune itself
        _, self.frame = self.stream.read()
        # Set the stop flag to False
        self.stop = False
        #
        Thread(target=self.refresh, args=()).start()

    def refresh(self):
        # Looping until an explicit stop is sent
        # from outside the function
        while True:
            if self.stop:
                return
            _, self.frame = self.stream.read()

    def get(self):
        # returning the annotated image
        return self.detection.annotate_photogram(self.frame)

    def halt(self):
        # setting the halt flag
        self.stop = True
コード例 #3
0
from tensorflow_detection import DetectionObj

if __name__ == '__main__':
    detection = DetectionObj(model='ssd_mobilenet_v2_coco_11_06_2017')
    detection.video_pipeline(video="./sample_videos/ducks.mp4", audio=False)
コード例 #4
0
from tensorflow_detection import DetectionObj

if __name__ == "__main__":
    detection = DetectionObj(model='ssd_mobilenet_v1_coco_11_06_2017')

    images = [
        "./sample_images/intersection.jpg", "./sample_images/busy_street.jpg",
        "./sample_images/doge.jpg"
    ]
    detection.file_pipeline(images)
コード例 #5
0
from tensorflow_detection import DetectionObj

if __name__ == '__main__':
    detection = DetectionObj(model='ssd_mobilenet_v1_coco_11_06_2017')
    detection.webcam_pipeline()