Spaces:
Sleeping
Sleeping
Commit
·
1749fc6
1
Parent(s):
81c4d52
updates
Browse files
app.py
CHANGED
|
@@ -27,23 +27,22 @@ try:
|
|
| 27 |
print("Dataset features:", dataset.features) # Check if 'split' is part of features
|
| 28 |
|
| 29 |
|
| 30 |
-
# Check if the 'split' column exists; if not, add it
|
| 31 |
-
if 'split' not in dataset.column_names:
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
print("'split' column already exists.")
|
| 47 |
|
| 48 |
# Create a dictionary to keep track of the highest annotation count for each image
|
| 49 |
annotation_counts = {}
|
|
|
|
| 27 |
print("Dataset features:", dataset.features) # Check if 'split' is part of features
|
| 28 |
|
| 29 |
|
| 30 |
+
# # Check if the 'split' column exists; if not, add it
|
| 31 |
+
# if 'split' not in dataset.column_names:
|
| 32 |
+
split_values = []
|
| 33 |
+
for example in dataset:
|
| 34 |
+
match = re.search(r'_(\d+)\.', example["image_id"])
|
| 35 |
+
image_id = match.group(1).lstrip('0')
|
| 36 |
+
if image_id in results:
|
| 37 |
+
split_values.append("dev")
|
| 38 |
+
else:
|
| 39 |
+
split_values.append("train")
|
| 40 |
+
|
| 41 |
+
dataset = dataset.replace_column("split", split_values)
|
| 42 |
+
# print("Added 'split' column to dataset.")
|
| 43 |
+
|
| 44 |
+
# else:
|
| 45 |
+
# print("'split' column already exists.")
|
|
|
|
| 46 |
|
| 47 |
# Create a dictionary to keep track of the highest annotation count for each image
|
| 48 |
annotation_counts = {}
|