ianhajra commited on
Commit
caf7bfa
·
verified ·
1 Parent(s): bbf67b6

Update INRIA-CopyDays.py

Browse files
Files changed (1) hide show
  1. INRIA-CopyDays.py +29 -24
INRIA-CopyDays.py CHANGED
@@ -178,27 +178,32 @@ class Copydays(datasets.GeneratorBasedBuilder):
178
  continue
179
 
180
  block_id = int(base_name[:4])
181
-
182
- actual_split_type = (
183
- "original" if split_type == "queries" else "strong"
184
- )
185
-
186
- if split_type == "queries":
187
- if base_name[4:6] == "00":
188
- query_id = -1
189
- else:
190
- continue
191
- else:
192
- if base_name[4:6] != "00":
193
- query_id = int(base_name[4:6])
194
- else:
195
- continue
196
-
197
- yield idx, {
198
- "image": file_path,
199
- "filename": filename,
200
- "split_type": actual_split_type,
201
- "block_id": block_id,
202
- "query_id": query_id,
203
- }
204
- idx += 1
 
 
 
 
 
 
178
  continue
179
 
180
  block_id = int(base_name[:4])
181
+ query_id_str = base_name[4:6]
182
+
183
+ if query_id_str != "00": # Case 1: Strong image
184
+ if split_type == "queries":
185
+ query_id = int(query_id_str)
186
+ actual_split_type = "strong"
187
+ yield idx, {
188
+ "image": file_path,
189
+ "filename": filename,
190
+ "split_type": actual_split_type,
191
+ "block_id": block_id,
192
+ "query_id": query_id,
193
+ }
194
+ idx += 1
195
+ else: # Case 2: Original image
196
+ actual_split_type = "original"
197
+ if split_type == "queries":
198
+ query_id = 0 # Query ID for queries split
199
+ else: # split_type == "database"
200
+ query_id = -1 # Query ID for database split
201
+
202
+ yield idx, {
203
+ "image": file_path,
204
+ "filename": filename,
205
+ "split_type": actual_split_type,
206
+ "block_id": block_id,
207
+ "query_id": query_id,
208
+ }
209
+ idx += 1