Exemple #1
0
def _export(dst_file, task_data, save_images=False):
    extractor = CvatTaskDataExtractor(task_data, include_images=save_images)
    envt = dm_env.transforms
    extractor = extractor.transform(KeepTracks)  # can only export tracks
    extractor = extractor.transform(envt.get('polygons_to_masks'))
    extractor = extractor.transform(envt.get('boxes_to_masks'))
    extractor = extractor.transform(envt.get('merge_instance_segments'))
    extractor = Dataset.from_extractors(extractor)  # apply lazy transforms
    with TemporaryDirectory() as temp_dir:
        dm_env.converters.get('mots_png').convert(extractor,
                                                  save_dir=temp_dir,
                                                  save_images=save_images)

        make_zip_archive(temp_dir, dst_file)
Exemple #2
0
def _export(dst_file, task_data, save_images=False):
    extractor = CvatTaskDataExtractor(task_data, include_images=save_images)
    envt = dm_env.transforms
    extractor = extractor.transform(envt.get('polygons_to_masks'))
    extractor = extractor.transform(envt.get('boxes_to_masks'))
    extractor = extractor.transform(envt.get('merge_instance_segments'))
    extractor = Dataset.from_extractors(extractor)  # apply lazy transforms
    with TemporaryDirectory() as temp_dir:
        converter = dm_env.make_converter('voc_segmentation',
                                          apply_colormap=True,
                                          label_map=make_colormap(task_data),
                                          save_images=save_images)
        converter(extractor, save_dir=temp_dir)

        make_zip_archive(temp_dir, dst_file)
Exemple #3
0
def _export(dst_file, task_data, save_images=False):
    extractor = CvatTaskDataExtractor(task_data, include_images=save_images)
    envt = dm_env.transforms
    extractor = extractor.transform(envt.get('polygons_to_masks'))
    extractor = extractor.transform(envt.get('boxes_to_masks'))
    extractor = extractor.transform(envt.get('merge_instance_segments'))
    extractor = Dataset.from_extractors(extractor)  # apply lazy transforms
    label_map = make_colormap(task_data)
    with TemporaryDirectory() as temp_dir:
        dm_env.converters.get('camvid').convert(
            extractor,
            save_dir=temp_dir,
            save_images=save_images,
            apply_colormap=True,
            label_map={label: label_map[label][0]
                       for label in label_map})

        make_zip_archive(temp_dir, dst_file)
Exemple #4
0
def _export(dst_file, task_data, save_images=False):
    extractor = CvatTaskDataExtractor(task_data, include_images=save_images)
    envt = dm_env.transforms
    extractor = extractor.transform(envt.get('id_from_image_name'))
    extractor = Dataset.from_extractors(extractor)  # apply lazy transforms
    with TemporaryDirectory() as temp_dir:
        converter = dm_env.make_converter('label_me', save_images=save_images)
        converter(extractor, save_dir=temp_dir)

        make_zip_archive(temp_dir, dst_file)