Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
 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()
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
def test_timer_content(capsys):
    timer = cvtools.Timer()
    timer.tic()
    time.sleep(1)
    print('{:.3f}'.format(timer.toc()))
    out, _ = capsys.readouterr()
    assert abs(float(out) - 1) < 1e-2
Ejemplo n.º 5
0
def test_timer_content(capsys):
    timer = cvtools.Timer()
    timer.tic()
    time.sleep(1)
    # 好像误差有点大
    print('{:.3f}'.format(timer.toc()))
    # out, _ = capsys.readouterr()
    assert abs(timer.toc() - 1) < 0.1