-
Notifications
You must be signed in to change notification settings - Fork 6.6k
CreateML fixes #906
CreateML fixes #906
Conversation
saitejamalyala
commented
Jul 1, 2022
- write verified field to the json file while saving the annotation in createMl format
- open annotation in json format
add verified field to createML json
…g_dir change save directory update
labelImg.py
Outdated
| # Save as Pascal voc xml | ||
| self.default_save_dir = default_save_dir | ||
| self.label_file_format = settings.get(SETTING_LABEL_FILE_FORMAT, LabelFileFormat.PASCAL_VOC) | ||
| self.label_file_format = settings.get(SETTING_LABEL_FILE_FORMAT, LabelFileFormat.CREATE_ML) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could keep PASCAL_VOC as default, as we should keep the behavior as the same as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, For sure
labelImg.py
Outdated
| self.load_pascal_xml_by_filename(xml_path) | ||
| elif os.path.isfile(txt_path): | ||
| self.load_yolo_txt_by_filename(txt_path) | ||
| elif os.path.isfile(txt_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif os.path.isfile(txt_path):
self.load_yolo_txt_by_filename(txt_path)
elif os.path.isfile(txt_path):
self.load_create_ml_json_by_filename(json_path, file_path)
The second elif will never happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed this, Last elif should be
elif os.path.isfile(json_path): self.load_create_ml_json_by_filename(json_path, file_path)
| if dir_path is not None and len(dir_path) > 1: | ||
| self.default_save_dir = dir_path | ||
|
|
||
| self.show_bounding_box_from_annotation_file(self.file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there are existing annotations in the new directory, it shows the bbox annotations for the current file ?
libs/create_ml_io.py
Outdated
|
|
||
| output_image_dict = { | ||
| "image": self.filename, | ||
| "verified": True if self.verified else False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks verbose.
"verified": True if self.verified else False,
can be simplified to "verified": self.verified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ofc, fixed now
libs/create_ml_io.py
Outdated
| output_dict = json.loads(input_data) | ||
| self.verified = True | ||
|
|
||
| self.verified = output_dict[0].get("verified", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more question. What is output_dict? is it always expected to have a value in the list? should it have a empty check before assigning to self.verified like
output_dict[0].get("verified", False) if len(output_dict) else False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's done now. Also changed the name to output_list, as output_dict is misleading.
tzutalin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more comment about output_dict
tzutalin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks