-
Notifications
You must be signed in to change notification settings - Fork 59
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
UnboundLocalError: local variable 'loss' referenced before assignment #7
Comments
Hi! most probably the dimensions of your image are not same. You would need to resize them. |
Hi! I have the same problem, however changing the dimensions of the image doesn't fix the problem. Process finished with exit code 1` |
Have you written in the
|
Unfortunately it does not. The train-image-similarity.ipynb also has this problem. |
I'm still perplexed. It should run as I had tested this code (long time ago) and it ran fine. |
Can you share a reproducible script over colab so that I can debug? |
I think you just use a small size images for test. So you can modify drop_last from True to False in torch_train.py. train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=config.TRAIN_BATCH_SIZE, shuffle=True, drop_last=False) |
I was trying to test an image using the train-image-inference.ipynb file. But in the last block of code, I am getting an error.
ValueError Traceback (most recent call last)
in ()
10 embedding = np.load(EMBEDDING_PATH, allow_pickle=True)
11
---> 12 indices_list = compute_similar_images(TEST_IMAGE_PATH, NUM_IMAGES, embedding, device)
13 plot_similar_images(indices_list)
7 frames
/usr/local/lib/python3.7/dist-packages/sklearn/metrics/pairwise.py in check_pairwise_arrays(X, Y, precomputed, dtype, accept_sparse, force_all_finite, copy)
153 raise ValueError("Incompatible dimension for X and Y matrices: "
154 "X.shape[1] == %d while Y.shape[1] == %d" % (
--> 155 X.shape[1], Y.shape[1]))
156
157 return X, Y
ValueError: Incompatible dimension for X and Y matrices: X.shape[1] == 65536 while Y.shape[1] == 262144
Please help me how to solve this issue
The text was updated successfully, but these errors were encountered: