yxgeee / SpCL

[NeurIPS-2020] Self-paced Contrastive Learning with Hybrid Memory for Domain Adaptive Object Re-ID.
https://yxgeee.github.io/projects/spcl
MIT License
318 stars 67 forks source link

Question on the baseline model constructed from your code #18

Closed Terminator8758 closed 4 years ago

Terminator8758 commented 4 years ago

Hi, I constructed a clustering-based unsupervised baseline from your code, which obtains much higher performance (Market: rank1=91.1%,mAP=79.5%) than the pure unsupervised version in your paper (w/o source data, Market: rank1=88.1%, mAP=73.1%), so i got a little confused and curious, have you ever experimented with the baseline described below:

Using the same network and hyper-parameter setting, the baseline differs from your method in the following: 1) Before each epoch, the image features $f_i$ are extracted by the recent model and utilized for DBSCAN clustering (without the self-paced independence and compactness refinement); 2) A cluster-level memory bank is re-constructed with shape=(num_clusters, num_features), and initialized by the averaged image feature $f_i$ for each cluster; 3) the model is trained by removing the outliers from training;

Since such a memory-based clustering-fine-tuning baseline seems very naive, i'm confused why it performs so well. Any advice or insight would be much appreciated~

yxgeee commented 4 years ago

Wow, the results seem very inspiring if there's no bug. I haven't tried such a memory-based clustering baseline. I did not try to re-extract the features and re-init the memory for each epoch in the experiments regarding this paper. I have only tried to re-extract the features and re-init the classifier for conventional clustering-based baselines without memory.

Anyway, if all the steps are right without any potential bugs, it's quite a super-strong baseline for unsupervised re-ID. And the memory seems to help a lot!

yxgeee commented 4 years ago

Plus, I am curious about the results of such a baseline if outliers are used for training.

yxgeee commented 4 years ago

Since the oracle experiment (same training pipeline but with ground-truth identities instead) on the unsupervised Market-1501 only achieves 82.3% mAP. So one important thing that needs to be double-checked first is that you did not wrongly consider the ground-truth identities as pseudo identities for training.

Terminator8758 commented 4 years ago

Ok, i'll double-check my code. In the meantime, can you try running a baseline experiment like the one I described? Maybe when you have time?

yxgeee commented 4 years ago

Sure. I will also try it when I am free. Keep in touch if any updates.

Terminator8758 commented 4 years ago

Hi, i re-run the experiment using an altered dataset, where the first 4 digits of image names are random shuffled (e.g. '0067_c1s1_009376_01.jpg'-->'3456_c1s1_009376_01.jpg'), and the performance is the same. I'll make further check to be sure, but if the result is correct, i think it comes from two aspects:

1) Re-constructing and re-initializing memory bank as non-parametric classifiers is indeed helpful for unsupervised re-ID (why?); 2) The RandomMultiGallerySampler that you used to sample data helps balance the sampling under different cameras, which is beneficial; (i'll do an ablation on this sampling part later)

Have you got any updates and understanding on the baseline?

yxgeee commented 4 years ago

My experiment is still in the process, but I guess it will achieve similar results as you mentioned. Regarding your questions:

  1. Yes. I have also found that using memory as a non-parametric classifier and training with such a memory-based contrastive loss could perform better than a sole cross-entropy loss in fully-supervised tasks (I tested on MSMT17 and Market-1501), where I only constructed and initialized the memory once at the beginning and I am not sure whether further improvements can be achieved by re-constructing and re-initializing before each epoch. I did not try to combine with other metrics (e.g. triplet loss, circle loss, etc.), so I am not sure whether memory-based loss could still outperform cross-entropy loss when combining with other metrics. I am interested in it. I guess the gains come from the class(cluster)-wise momentum update strategy, which is expected to be slower than conventional optimization. But I am still confused about why slower updates could help so much, either in supervised or in unsupervised setups. It's quite an interesting and open question and I am looking forward to your further studies! I think it would become an inspiring empirical paper (I even got the title "In defense of the memory-based classifier for person re-identification", haha, I am just joking). I recommend to test it on more tasks and more datasets, e.g. supervised, unsupervised domain adaptation, unsupervised. And then we can know if such a super-strong baseline works under various conditions. I have no idea how to explain the effects of it theoretically now. We can think about it further.
  2. Yes. Another issue regarding this sampler (https://github.com/open-mmlab/OpenUnReID/issues/20) mentioned that it seems to perform better than the previous identity-based sampler. I did not do an ablation study on it and look forward to your results.

Plus, with this baseline, I am wondering whether training with outliers would still work.

yxgeee commented 4 years ago

I finished the training and achieved 78.3% mAP and 90.7% top-1. Got confirmed!

Terminator8758 commented 4 years ago

Great! I send you an email (lynnwang6875@gmail.com) so that we can discuss further.