fix: ValueError: With n_samples=0, test_size=None and train_size=0.8, the resulting train set will be empty. Adjust any of the aforementioned parameters.
Browse files- utils/cocosplit.py +5 -5
utils/cocosplit.py
CHANGED
@@ -43,15 +43,15 @@ def main(annotation_path,
|
|
43 |
tr_ann, ts_ann = train_test_split(img_ann, train_size=split_ratio,
|
44 |
random_state=random_state)
|
45 |
|
46 |
-
# Images without annotations
|
47 |
-
img_wo_ann = funcy.lremove(lambda i: i['id'] in ids_with_annotations, images)
|
48 |
-
tr_wo_ann, ts_wo_ann = train_test_split(img_wo_ann, train_size=split_ratio,
|
49 |
-
random_state=random_state)
|
50 |
-
|
51 |
if having_annotations:
|
52 |
tr, ts = tr_ann, ts_ann
|
53 |
|
54 |
else:
|
|
|
|
|
|
|
|
|
|
|
55 |
# Merging the 2 image lists (i.e. with and without annotation)
|
56 |
tr_ann.extend(tr_wo_ann)
|
57 |
ts_ann.extend(ts_wo_ann)
|
|
|
43 |
tr_ann, ts_ann = train_test_split(img_ann, train_size=split_ratio,
|
44 |
random_state=random_state)
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
if having_annotations:
|
47 |
tr, ts = tr_ann, ts_ann
|
48 |
|
49 |
else:
|
50 |
+
# Images without annotations
|
51 |
+
img_wo_ann = funcy.lremove(lambda i: i['id'] in ids_with_annotations, images)
|
52 |
+
tr_wo_ann, ts_wo_ann = train_test_split(img_wo_ann, train_size=split_ratio,
|
53 |
+
random_state=random_state)
|
54 |
+
|
55 |
# Merging the 2 image lists (i.e. with and without annotation)
|
56 |
tr_ann.extend(tr_wo_ann)
|
57 |
ts_ann.extend(ts_wo_ann)
|