Update app.py
Browse files
app.py
CHANGED
|
@@ -235,26 +235,31 @@ def get_next_trial_info(current_trial_idx_in_run, current_run_image_list_for_tri
|
|
| 235 |
target_full_path = os.path.join(TARGET_DIR, img_filename_original)
|
| 236 |
trial_number_for_display = current_trial_idx_in_run + 1
|
| 237 |
|
| 238 |
-
|
|
|
|
|
|
|
| 239 |
for m_root_path in METHOD_ROOTS:
|
| 240 |
method_name = os.path.basename(m_root_path)
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
|
|
|
| 244 |
if "subj01" in SUBJECTS:
|
| 245 |
subjects_for_method = ["subj01"]
|
| 246 |
-
# print(f"调试:方法 'takagi' 将仅使用 'subj01'")
|
| 247 |
else:
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
for s_id in subjects_for_method:
|
| 252 |
base, ext = os.path.splitext(img_filename_original)
|
| 253 |
reconstructed_filename = f"{base}_0{ext}"
|
| 254 |
candidate_path = os.path.join(m_root_path, s_id, reconstructed_filename)
|
| 255 |
if os.path.exists(candidate_path):
|
| 256 |
internal_label = f"{method_name}/{s_id}/{reconstructed_filename}"
|
| 257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
trial_info = {"image_id": img_filename_original, "target_path": target_full_path, "cur_no": trial_number_for_display, "is_sentinel": False,
|
| 260 |
"left_display_label": "N/A", "left_internal_label": "N/A", "left_path": None,
|
|
@@ -289,9 +294,11 @@ def get_next_trial_info(current_trial_idx_in_run, current_run_image_list_for_tri
|
|
| 289 |
|
| 290 |
target_global_history_set = global_shown_pairs_cache.setdefault(img_filename_original, set())
|
| 291 |
all_possible_pairs_in_pool = []
|
| 292 |
-
for c1
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
| 295 |
|
| 296 |
unseen_globally_pairs_with_data = [
|
| 297 |
item for item in all_possible_pairs_in_pool if item[1] not in target_global_history_set
|
|
|
|
| 235 |
target_full_path = os.path.join(TARGET_DIR, img_filename_original)
|
| 236 |
trial_number_for_display = current_trial_idx_in_run + 1
|
| 237 |
|
| 238 |
+
generated_pool = []
|
| 239 |
+
other_pool = []
|
| 240 |
+
|
| 241 |
for m_root_path in METHOD_ROOTS:
|
| 242 |
method_name = os.path.basename(m_root_path)
|
| 243 |
+
is_generated_color = method_name == "generated_images_color"
|
| 244 |
+
|
| 245 |
+
subjects_for_method = SUBJECTS
|
| 246 |
+
if method_name.lower() == "takagi":
|
| 247 |
if "subj01" in SUBJECTS:
|
| 248 |
subjects_for_method = ["subj01"]
|
|
|
|
| 249 |
else:
|
| 250 |
+
continue
|
| 251 |
+
|
|
|
|
| 252 |
for s_id in subjects_for_method:
|
| 253 |
base, ext = os.path.splitext(img_filename_original)
|
| 254 |
reconstructed_filename = f"{base}_0{ext}"
|
| 255 |
candidate_path = os.path.join(m_root_path, s_id, reconstructed_filename)
|
| 256 |
if os.path.exists(candidate_path):
|
| 257 |
internal_label = f"{method_name}/{s_id}/{reconstructed_filename}"
|
| 258 |
+
if is_generated_color:
|
| 259 |
+
generated_pool.append((internal_label, candidate_path))
|
| 260 |
+
else:
|
| 261 |
+
other_pool.append((internal_label, candidate_path))
|
| 262 |
+
|
| 263 |
|
| 264 |
trial_info = {"image_id": img_filename_original, "target_path": target_full_path, "cur_no": trial_number_for_display, "is_sentinel": False,
|
| 265 |
"left_display_label": "N/A", "left_internal_label": "N/A", "left_path": None,
|
|
|
|
| 294 |
|
| 295 |
target_global_history_set = global_shown_pairs_cache.setdefault(img_filename_original, set())
|
| 296 |
all_possible_pairs_in_pool = []
|
| 297 |
+
for c1 in generated_pool:
|
| 298 |
+
for c2 in other_pool:
|
| 299 |
+
pair_labels_fset = frozenset({c1[0], c2[0]})
|
| 300 |
+
all_possible_pairs_in_pool.append(((c1, c2), pair_labels_fset))
|
| 301 |
+
|
| 302 |
|
| 303 |
unseen_globally_pairs_with_data = [
|
| 304 |
item for item in all_possible_pairs_in_pool if item[1] not in target_global_history_set
|