def __init__(self, path, cls_map='arcsoft/cat_id_map.txt', path_replace=None, img_suffix='.jpg'): self.path = path self.path_replace = path_replace self.img_suffix = img_suffix self.txt_list = cvtools.get_files_list(self.path, file_type='.txt', basename=True) # you could comment this sentence if you don't want check integrity of images and labels. # self.img_list = cvtools.get_files_list(self.path, file_type=img_suffix) # assert len(self.img_list) == len(self.txt_list) self.cls_map = cvtools.read_key_value(cls_map) self.coco_dataset = { "info": { "description": "This is unstable 0.0.0 version of the 2019 Projects Data.", "url": "http://www.arcsoft.com", "version": "1.0", "year": 2019, "contributor": "arcsoft", "date_created": cvtools.get_now_time_str() }, "categories": [], # Not added yet "images": [], "annotations": [] } self.imageID = 1 self.annID = 1 self.run_timer = cvtools.Timer()
def __init__(self, label_root, image_root, classes=get_classes('dota'), path_replace=None, box_form='x1y1wh'): self.label_root = label_root self.image_root = image_root self.path_replace = path_replace self.box_form = box_form self.files = [] self.files += cvtools.get_files_list(label_root, basename=True) if cvtools._DEBUG: self.files = self.files[:10] self.lines = [] if isinstance(classes, str): self.cls_map = cvtools.read_key_value(classes) else: self.cls_map = {name: i + 1 for i, name in enumerate(classes)} self.coco_dataset = { "info": { "description": "This is stable 1.0 version of the DOTA.", "url": "http://captain.whu.edu.cn/DOTAweb/index.html", "version": "1.0", "year": 2018, "contributor": "DOTA", "date_created": cvtools.get_time_str() }, "categories": [], "images": [], "annotations": [] } self.imageID = 1 self.annID = 1 self.run_timer = cvtools.Timer()
def __init__( self, label_root, image_root, cls_map='/home/liuchang/cvtools/cvtools/label_convert/dota/dota_v1.5_cat_id_map.txt', path_replace=None, box_form='x1y1wh'): self.label_root = label_root self.image_root = image_root self.path_replace = path_replace self.box_form = box_form self.files = [] self.files += cvtools.get_files_list(label_root, basename=True) # if cvtools._DEBUG: # self.files = self.files[:10] self.lines = [] self.cls_map = cvtools.read_key_value(cls_map) self.coco_dataset = { "info": { "description": "This is stable 1.0 version of the DOTA.", "url": "http://captain.whu.edu.cn/DOTAweb/index.html", "version": "1.0", "year": 2018, "contributor": "DOTA", "date_created": cvtools.get_now_time_str() }, "categories": [], "images": [], "annotations": [] } self.imageID = 1 self.annID = 1 self.run_timer = cvtools.Timer()
def __init__(self, cache_path, capacity=1000): self.cache_path = cache_path self._cache = OrderedDict() self._capacity = int(capacity) if capacity <= 0: raise ValueError('capacity must be a positive integer') for file in get_files_list(cache_path, file_type='.pkl'): self.set(file)
def __call__(self, imgs_or_path, det_thrs=0.5, vis=False, vis_thr=0.5, save_root=''): if isinstance(imgs_or_path, str): self.imgs += cvtools.get_files_list(imgs_or_path) else: self.imgs += imgs_or_path prog_bar = mmcv.ProgressBar(len(self.imgs)) for _, img in enumerate(self.imgs): self.detect(img, det_thrs=det_thrs, vis=vis, vis_thr=vis_thr, save_root=save_root) prog_bar.update()
def __init__(self, ): """ 首先要加载原始数据,经过初步处理后,分发到各个类中提取特征 """ self.channel_map = { 'CH1': 'PPG', 'CH3': 'SKT', 'CH10': 'ECG', 'CH13': 'EDA' } self.dataset = [] self._cache = Cache(cfg.CACHE.DATASET) print('Loading Dataset...') if cfg.PROCESSOR.USE_CLEAR: self.dataset = cvtools.load( osp.join(cfg.DATA_SRC, 'data_info.json')) else: file_list = cvtools.get_files_list( cfg.DATA_SRC, file_type='.txt') for file in tqdm(file_list): file_info = self.parsing_ann( osp.join(cfg.ANN_SRC, osp.basename(file))) self.split_channels(file, file_info) self.dataset.append(file_info)