Commit 907de5f7 authored by Bo (YANG, Bo) Yang's avatar Bo (YANG, Bo) Yang Committed by Facebook GitHub Bot
Browse files

Only assign mask file (*.png) in annotation to `sem_seg_*` and still keep other annotations

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/316

As title.

Reviewed By: wenliangzhao2018

Differential Revision: D37259150

fbshipit-source-id: 6b69d4bcc8706bf50dbbe3655b306d1d9cbfbdca
parent e9dd53e1
...@@ -262,7 +262,10 @@ def print_conversion_report(ann_error_report, image_error_report, ex_warning_fn) ...@@ -262,7 +262,10 @@ def print_conversion_report(ann_error_report, image_error_report, ex_warning_fn)
def _assign_annotations_to_record( def _assign_annotations_to_record(
record: Dict, converted_anns: List[Dict], all_cat_names: Optional[List[str]] record: Dict, converted_anns: List[Dict], all_cat_names: Optional[List[str]]
) -> None: ) -> None:
if converted_anns and all(["file_name" in ann for ann in converted_anns]): record["annotations"] = converted_anns
if converted_anns and all(
[ann.get("file_name", "").endswith(".png") for ann in converted_anns]
):
if len(converted_anns) == 1: if len(converted_anns) == 1:
record["sem_seg_file_name"] = converted_anns[0]["file_name"] record["sem_seg_file_name"] = converted_anns[0]["file_name"]
return return
...@@ -273,8 +276,6 @@ def _assign_annotations_to_record( ...@@ -273,8 +276,6 @@ def _assign_annotations_to_record(
all_cat_names[ann["category_id"]]: ann["file_name"] all_cat_names[ann["category_id"]]: ann["file_name"]
for ann in converted_anns for ann in converted_anns
} }
else:
record["annotations"] = converted_anns
def _process_associations( def _process_associations(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment