Skip to content

UnboundLocalError: cannot access local variable 'outputs' where it is not associated with a value #67

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

Open
Siegward233 opened this issue Apr 6, 2025 · 0 comments

Comments

@Siegward233
Copy link

I have a problem with the test step. The environment is Google Colab. I tried changing num_workers to 0, but it didn't solve the problem. How should I solve this problem? Thank you!
!python /content/University1652-Baseline/test.py --name ft_ResNet50 --test_dir /content/University-Release/test --batchsize 32 --which_epoch 119
We use the scale: 1 -------test----------- /usr/local/lib/python3.11/dist-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( /usr/local/lib/python3.11/dist-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or Nonefor 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passingweights=ResNet50_Weights.IMAGENET1K_V1. You can also use weights=ResNet50_Weights.DEFAULTto get the most up-to-date weights. warnings.warn(msg) Load the model from ./model/ft_ResNet50/net_119.pth 1 -> 3: 32 64 96 128 160 192 224 256 288 320 352 384 416 448 480 512 544 576 608 640 672 701 32 Traceback (most recent call last): File "/content/University1652-Baseline/test.py", line 249, in <module> gallery_feature = extract_feature(model,dataloaders[gallery_name], which_gallery) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/content/University1652-Baseline/test.py", line 181, in extract_feature ff += outputs ^^ UnboundLocalError: cannot access local variable 'outputs' where it is not associated with a value

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

1 participant