Skip to content

Commit

Permalink
fixing imagenet import
Browse files Browse the repository at this point in the history
  • Loading branch information
Eldies committed Mar 4, 2025
1 parent fdab777 commit f682bee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cvat/apps/dataset_manager/formats/imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from glob import glob

from datumaro.components.dataset import Dataset
from datumaro.plugins.transforms import Rename

from cvat.apps.dataset_manager.bindings import GetCVATDataExtractor, import_dm_annotations
from cvat.apps.dataset_manager.util import make_zip_archive
Expand Down Expand Up @@ -38,6 +39,10 @@ def _import(src_file, temp_dir, instance_data, load_data_callback=None, **kwargs
dataset = Dataset.import_from(temp_dir, "imagenet_txt", env=dm_env)
else:
dataset = Dataset.import_from(temp_dir, "imagenet", env=dm_env)
# Due to changed naming on import in imagenet in datumaro
# need to rename items from "label:name" to "label/name"
# to keep item matching working
dataset = dataset.transform(Rename, regex="|([^:]+):(.*)|\\1/\\2|")
if load_data_callback is not None:
load_data_callback(dataset, instance_data)
import_dm_annotations(dataset, instance_data)

0 comments on commit f682bee

Please sign in to comment.