🎨 [Update] the dataset check, only check using set
Browse files
yolo/tools/data_loader.py
CHANGED
@@ -23,7 +23,6 @@ from yolo.tools.data_augmentation import (
|
|
23 |
VerticalFlip,
|
24 |
)
|
25 |
from yolo.tools.dataset_preparation import prepare_dataset
|
26 |
-
from yolo.tools.drawer import draw_bboxes
|
27 |
from yolo.utils.dataset_utils import (
|
28 |
create_image_metadata,
|
29 |
locate_label_paths,
|
@@ -204,7 +203,7 @@ def create_dataloader(data_cfg: DataConfig, dataset_cfg: DatasetConfig, task: st
|
|
204 |
return StreamDataLoader(data_cfg)
|
205 |
|
206 |
if dataset_cfg.auto_download:
|
207 |
-
prepare_dataset(dataset_cfg)
|
208 |
|
209 |
return YoloDataLoader(data_cfg, dataset_cfg, task)
|
210 |
|
|
|
23 |
VerticalFlip,
|
24 |
)
|
25 |
from yolo.tools.dataset_preparation import prepare_dataset
|
|
|
26 |
from yolo.utils.dataset_utils import (
|
27 |
create_image_metadata,
|
28 |
locate_label_paths,
|
|
|
203 |
return StreamDataLoader(data_cfg)
|
204 |
|
205 |
if dataset_cfg.auto_download:
|
206 |
+
prepare_dataset(dataset_cfg, task)
|
207 |
|
208 |
return YoloDataLoader(data_cfg, dataset_cfg, task)
|
209 |
|
yolo/tools/dataset_preparation.py
CHANGED
@@ -52,7 +52,7 @@ def check_files(directory, expected_count=None):
|
|
52 |
return len(files) == expected_count if expected_count is not None else bool(files)
|
53 |
|
54 |
|
55 |
-
def prepare_dataset(dataset_cfg: DatasetConfig):
|
56 |
"""
|
57 |
Prepares dataset by downloading and unzipping if necessary.
|
58 |
"""
|
@@ -60,8 +60,8 @@ def prepare_dataset(dataset_cfg: DatasetConfig):
|
|
60 |
for data_type, settings in dataset_cfg.auto_download.items():
|
61 |
base_url = settings["base_url"]
|
62 |
for dataset_type, dataset_args in settings.items():
|
63 |
-
if dataset_type
|
64 |
-
continue
|
65 |
file_name = f"{dataset_args.get('file_name', dataset_type)}.zip"
|
66 |
url = f"{base_url}{file_name}"
|
67 |
local_zip_path = os.path.join(data_dir, file_name)
|
|
|
52 |
return len(files) == expected_count if expected_count is not None else bool(files)
|
53 |
|
54 |
|
55 |
+
def prepare_dataset(dataset_cfg: DatasetConfig, task: str):
|
56 |
"""
|
57 |
Prepares dataset by downloading and unzipping if necessary.
|
58 |
"""
|
|
|
60 |
for data_type, settings in dataset_cfg.auto_download.items():
|
61 |
base_url = settings["base_url"]
|
62 |
for dataset_type, dataset_args in settings.items():
|
63 |
+
if dataset_type != "annotations" and dataset_cfg.get(task, task) != dataset_type:
|
64 |
+
continue
|
65 |
file_name = f"{dataset_args.get('file_name', dataset_type)}.zip"
|
66 |
url = f"{base_url}{file_name}"
|
67 |
local_zip_path = os.path.join(data_dir, file_name)
|