def __init__(self): self.vdo = cv2.VideoCapture() self.yolo3 = YOLO3("YOLO3/cfg/yolov3-tiny.cfg", "YOLO3/yolov3-tiny.weights", "YOLO3/cfg/coco.names", is_xywh=True) self.write_video = True
def __init__(self): self.vdo = cv2.VideoCapture() self.yolo3 = YOLO3("YOLO3/cfg/yolo_v3.cfg","YOLO3/yolov3.weights","YOLO3/cfg/coco.names", is_xywh=True) self.yolo3.net= self.yolo3.net.cuda() self.deepsort = DeepSort("deep/checkpoint/ckpt.t7") self.class_names = self.yolo3.class_names self.write_video = True
def __init__(self): self.vdo = cv2.VideoCapture() self.yolo3 = YOLO3("YOLO3/cfg/yolo_v3.cfg", "/local/b/cam2/data/HumanBehavior/yolov3.weights", "YOLO3/cfg/coco.names", is_xywh=True) self.deepsort = DeepSort("/local/b/cam2/data/HumanBehavior/ckpt.t7") self.class_names = self.yolo3.class_names self.write_video = True
def __init__(self, im_height, im_width, my_config): self.need = my_config['need'] self.use_cuda = my_config['use_cuda'] self.map_location_flag = my_config['map_location_flag'] self.bad_time = my_config['bad_time'] self.left_time = my_config['left_time'] self.bad_time = my_config['bad_time'] #参数相机的 长度 宽度 #测试的时候可以 图片的长度 宽度 self.vdo = cv2.VideoCapture() yolov3Flag = my_config['yolo'] if (yolov3Flag == 'yolov3'): self.yolo3 = YOLO3("YOLO3/cfg/yolo_v3.cfg", "YOLO3/yolov3.weights", "YOLO3/cfg/coco.names", use_cuda=self.use_cuda, is_xywh=True) elif (yolov3Flag == 'yolov3-tiny'): self.yolo3 = YOLO3("YOLO3/cfg/yolov3-tiny.cfg", "YOLO3/yolov3-tiny.weights", "YOLO3/cfg/coco.names", use_cuda=self.use_cuda, is_xywh=True) self.track_number = my_config['track_number'] self.class_names = self.yolo3.class_names self.write_video = True # self.im_width = int(self.vdo.get(cv2.CAP_PROP_FRAME_WIDTH)) self.im_width = im_width # self.im_height = int(self.vdo.get(cv2.CAP_PROP_FRAME_HEIGHT)) self.im_height = im_height self.area = 0, 0, self.im_width, self.im_height self.bad_time_object = my_config['bad_time_object'] # self.deepsort_arr = [ # DeepSort("deep/checkpoint/ckpt.t7", use_cuda=self.use_cuda, map_location_flag=self.map_location_flag, # bad_time=self.bad_time, left_time=self.left_time) for i in range(self.bad_time_object)] self.deepsort_arr = [] for i in range(self.bad_time_object): part = DeepSort("deep/checkpoint/ckpt.t7", use_cuda=self.use_cuda, map_location_flag=self.map_location_flag, bad_time=self.bad_time, left_time=self.left_time) self.deepsort_arr.append(part)