dongzhang89 / CONTA

Implementation for paper: Causal Intervention for Weakly-Supervised Semantic Segmentation
MIT License
185 stars 27 forks source link

How to use the "m_t.py" #22

Open cz-xjtu opened 3 years ago

cz-xjtu commented 3 years ago

Thanks for your excellent work. I met some troubles when I try to write scripts to use the "m_t.py", which is the implementation of the Eq.(3) in your article.

(1) What data structure should the cfg.DIC_FILE (the confounder set C) and the cfg.PRIOR_PROB (the P(c)) be ? As what I understand, the cfg.DIC_FILE is a .npy file which contains a hxwx21 numpy array, and the value of each channel (hxw) is in the range of 0~1. And the cfg.PRIOR_PROB is a .npy file which contains a 1x1x21 numpy array, and every element is set to 1/n. Could you please tell me if I understand this correctly?

(2) What the parameter "proposals" represent in the "m_t.py" and how to obtain it ?

(3) The return of "m_t.py" is a causal_logits_list, which seems to be used for calculate loss, so where should this CausalPredictor be added and what loss should be used (add a new loss or use the original multilabel_soft_margin_loss) for the next round classification?

Thanks!

lya19971103 commented 1 year ago

非常棒的工作,但我也遇到了一样的困惑,我不是很理解M_t.py和整个代码的关联。正如上述,我想请教一下M_t.py中的 cfg.DIC_FILE和cfg.PRIOR_PROB是的生成代码在哪里?以及计算损失的代码?我是这个方向的小白,这篇论文看了挺久,十分困惑,非常期待您的回复。