Skip to content

Commit 6ca950f

Browse files
committed
Better handling of guessed paths
1 parent c62198e commit 6ca950f

File tree

1 file changed

+11
-1
lines changed
  • dagshub_annotation_converter/converters

1 file changed

+11
-1
lines changed

dagshub_annotation_converter/converters/yolo.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,19 @@ def export_to_fs(
193193
with open(annotation_filename, "w") as f:
194194
f.write(annotation_content)
195195

196-
context.train_path, context.val_path, context.test_path = _guess_train_val_test_split(
196+
guessed_train_path, guessed_val_path, guessed_test_path = _guess_train_val_test_split(
197197
list(grouped_annotations.keys())
198198
)
199+
200+
# Don't accidentally override with Nones. If we find Nones, then assume YOLO should train on the whole dataset
201+
if guessed_train_path is not None:
202+
context.train_path = guessed_train_path
203+
204+
if guessed_val_path is not None:
205+
context.val_path = guessed_val_path
206+
207+
context.test_path = guessed_test_path
208+
199209
yaml_file_path = export_path / meta_file
200210
with open(yaml_file_path, "w") as yaml_f:
201211
yaml_f.write(context.get_yaml_content())

0 commit comments

Comments
 (0)