Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Undefined kernel size. #7

Open
zqx951102 opened this issue Apr 1, 2023 · 2 comments
Open

ValueError: Undefined kernel size. #7

zqx951102 opened this issue Apr 1, 2023 · 2 comments

Comments

@zqx951102
Copy link

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.

@daweidu
Copy link
Contributor

daweidu commented Apr 5, 2023

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.

@zqx951102
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants