hustvl / WeakTr

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

create model #10

Closed venuszqm closed 1 year ago

venuszqm commented 1 year ago
model = model_cls(**kwargs) if model_cfg is None else model_cls(cfg=model_cfg, **kwargs)

TypeError: init() got an unexpected keyword argument 'reduction', main.py 281行 model_params = dict( model_name=args.model, pretrained=False, num_classes=args.nb_classes, drop_rate=args.drop, drop_path_rate=args.drop_path, drop_block_rate=None, reduction=args.reduction, pool=args.pool_type ) model = create_model(**model_params) The timm library does not have the reduction and pool-type arguments in the create_model function.

rongtongxueya commented 1 year ago

I ran into this problem at first, but then I deleted the two discoverers and it worked, and then I ran it with the readme commands and it didn't work

Yingyue-L commented 1 year ago

Thank for your question ! We register the model deit_small_WeakTr_patch16_224 in the models.py, which has the reduction and pool args, and it can correctly run as the scripts following:

python main.py  --model deit_small_WeakTr_patch16_224 \
                --data-path data \
                --data-set VOC12 \
                --img-ms-list voc12/train_id.txt \
                --cam-npy-dir WeakTr_results/WeakTr/attn-patchrefine-npy \
                --output_dir WeakTr_results/WeakTr \
                --lr 4e-4 \

Can you show the detailed error ?

venuszqm commented 1 year ago

Thanks to the author! I have noticed this problem, may I ask the author two questions? The first question is that this model is registered in timm, how to debug this piece or directly instantiate it? Second question, I noticed that the author set data distribution training, may I ask how to set python main.py in the terminal about this instruction?

Unrealluver commented 1 year ago

Thanks to the author! I have noticed this problem, may I ask the author two questions? The first question is that this model is registered in timm, how to debug this piece or directly instantiate it? Second question, I noticed that the author set data distribution training, may I ask how to set python main.py in the terminal about this instruction?

Thanks for your interest. To Q1: you may directly debug the program by VSCode or Pycharm. And there are a lot of tutorials for that, e.g. debug in pycharm. If you want to debug in the remote machines, there are also related guidance. To Q2: you may need to remove the DDP components in online retraining. If you just want to debug it in one machine, I strongly suggest you set the --nrpoc_per_node=1. Through this operation, you can debug it without the problem of Python multi-process.

venuszqm commented 1 year ago

Thanks to the author!

Unrealluver commented 1 year ago

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