def convert_to_db(paths, job, label): paths = clean_paths(paths) paths_db = [] for path in paths: path_db = Path(job = job, label=label) for box in path: box_db = Box(path = path_db) box_db.xtl = box['rect'][0] box_db.ytl = box['rect'][1] box_db.xbr = box['rect'][0] + box['rect'][2] box_db.ybr = box['rect'][1] + box['rect'][3] box_db.frame = box['frame'] box_db.outside = 0 if box['visible'] else 1 box_db.occluded = 0 path_db.boxes.append(box_db) paths_db.append(path_db) return paths_db
def convert_to_db(paths, job, label): paths = clean_paths(paths) paths_db = [] for path in paths: path_db = Path(job=job, label=label) for box in path: box_db = Box(path=path_db) box_db.xtl = box['rect'][0] box_db.ytl = box['rect'][1] box_db.xbr = box['rect'][0] + box['rect'][2] box_db.ybr = box['rect'][1] + box['rect'][3] box_db.frame = box['frame'] box_db.outside = 0 if box['visible'] else 1 box_db.occluded = 0 path_db.boxes.append(box_db) paths_db.append(path_db) return paths_db