def run(self, video_path=0, start_frame=0, conf_thresh=0.6):
    ' Runs the test on a video (or webcam)\n        \n        # Arguments\n        video_path: A file path to a video to be tested on. Can also be a number, \n                    in which case the webcam with the same number (i.e. 0) is \n                    used instead\n                    \n        start_frame: The number of the first frame of the video to be processed\n                     by the network. \n                     \n        conf_thresh: Threshold of confidence. Any boxes with lower confidence \n                     are not visualized.\n                    \n        '
    vid = cv2.VideoCapture(video_path)
    if (not vid.isOpened()):
        raise IOError("Couldn't open video file or webcam. If you're trying to open a webcam, make sure you video_path is an integer!")
    vidw = vid.get(cv2.CAP_PROP_FRAME_WIDTH)
    vidh = vid.get(cv2.CAP_PROP_FRAME_HEIGHT)
    vidar = (vidw / vidh)
    if (start_frame > 0):
        vid.set(cv2.CAP_PROP_POS_MSEC, start_frame)
    accum_time = 0
    curr_fps = 0
    fps = 'FPS: ??'
    prev_time = timer()
    while True:
        (retval, orig_image) = vid.read()
        if (not retval):
            print('Done!')
            return
        im_size = (self.input_shape[0], self.input_shape[1])
        resized = cv2.resize(orig_image, im_size)
        rgb = cv2.cvtColor(resized, cv2.COLOR_BGR2RGB)
        to_draw = cv2.resize(resized, (int((self.input_shape[0] * vidar)), self.input_shape[1]))
        inputs = [image.img_to_array(rgb)]
        tmp_inp = np.array(inputs)
        x = preprocess_input(tmp_inp)
        y = self.model.predict(x)
        results = self.bbox_util.detection_out(y)
        if ((len(results) > 0) and (len(results[0]) > 0)):
            det_label = results[0][:, 0]
            det_conf = results[0][:, 1]
            det_xmin = results[0][:, 2]
            det_ymin = results[0][:, 3]
            det_xmax = results[0][:, 4]
            det_ymax = results[0][:, 5]
            top_indices = [i for (i, conf) in enumerate(det_conf) if (conf >= conf_thresh)]
            top_conf = det_conf[top_indices]
            top_label_indices = det_label[top_indices].tolist()
            top_xmin = det_xmin[top_indices]
            top_ymin = det_ymin[top_indices]
            top_xmax = det_xmax[top_indices]
            top_ymax = det_ymax[top_indices]
            for i in range(top_conf.shape[0]):
                xmin = int(round((top_xmin[i] * to_draw.shape[1])))
                ymin = int(round((top_ymin[i] * to_draw.shape[0])))
                xmax = int(round((top_xmax[i] * to_draw.shape[1])))
                ymax = int(round((top_ymax[i] * to_draw.shape[0])))
                class_num = int(top_label_indices[i])
                cv2.rectangle(to_draw, (xmin, ymin), (xmax, ymax), self.class_colors[class_num], 2)
                text = ((self.class_names[class_num] + ' ') + ('%.2f' % top_conf[i]))
                text_top = (xmin, (ymin - 10))
                text_bot = ((xmin + 80), (ymin + 5))
                text_pos = ((xmin + 5), ymin)
                cv2.rectangle(to_draw, text_top, text_bot, self.class_colors[class_num], (- 1))
                cv2.putText(to_draw, text, text_pos, cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 0), 1)
        curr_time = timer()
        exec_time = (curr_time - prev_time)
        prev_time = curr_time
        accum_time = (accum_time + exec_time)
        curr_fps = (curr_fps + 1)
        if (accum_time > 1):
            accum_time = (accum_time - 1)
            fps = ('FPS: ' + str(curr_fps))
            curr_fps = 0
        cv2.rectangle(to_draw, (0, 0), (50, 17), (255, 255, 255), (- 1))
        cv2.putText(to_draw, fps, (3, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 0), 1)
        cv2.imshow('SSD result', to_draw)
        cv2.waitKey(10)
Runs the test on a video (or webcam)

# Arguments
video_path: A file path to a video to be tested on. Can also be a number, 
            in which case the webcam with the same number (i.e. 0) is 
            used instead
            
