Update Chicks4FreeID.py
Browse files- Chicks4FreeID.py +7 -4
Chicks4FreeID.py
CHANGED
|
@@ -360,10 +360,13 @@ class ChicksDataset(GeneratorBasedBuilder):
|
|
| 360 |
# all identity targets (labels)
|
| 361 |
identities = [name_to_dict(crop.stem)[ID] for crop in all_crops]
|
| 362 |
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
|
|
|
|
|
|
|
|
|
| 367 |
|
| 368 |
return [
|
| 369 |
SplitGenerator(
|
|
|
|
| 360 |
# all identity targets (labels)
|
| 361 |
identities = [name_to_dict(crop.stem)[ID] for crop in all_crops]
|
| 362 |
|
| 363 |
+
if VERSION == "v1_240507_SMALL":
|
| 364 |
+
train_crops, test_crops = all_crops, all_crops
|
| 365 |
+
else:
|
| 366 |
+
# Splitting the dataset into train and test using stratified train_test_split
|
| 367 |
+
train_crops, test_crops, _, _ = train_test_split(
|
| 368 |
+
all_crops, identities, test_size=0.2, stratify=identities, shuffle=True, random_state=42
|
| 369 |
+
)
|
| 370 |
|
| 371 |
return [
|
| 372 |
SplitGenerator(
|