hustvl / WeakTr

WeakTr: Exploring Plain Vision Transformer for Weakly-supervised Semantic Segmentation
MIT License
122 stars 2 forks source link

Table 1: Evaluation of the CAM and the corresponding pseudo segmentation ground-truth mask (Mask) #16

Closed venuszqm closed 1 year ago

venuszqm commented 1 year ago

作者你好,我想请教一下,CAM和Mask生成的miou两者有什么区别吗,我看代码里好像只有通过cam处理之后的mask miou部分,cam miou是怎么实现的吗?

Yingyue-L commented 1 year ago

The scripts below is for the CAM generation, which is the CAM mIoU, you can download the ckpt to reproduce it(We update it to 67.1%).

# Generate CAM
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 \
main.py --model deit_small_WeakTr_AAF_AttnFeat_patch16_224 \
                --data-path data \
                --data-set VOC12MS \
                --img-ms-list voc12/train_id.txt \
                --scales 1.0 1.2 \
                --gen_attention_maps \
                --cam-npy-dir WeakTr_results/WeakTrV2/attn-patchrefine-npy-ms \
                --output_dir WeakTr_results/WeakTrV2 \
                --resume WeakTr_results/WeakTrV2/WeakTrV2_CAM_Generation.pth \
                --reduction 8 \
                --pool-type max \

python evaluation.py --list voc12/train_id.txt \
                     --data-path data \
                     --type npy \
                     --predict_dir WeakTr_results/WeakTrV2/attn-patchrefine-npy-ms \
                     --curve True \
                     --t 43 \

The Mask is generated after OnlineRetraining as the scripts below, which is the Mask mIoU, you can download the ckpt to reproduce it(76.4%).

# Mask Generation
PORT=13684 bash segm/dist_test.sh 4 \
--multiscale \
--eval-split ImageSets/Segmentation/train.txt \
--predict-dir start1.2_patch120_seg_deit_small_patch16_224_voc_weaktr/seg_prob_train_ms \
start1.2_patch120_seg_deit_small_patch16_224_voc_weaktr/WeakTr_OnlineRetraining_DeiT.pth \
pascal_voc

python -m segm.eval.make_crf \
--list train.txt \
--data-path ../data \
--predict-dir start1.2_patch120_seg_deit_small_patch16_224_voc_weaktr/seg_prob_train_ms \
--predict-png-dir start1.2_patch120_seg_deit_small_patch16_224_voc_weaktr/seg_pred_train_ms \
--num-cls 21 \
--dataset voc12
venuszqm commented 1 year ago

训练的时候有注意到第三个损失基本是稳定的状态,没有怎么下降,(train_attn_loss)

Yingyue-L commented 1 year ago

训练的时候有注意到第三个损失基本是稳定的状态,没有怎么下降,(train_attn_loss)

It is just declining at a slower rate, but the overall trend is still downward. This can be observed through the curve in mlflow.

Unrealluver commented 1 year ago

I will close this issue. Please let me know if there still exists anything unclear.