Ejemplo n.º 1
0
 def __init__(self,
              tracker_list=tracker_list,
              max_age=max_age,
              min_hits=min_hits,
              track_id_list=track_id_list,
              debug=debug):
     self.det = detector.PersonDetector()
     self.frame_count = 0
     self.tracker_list = tracker_list
     self.max_age = max_age
     self.min_hits = min_hits
     self.track_id_list = track_id_list
     self.debug = debug
    if debug:
        print('Ending tracker_list: ', len(tracker_list))
        print('Ending good tracker_list: ', len(good_tracker_list))

    cv2.imshow("frame", img)
    return img

if __name__ == "__main__":
    device_name = "gpu"
    if (len(sys.argv) > 1):
        device_name = sys.argv[1]  # Choose device from cmd line. Options: gpu or cpu
    if device_name == "gpu":
        device_name = "/gpu:0"
    else:
        device_name = "/cpu:0"
    det = detector.PersonDetector(device_name)

    if debug: # test on a sequence of images
        images = [plt.imread(file) for file in glob.glob('./test_images/*.jpg')]

        for i in range(len(images))[0:7]:
             image = images[i]
             image_box = pipeline(image)
             plt.imshow(image_box)
             plt.show()

    else: # test on a video file.
        # output = 'test_v7.mp4'
        # clip1 = VideoFileClip("project_video.mp4")#.subclip(4, 49) # The first 8 seconds doesn't have any cars...
        # clip = clip1.fl_image(pipeline)
        # clip.write_videofile(output, audio=False)
Ejemplo n.º 3
0
    for trk in deleted_tracks:
        track_id_list.append(trk.id)

    tracker_list = [x for x in tracker_list if x.no_losses <= max_age]

    if debug:
        print('Ending tracker_list: ', len(tracker_list))
        print('Ending good tracker_list: ', len(good_tracker_list))

    cv2.imshow("frame", img)
    return img


if __name__ == "__main__":

    det = detector.PersonDetector()

    if debug:  # test on a sequence of images
        images = [
            plt.imread(file) for file in glob.glob('./test_images/*.jpg')
        ]

        for i in range(len(images))[0:7]:
            image = images[i]
            image_box = pipeline(image)
            plt.imshow(image_box)
            plt.show()

    else:  # test on a video file.

        # start=time.time()