xyupeng / ContrastiveCrop

[CVPR 2022 Oral] Crafting Better Contrastive Views for Siamese Representation Learning
MIT License
284 stars 27 forks source link

some question about bbox_update #11

Closed lenka844 closed 2 years ago

lenka844 commented 2 years ago

hello, i've tried use your work on my dataset, and it made work, too.But when i try to enlarge my dataset, there is a problem occured: when the model train to 200 or 300epochs, the box update always failed, i try to figure out the reason, found that when the process going to update, the heat_map tensor is empty, i was confused how to solve this problem and does this occured by my dataset size? because when i use small dataset, this problem dosent happend.

xyupeng commented 2 years ago

What do you mean by "the heatmap is empty"? Could you provide some more details? In principle, the dataset size does not affect box update.

lenka844 commented 2 years ago

What do you mean by "the heatmap is empty"? Could you provide some more details? In principle, the dataset size does not affect box update.

well,thanks for replying, the error reminds "IndexError: index is out of bounds for dimension with size 0",and i locate where it happends, that is in the DDP_simsiam_ccrop.py line 120, ' h_min, h_max = torch.nonzero(h_filter).view(-1)[[0, -1]] / Hi # [h_min, h_max]; 0 <= h <= 1', this part code is `for hmap in eval_train_map: print('=============',hmap) hmap = hmap.squeeze(0) # (Hi, Wi)

        h_filter = (hmap.max(1)[0] > t).int()
        w_filter = (hmap.max(0)[0] > t).int()
        h_min, h_max = torch.nonzero(h_filter).view(-1)[[0, -1]] / Hi  # [h_min, h_max]; 0 <= h <= 1
         w_min, w_max = torch.nonzero(w_filter).view(-1)[[0, -1]] / Wi  # [w_min, w_max]; 0 <= w <= 1
        boxes.append(torch.tensor([h_min, w_min, h_max, w_max]))``

i think is the hmaps' problem, so i print the hmap, and found the hmap is empty, but when i use small dataset, hmap is not empty, that is confusing.

xyupeng commented 2 years ago

Does this happen upon the first update? The only possibility I can come up with is the input image is too small (ie, <32). Note that even if the box size = (0, 0) does not affect sampling and inference.

lenka844 commented 2 years ago

Does this happen upon the first update? The only possibility I can come up with is the input image is too small (ie, <32). Note that even if the box size = (0, 0) does not affect sampling and inference.

Thanks for your reply, I will check it carefully again.