Git Product home page Git Product logo

Comments (7)

oke-aditya avatar oke-aditya commented on May 30, 2024

Hi! most probably the dimensions of your image are not same. You would need to resize them.
This is due to assumption int the tutorial that all the images have shape of (512, 512). For images of different size, you would need different embeddings dimensions.

from image_similarity.

tibiv111 avatar tibiv111 commented on May 30, 2024

Hi! I have the same problem, however changing the dimensions of the image doesn't fix the problem.
`Setting Seed for the run, seed = 42
------------ Creating Dataset ------------
------------ Dataset Created ------------
------------ Creating DataLoader ------------
------------ Dataloader Cretead ------------
MSELoss()
GPU Availaible moving models to GPU
------------ Training started ------------
0%| | 0/30 [00:00<?, ?it/s]
Traceback (most recent call last):
File "E:/Work/UNI/Third_year_first_semester/Szoftver tervezes/Projekt/Image recognition repos/image_similarity/image_similarity-master/image_similarity/torch_train.py", line 79, in
train_loss = torch_engine.train_step(
File "E:\Work\UNI\Third_year_first_semester\Szoftver tervezes\Projekt\Image recognition repos\image_similarity\image_similarity-master\image_similarity\torch_engine.py", line 47, in train_step
return loss.item()
UnboundLocalError: local variable 'loss' referenced before assignment

Process finished with exit code 1`

from image_similarity.

oke-aditya avatar oke-aditya commented on May 30, 2024

Have you written in the torch_train.py code. If yes then it should work fine.

loss_fn = nn.MSELoss()

from image_similarity.

tibiv111 avatar tibiv111 commented on May 30, 2024

Unfortunately it does not. The train-image-similarity.ipynb also has this problem.

from image_similarity.

oke-aditya avatar oke-aditya commented on May 30, 2024

I'm still perplexed. It should run as I had tested this code (long time ago) and it ran fine.
Even the ipynb has the output.

https://github.com/oke-aditya/image_similarity/blob/master/image_similarity/train-image-similarity.ipynb

from image_similarity.

oke-aditya avatar oke-aditya commented on May 30, 2024

Can you share a reproducible script over colab so that I can debug?

from image_similarity.

hxtkyne avatar hxtkyne commented on May 30, 2024

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)

from image_similarity.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.