ContrastiveSeg icon indicating copy to clipboard operation
ContrastiveSeg copied to clipboard

Memory and semi-hard example mining code

Open TheoPis opened this issue 2 years ago • 6 comments

Hi, well done on the nice work. I have the following questions regarding the codebase:

  1. I believe there is an issue in the pixel memory code. (or perhaps that's intended but not mentioned in the paper ?) In the case where available samples (K) exceed the memory size for a given class, the code replaces the newest rather than the oldest features in the queue (which is for example how moco handles the memory bank). Specifically in enqueue_dequeue in trainer_contrastive.py:

if ptr + K >= self.memory_size: pixel_queue[lb, -K:, :] = nn.functional.normalize(feat,p=2, dim=1) pixel_queue_ptr[lb] = 0

  1. In section 3.3 of the paper it is mentioned that the version of the method that is giving improvemnts on multiple datasets, entails semi-hard negative example mining and as a sampling procedure from the memory bank. I could not find the exact implementation of this version in the repository.

The only thing I found related to getting negatives from the memory is in loss_contrast_mem.py, method _sample_negative(self, Q) which to the best of my understanding just takes all memory samples per class.

Please correct me if I am missing something here. If not, are you planning to either add these methods or make trained model weights available?

  1. Finally, It would be helpful to know whether all the miou results in the paper (including the appendix and results that concern ablation on the Cityscapes validation set ) are using multi-scale + flip test time augmentation.

It would be very helpful if you could address these questions. Thanks

TheoPis avatar Nov 05 '21 17:11 TheoPis

Hi again, I have noticed the authors are frequently responding to other issues, thus I would appreciate if these questions could also be adressed. Many thanks

TheoPis avatar Mar 21 '22 17:03 TheoPis

@TheoPis have you managed to find the implementation of semi-hard sampling?

nysp78 avatar Oct 11 '22 07:10 nysp78

@nysp78 to the best of my understanding, no hardness-aware sampling method is in this repo.

TheoPis avatar Oct 11 '22 11:10 TheoPis

@TheoPis do you have any ideas on where I can find a similar implementation for hardness aware sampling?

nysp78 avatar Oct 22 '22 18:10 nysp78