zhiyuanyou / SAFECount

[WACV 2023] Few-shot Object Counting with Similarity-Aware Feature Enhancement
Other
124 stars 22 forks source link

the problem when test Cross-dataset Generalization #26

Closed zhitao654321 closed 1 year ago

zhitao654321 commented 1 year ago

Thank you for your work. I would like to understand how to use a pre-trained model to test on other datasets. The pre-trained model can produce normal results on FSC147, but when inference on other datasets that use 'exemplar.json', such as CARPK, the count results for each image are zero. Could you please advise me on how I should use the pre-trained model to test other datasets

zhiyuanyou commented 1 year ago

Hi~

请阅读README的Sec. 2。

FSC-147的setting是:每张图片都有exemplar boxes;需要泛化的下游场景是:所有图片共用储存在exemplar.json中的exemplar boxes。这两个setting不一样,我们提供的模型也是不一样的。第一个场景使用模型safecount.py;第二个场景使用模型safecount_exemplar.py。

因此,直接拿第一个场景的权重在第二个场景测试,效果会很差。

如果希望在第一个场景训练,在第二个场景测试,请参考README的Sec. 1.3 Cross-dataset Generalization (FSC147 to CARPK)。

zhitao654321 commented 1 year ago

Hi,我有些理解了,如果我想复现1.3 的指标,MAE (pretrain on FSC147) 和 RMSE (pretrain on FSC147)指标,我需要用safecount_crossdataset 训练数据集FSC147,然后用CARPK数据集做测试,是这样吧?

zhiyuanyou commented 1 year ago

对的~

safecount_crossdataset提供了一个 (1) 适合FSC147的setting训练,(2) state_dict的key与safecount_exemplar完全一致的模型。

所以,训练使用safecount_crossdataset,直接测试或者finetune都使用safecount_exemplar,参考实验FSC147_to_CARPK