google-research / composed_image_retrieval

Apache License 2.0
175 stars 18 forks source link

Bug in CIRR experiment !!! #6

Closed Pter61 closed 1 year ago

Pter61 commented 1 year ago

Thank you for your open source of interesting work! While I evaluated in CIRR experiment, there is a bug occurred:

 Traceback (most recent call last):
  File "src/eval_retrieval.py", line 370, in <module>
    main()
  File "src/eval_retrieval.py", line 362, in main
    main_worker(args.gpu, None, log_queue, args)
  File "src/eval_retrieval.py", line 212, in main_worker
    target_dataloader)
  File "/composed_image_retrieval/src/eval_utils.py", line 363, in evaluate_cirr
    metrics = metric_func(ref_features=value)
  File "/composed_image_retrieval/src/eval_utils.py", line 569, in get_metrics_cirr
    sorted_index_names.shape[1] - 1)

Could you tell me how to fix it? Thank you! @ksaito-ut @kihyuks

Barbany commented 1 year ago

The issue is closed but it is not solved. I put my solution in case someone else encounters this issue. @Pter61 you did not provide a solution but I guess you did a change like that (as the filter by reference_mask could decrease the first dimension):

image
jeff3071 commented 1 year ago

I encountered the same issue where I discovered that the problem lies with the img_path in CIRR. Unlike the ref_imgs and target_imgs paths, the img_path utilize os.join(). This renders the line reference_mask = torch.tensor(sorted_index_names != np.repeat(np.array(reference_names), len(index_names)).reshape(len(target_names), -1)) ineffective. Therefore, I modify the return value to tar_path.

Pter61 commented 1 year ago

The issue is closed but it is not solved. I put my solution in case someone else encounters this issue. @Pter61 you did not provide a solution but I guess you did a change like that (as the filter by reference_mask could decrease the first dimension): image

Sorry because it's been a long time, I don't remember my solution clearly, but I remember my solution is similar to @jeff3071.

Natsushiro commented 1 year ago

I encountered the same issue where I discovered that the problem lies with the img_path in CIRR. Unlike the ref_imgs and target_imgs paths, the img_path utilize os.join(). This renders the line reference_mask = torch.tensor(sorted_index_names != np.repeat(np.array(reference_names), len(index_names)).reshape(len(target_names), -1)) ineffective. Therefore, I modify the return value to tar_path.

I address this issue with this answer. More specifically, modify the return target_images, img_path to return target_images, tar_path in data.py, line 140, in return_valdata. Hope to help.