YanmHa commited on
Commit
fce8667
·
verified ·
1 Parent(s): a4a89bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -12
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
- pool = []
 
 
239
  for m_root_path in METHOD_ROOTS:
240
  method_name = os.path.basename(m_root_path)
241
-
242
- subjects_for_method = SUBJECTS # 默认使用所有 subjects
243
- if method_name.lower() == "takagi": # 对 "takagi" 方法的特殊处理 (大小写不敏感)
 
244
  if "subj01" in SUBJECTS:
245
  subjects_for_method = ["subj01"]
246
- # print(f"调试:方法 'takagi' 将仅使用 'subj01'")
247
  else:
248
- # print(f"调试:方法 'takagi' 希望使用 'subj01',但其不在全局 SUBJECTS 列表中。此方法此次不产生候选图。")
249
- continue # 如果 subj01 不可用,则跳过 takagi 方法的此次循环
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
- pool.append((internal_label, candidate_path))
 
 
 
 
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, c2 in combinations(pool, 2):
293
- pair_labels_fset = frozenset({c1[0], c2[0]})
294
- all_possible_pairs_in_pool.append( ((c1, c2), pair_labels_fset) )
 
 
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