start_frame: The number of the first frame of the video to be processed
             by the network. 
             
conf_thresh: Threshold of confidence. Any boxes with lower confidence 
             are not visualized.
def run(self, video_path=0, start_frame=0, conf_thresh=0.6):
    ' Runs the test on a video (or webcam)\n        \n        # Arguments\n        video_path: A file path to a video to be tested on. Can also be a number, \n                    in which case the webcam with the same number (i.e. 0) is \n                    used instead\n                    \n        start_frame: The number of the first frame of the video to be processed\n                     by the network. \n                     \n        conf_thresh: Threshold of confidence. Any boxes with lower confidence \n                     are not visualized.\n                    \n        '
    vid = cv2.VideoCapture(video_path)
    if (not vid.isOpened()):
        raise IOError("Couldn't open video file or webcam. If you're trying to open a webcam, make sure you video_path is an integer!")
    vidw = vid.get(cv2.CAP_PROP_FRAME_WIDTH)
    vidh = vid.get(cv2.CAP_PROP_FRAME_HEIGHT)
    vidar = (vidw / vidh)
    if (start_frame > 0):
        vid.set(cv2.CAP_PROP_POS_MSEC, start_frame)
    accum_time = 0
    curr_fps = 0
    fps = 'FPS: ??'
    prev_time = timer()
    while True:
        (retval, orig_image) = vid.read()
        if (not retval):
            print('Done!')
            return
        im_size = (self.input_shape[0], self.input_shape[1])
        resized = cv2.resize(orig_image, im_size)
        rgb = cv2.cvtColor(resized, cv2.COLOR_BGR2RGB)
        to_draw = cv2.resize(resized, (int((self.input_shape[0] * vidar)), self.input_shape[1]))
        inputs = [image.img_to_array(rgb)]
        tmp_inp = np.array(inputs)
        x = preprocess_input(tmp_inp)
        y = self.model.predict(x)
        results = self.bbox_util.detection_out(y)
        if ((len(results) > 0) and (len(results[0]) > 0)):
            det_label = results[0][:, 0]
            det_conf = results[0][:, 1]
            det_xmin = results[0][:, 2]
            det_ymin = results[0][:, 3]
            det_xmax = results[0][:, 4]
            det_ymax = results[0][:, 5]
            top_indices = [i for (i, conf) in enumerate(det_conf) if (conf >= conf_thresh)]
            top_conf = det_conf[top_indices]
            top_label_indices = det_label[top_indices].tolist()
            top_xmin = det_xmin[top_indices]
            top_ymin = det_ymin[top_indices]
            top_xmax = det_xmax[top_indices]
            top_ymax = det_ymax[top_indices]
            for i in range(top_conf.shape[0]):
                xmin = int(round((top_xmin[i] * to_draw.shape[1])))
                ymin = int(round((top_ymin[i] * to_draw.shape[0])))
                xmax = int(round((top_xmax[i] * to_draw.shape[1])))
                ymax = int(round((top_ymax[i] * to_draw.shape[0])))
                class_num = int(top_label_indices[i])
                cv2.rectangle(to_draw, (xmin, ymin), (xmax, ymax), self.class_colors[class_num], 2)
                text = ((self.class_names[class_num] + ' ') + ('%.2f' % top_conf[i]))
                text_top = (xmin, (ymin - 10))
                text_bot = ((xmin + 80), (ymin + 5))
                text_pos = ((xmin + 5), ymin)
                cv2.rectangle(to_draw, text_top, text_bot, self.class_colors[class_num], (- 1))
                cv2.putText(to_draw, text, text_pos, cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 0), 1)
        curr_time = timer()
        exec_time = (curr_time - prev_time)
        prev_time = curr_time
        accum_time = (accum_time + exec_time)
        curr_fps = (curr_fps + 1)
        if (accum_time > 1):
            accum_time = (accum_time - 1)
            fps = ('FPS: ' + str(curr_fps))
            curr_fps = 0
        cv2.rectangle(to_draw, (0, 0), (50, 17), (255, 255, 255), (- 1))
        cv2.putText(to_draw, fps, (3, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 0), 1)
        cv2.imshow('SSD result', to_draw)
        cv2.waitKey(10)