diff --git a/build_doc.sh b/build_doc.sh old mode 100644 new mode 100755 diff --git a/deepdataspace/model/image.py b/deepdataspace/model/image.py index d742636..24e5466 100644 --- a/deepdataspace/model/image.py +++ b/deepdataspace/model/image.py @@ -326,6 +326,7 @@ def _add_annotation(self, keypoint_colors: List[int] = None, keypoint_skeleton: List[int] = None, keypoint_names: List[str] = None, + caption: str = None, confirm_type: int = 0, ): if bbox: @@ -341,7 +342,7 @@ def _add_annotation(self, keypoint_skeleton, keypoint_names) anno_obj = Object(label_name=label, label_type=label_type, label_id=label_obj.id, - category_name=category, category_id=category_obj.id, + category_name=category, category_id=category_obj.id, caption=caption, bounding_box=bounding_box, segmentation=segmentation, alpha=alpha_uri, points=points, lines=lines, point_colors=colors, point_names=names, conf=conf, is_group=is_group, confirm_type=confirm_type) @@ -361,6 +362,7 @@ def add_annotation(self, keypoint_colors: List[int] = None, keypoint_skeleton: List[int] = None, keypoint_names: List[str] = None, + caption: str = None, confirm_type: int = 0, ): """ @@ -380,13 +382,14 @@ def add_annotation(self, :param keypoint_names: the key point names, ["nose", "left_eye", ...]. :param keypoint_colors: the key point colors, [255, 0, 0, ...]. :param keypoint_skeleton: the key point skeleton, [0, 1, 2, ...]. + :param caption: the caption of the annotation. :param confirm_type: the confirm_type of the annotation, 0 = not confirmed, 1 = gt may be fn, 2 = pred may be fp """ self._add_annotation(category, label, label_type, conf, is_group, bbox, segmentation, alpha_uri, keypoints, keypoint_colors, keypoint_skeleton, keypoint_names, - confirm_type) + caption, confirm_type) self.save() self._update_dataset(bbox, segmentation, alpha_uri, keypoints) @@ -434,6 +437,7 @@ def batch_add_annotation(self, :param keypoint_names: the key point names, ["nose", "left_eye", ...]. :param keypoint_colors: the key point colors, [255, 0, 0, ...]. :param keypoint_skeleton: the key point skeleton, [0, 1, 2, ...]. + :param caption: the caption of the annotation. :param confirm_type: the confirm_type of the annotation, 0 = not confirmed, 1 = gt may be fn, 2 = pred may be fp :return: None """ diff --git a/deepdataspace/plugins/coco2017/importer.py b/deepdataspace/plugins/coco2017/importer.py index c300d57..f50393e 100644 --- a/deepdataspace/plugins/coco2017/importer.py +++ b/deepdataspace/plugins/coco2017/importer.py @@ -8,6 +8,7 @@ from typing import Dict from typing import List from typing import Tuple +import traceback from deepdataspace.constants import DatasetFileType from deepdataspace.constants import DatasetType @@ -94,8 +95,11 @@ def parse_meta(meta_path: str): try: info = COCO2017Importer._parse_meta(meta_path) except Exception as err: + logger.error(traceback.format_exc()) logger.error(f"Failed to parse meta file {meta_path}: {err}") return None + + logger.info(f"Successfully parsed meta file {meta_path}: {info}") return info def load_ground_truth(self): @@ -118,7 +122,7 @@ def load_ground_truth(self): def load_predictions(self): for file_tag, file_path in self.dataset.files.items(): - if not file_tag.startswith("PRED/"): + if not file_tag.startswith(f"{DatasetFileType.Prediction}/"): continue pred_name = file_tag.split("/", 1)[-1] diff --git a/deepdataspace/services/dds.py b/deepdataspace/services/dds.py index e968f11..2390e24 100644 --- a/deepdataspace/services/dds.py +++ b/deepdataspace/services/dds.py @@ -79,7 +79,7 @@ def __init__(self, home_dir = os.path.expanduser("~") runtime_dir = os.path.join(home_dir, ".deepdataspace") - self.runtime_dir = self.argument_or_config("runtime_dir", runtime_dir, None) + self.runtime_dir = self.argument_or_config("runtime_dir", None, runtime_dir) self.configfile = configfile self.from_cmdline = from_cmdline @@ -97,11 +97,11 @@ def __init__(self, self.dl_prefix = "https://deepdataspace.oss-accelerate.aliyuncs.com/install_files" self.distro = PLATFORM if PLATFORM != Platforms.Linux else f"ubuntu{get_ubuntu_version()}" - def argument_or_config(self, key, value, default): - if value is not None: - return value + def argument_or_config(self, config_key, arg_value, default): + if arg_value is not None: + return arg_value else: - return self.config_data.get(key, default) + return self.config_data.get(config_key, default) def exit_or_raise(self, msg: str): if self.from_cmdline is True: