File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
datumaro/plugins/yolo_format Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
38
(< https://github.com/openvinotoolkit/datumaro/pull/684 > ,
39
39
< https://github.com/openvinotoolkit/datumaro/pull/686 > ,
40
40
< https://github.com/openvinotoolkit/datumaro/pull/687 > )
41
- - YOLO format now supports almost any subset names, except of
42
- just ` train ` and ` valid `
41
+ - YOLO format now supports almost any subset names, except ` backup ` and ` classes `
42
+ (instead of just ` train ` and ` valid ` ). The reserved names now raise an error on exporting.
43
43
(< https://github.com/openvinotoolkit/datumaro/pull/688 > )
44
44
45
45
### Deprecated
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def apply(self):
77
77
subset_name = YoloPath .DEFAULT_SUBSET_NAME
78
78
elif subset_name in YoloPath .RESERVED_CONFIG_KEYS :
79
79
raise DatasetExportError (
80
- f"Can't export '{ subset_name } ' subset in YOLO format, this word " " is reserved."
80
+ f"Can't export '{ subset_name } ' subset in YOLO format, this word is reserved."
81
81
)
82
82
83
83
subset_dir = osp .join (save_dir , "obj_%s_data" % subset_name )
Original file line number Diff line number Diff line change 10
10
from datumaro .components .environment import Environment
11
11
from datumaro .components .errors import (
12
12
AnnotationImportError ,
13
+ DatasetExportError ,
13
14
DatasetImportError ,
14
15
InvalidAnnotationError ,
15
16
ItemImportError ,
@@ -285,6 +286,25 @@ def test_can_save_and_load_with_custom_subset_name(self):
285
286
286
287
compare_datasets (self , source_dataset , parsed_dataset )
287
288
289
+ @mark_requirement (Requirements .DATUM_565 )
290
+ def test_cant_save_with_reserved_subset_name (self ):
291
+ for subset in ["backup" , "classes" ]:
292
+
293
+ dataset = Dataset .from_iterable (
294
+ [
295
+ DatasetItem (
296
+ id = 3 ,
297
+ subset = subset ,
298
+ media = Image (data = np .ones ((8 , 8 , 3 ))),
299
+ ),
300
+ ],
301
+ categories = ["a" ],
302
+ )
303
+
304
+ with TestDir () as test_dir :
305
+ with self .assertRaisesRegex (DatasetExportError , f"Can't export '{ subset } ' subset" ):
306
+ YoloConverter .convert (dataset , test_dir )
307
+
288
308
@mark_requirement (Requirements .DATUM_609 )
289
309
def test_can_save_and_load_without_path_prefix (self ):
290
310
source_dataset = Dataset .from_iterable (
You can’t perform that action at this time.
0 commit comments