COAT icon indicating copy to clipboard operation
COAT copied to clipboard

ValueError: Undefined kernel size.

Open zqx951102 opened this issue 2 years ago • 2 comments

hello: python train.py --cfg ./logs/prw_coat/config.yaml --eval --ckpt ./logs/prw_coat/prw_COAT.pth

When I entered this line of command during the test phase, this error was displayed, that is, in the file trnasform.py, the size of the convolution kernel is not defined? But I see that it has been defined in the code, and I don’t know what the problem is. looking forward to your reply.

(coat) zqx_tesla@tesla-v100:~/home/zqx_tesla/PersonReID/PersonReID2/COAT-main$ python train.py --cfg ./logs/prw_coat/config.yaml --eval --ckpt ./logs/prw_coat/prw_COAT.pth
Creating model...
Traceback (most recent call last):
File "train.py", line 186, in
main(args)
File "train.py", line 35, in main
model = COAT(cfg)
File "/home/zqx_tesla/home/zqx_tesla/PersonReID/PersonReID2/COAT-main/models/coat.py", line 53, in init
box_head = TransformerHead(
File "/home/zqx_tesla/home/zqx_tesla/PersonReID/PersonReID2/COAT-main/models/transformer.py", line 40, in init
self.transformer_encoder = Transformers(
File "/home/zqx_tesla/home/zqx_tesla/PersonReID/PersonReID2/COAT-main/models/transformer.py", line 102, in init
raise ValueError('Undefined kernel size.')
ValueError: Undefined kernel size.

zqx951102 avatar Apr 01 '23 14:04 zqx951102

I re-installed the conda environment and evaluated the code with this command: python train.py --cfg configs/prw.yaml --eval --ckpt prw_COAT.pth

I didn't get any issue. I assume that you didn't train the model by your own, so you should check which config file you are using. Thanks.

daweidu avatar Apr 05 '23 01:04 daweidu

Thank you very much. I have found the reason for the error, which is the problem you mentioned. During the test and when using CBGM, the yaml file in./configs/prw.yaml was used instead of the .yaml file in logs.

Your github's documentation say: Testing: The test script is similar to CUHK-SYSU. Make sure the path of pre-trained model model is correct.

python train.py --cfg ./logs/prw/config.yaml --eval --ckpt ./logs/prw/prw_COAT.pth

Testing with CBGM: Similar to CUHK-SYSU, set the flag EVAL_USE_CBGM to True (default is False).

python train.py --cfg ./logs/prw/config.yaml --eval --ckpt ./logs/prw/prw_COAT.pth EVAL_USE_CBGM True

So you should fix github's documentation. It's wrong.

You should change it to: python train.py --cfg ./configs/prw.yaml --eval --ckpt ./logs/prw_coat/prw_COAT.pth EVAL_USE_CBGM True

Thanks again for your help!

zqx951102 avatar Apr 05 '23 05:04 zqx951102