12345678910111213141516171819202122232425 |
- def archive(cls, automan_info, archive_info):
- print(archive_info)
- annotations_dir = os.path.join(TEMP_DIR, 'Annotations')
- images_dir = os.path.join(TEMP_DIR, 'Images')
- image_annotations_dir = os.path.join(TEMP_DIR, 'Images_Annotations')
- # whether or not to write image in bag file to image files
- is_including_image = archive_info.get('include_image', False)
- max_frame = cls.__get_frame_range(
- automan_info, archive_info['project_id'], archive_info['annotation_id'])
- colors = cls.__get_annotation_color(automan_info, archive_info['project_id'])
- candidates = cls.__get_candidates(
- automan_info, archive_info['project_id'], archive_info['original_id'])
- for i in range(max_frame):
- annotation = cls.__get_annotation(
- automan_info, archive_info['project_id'], archive_info['annotation_id'], i + 1, annotations_dir)
- if is_including_image:
- for candidate in candidates:
- file_name = cls.__get_annotation_image(
- automan_info, archive_info['project_id'],
- archive_info['dataset_id'], candidate['id'], i + 1, candidate['ext'], images_dir)
- if file_name is not None:
- cls.__draw_annotation(file_name, annotation, colors, images_dir, image_annotations_dir)
|