Beispiel #1
0
 def __init__(self, show_img=True):
     self.pose_estimator = PoseEstimator()
     self.object_detector = ObjectDetectionYolo()
     self.object_tracker = ObjectTracker()
     self.BBV = BBoxVisualizer()
     self.KPV = KeyPointVisualizer()
     self.IDV = IDVisualizer(with_bbox=False)
     self.img = []
     self.img_black = []
     self.show_img = show_img
Beispiel #2
0
 def __init__(self, path=config.video_path, show_img=True):
     self.pose_estimator = PoseEstimator()
     self.object_detector = ObjectDetectionYolo()
     self.BBV = BBoxVisualizer()
     self.IDV = IDVisualizer()
     self.object_tracker = ObjectTracker()
     self.video_path = path
     self.cap = cv2.VideoCapture(self.video_path)
     self.img = []
     self.img_black = []
     self.show_img = show_img
     self.locator = Locator([1, 2])
 def __init__(self, show_img=True):
     self.object_detector = ObjectDetectionYolo(cfg=opt.yolo_cfg, weight=opt.yolo_weight)
     self.object_tracker = ObjectTracker()
     self.BBV = BBoxVisualizer()
     self.IDV = IDVisualizer(with_bbox=False)
     self.boxes = tensor([])
     self.boxes_scores = tensor([])
     self.img_black = np.array([])
     self.frame = np.array([])
     self.id2bbox = {}
     self.show_img = show_img
     self.CNN_model = CNNInference()
Beispiel #4
0
 def __init__(self, video_path):
     # self.BBV = BBoxVisualizer()
     self.cap = cv2.VideoCapture(video_path)
     self.height, self.width = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT)), int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
     with open("/".join(video_path.split("/")[:-1]) + "/" + video_path.split("/")[-1][:-4] + "_box.txt", "r") as bf:
         self.box_txt = [line[:-1] for line in bf.readlines()]
     with open("/".join(video_path.split("/")[:-1]) + "/" + video_path.split("/")[-1][:-4] + "_kps.txt", "r") as kf:
         self.kps_txt = [line[:-1] for line in kf.readlines()]
     with open("/".join(video_path.split("/")[:-1]) + "/" + video_path.split("/")[-1][:-4] +
               "_kps_score.txt", "r") as ksf:
         self.kps_score_txt = [line[:-1] for line in ksf.readlines()]
     self.IDV = IDVisualizer(with_bbox=True)
     self.KPV = KeyPointVisualizer()
Beispiel #5
0
 def __init__(self, show_img=True):
     self.object_detector = ObjectDetectionYolo(cfg=yolo_cfg, weight=yolo_weight)
     self.object_tracker = ObjectTracker()
     self.pose_estimator = PoseEstimator(pose_cfg=pose_cfg, pose_weight=pose_weight)
     self.BBV = BBoxVisualizer()
     self.KPV = KeyPointVisualizer()
     self.IDV = IDVisualizer(with_bbox=False)
     self.boxes = tensor([])
     self.boxes_scores = tensor([])
     self.img_black = np.array([])
     self.frame = np.array([])
     self.id2bbox = {}
     self.kps = {}
     self.kps_score = {}
     self.show_img = show_img
 def __init__(self, resize_size, show_img=True):
     self.object_detector = ObjectDetectionYolo(cfg=config.yolo_cfg, weight=config.yolo_weight)
     self.object_tracker = ObjectTracker()
     self.pose_estimator = PoseEstimator(pose_cfg=config.pose_cfg, pose_weight=config.pose_weight)
     self.BBV = BBoxVisualizer()
     self.KPV = KeyPointVisualizer()
     self.IDV = IDVisualizer()
     self.boxes = tensor([])
     self.boxes_scores = tensor([])
     self.frame = np.array([])
     self.id2bbox = {}
     self.CNN_model = CNNInference()
     self.kps = {}
     self.kps_score = {}
     self.show_img = show_img
     self.resize_size = resize_size
 def __init__(self, model_name, video_path, label_path):
     model_name, video_path, label_path = model_name.replace(
         "\\", "/"), video_path.replace("\\",
                                        "/"), label_path.replace("\\", "/")
     self.tester = self.__get_tester(model_name)
     self.video_name = video_path.split("/")[-1]
     self.cap = cv2.VideoCapture(video_path)
     self.IDV = IDVisualizer(with_bbox=True)
     self.KPV = KeyPointVisualizer()
     self.height, self.width = int(self.cap.get(
         cv2.CAP_PROP_FRAME_HEIGHT)), int(
             self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
     self.kps_dict = defaultdict(list)
     self.KPSP = KPSProcessor(self.height, self.width)
     self.label, self.test_id = self.__get_label(label_path)
     self.coord = []
     self.pred = defaultdict(str)
     self.pred_dict = defaultdict(list)
     self.res = defaultdict(bool)
     self.label_dict = defaultdict(bool)
     with open(
             "/".join(video_path.split("/")[:-1]) + "_txt/" +
             video_path.split("/")[-1][:-4] + "_box.txt", "r") as bf:
         self.box_txt = [line[:-1] for line in bf.readlines()]
     with open(
             "/".join(video_path.split("/")[:-1]) + "_txt/" +
             video_path.split("/")[-1][:-4] + "_kps.txt", "r") as kf:
         self.kps_txt = [line[:-1] for line in kf.readlines()]
     with open(
             "/".join(video_path.split("/")[:-1]) + "_txt/" +
             video_path.split("/")[-1][:-4] + "_kps_score.txt", "r") as ksf:
         self.kps_score_txt = [line[:-1] for line in ksf.readlines()]
     if write_video:
         res_video = "/".join(
             video_path.split("/")[:-1]) + "_" + model_name.split(
                 "/")[-1][:-4] + "/" + self.video_name
         self.out = cv2.VideoWriter(res_video,
                                    cv2.VideoWriter_fourcc(*'XVID'), 10,
                                    store_size)