Giter VIP home page Giter VIP logo

Comments (20)

hodaatef avatar hodaatef commented on July 19, 2024

Thank you for your concern

"""
print("==> Start training ...")

net.train()
for epoch in range(start_epoch, epochs + start_epoch):

    running_loss = 0.0
    for batch_idx, (data1, data2, data3) in enumerate(trainloader):

        if is_gpu:
            device = torch.device("cuda" if torch.cuda.is_avaliable() else "cpu")
            data1, data2, data3 = data1.to(device), data2.to(device), data3.to(device)
        # wrap in torch.autograd.Variable
        data1, data2, data3 = Variable(
            data1), Variable(data2), Variable(data3)

        # compute output and loss
        embedded_a, embedded_p, embedded_n = net(data1, data2, data3)
        loss = criterion(embedded_a, embedded_p, embedded_n)

this is my code after update
is it true ?

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

It looks good. Could you give a try?

Please feel free to reach out if you still have that error message. ^_^

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024
Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>>

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

^_^

i have another message error :(

==> Initialize CUDA support for TripletNet model ...
==> Building new TripletNet model ...
==> Preparing Tiny ImageNet dataset ...
==> Start training ...
Traceback (most recent call last):
  File "main.py", line 111, in <module>
    main()
  File "main.py", line 107, in main
    testloader, args.start_epoch, args.epochs, args.is_gpu)
  File "D:\deep-ranking\model7\utils.py", line 99, in train
    device = torch.device('cuda:0' if torch.cuda.is_avaliable() else 'cpu')
AttributeError: module 'torch.cuda' has no attribute 'is_avaliable'

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

Did you

import torch.cuda

See pytorch/pytorch#283

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

yes ,
i searched on Same page and other pages but i still have the same problem

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024
(deep-ranking) D:\deep-ranking\model7>python
Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch.nn as nn
>>> torch.cuda.is_available()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'torch' is not defined
>>> import torch.cuda
>>> torch.cuda.is_available()
True
>>>

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

the problem solved
but training loss 0.0

(deep-ranking) D:\deep-ranking\model7>python main.py
==> Initialize CUDA support for TripletNet model ...
==> Building new TripletNet model ...
==> Preparing Tiny ImageNet dataset ...
==> Start training ...
Training Epoch: 1 | Loss: 0.0
Training Epoch: 2 | Loss: 0.0
Training Epoch: 3 | Loss: 0.0

why loss 0.0 ?? what is the problem

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

Did you re-generate triplets of pics or use the .txt file in this repo? In my own experiment, the log.txt file contains all the training process output. Did you change any parameters? Have you met this issue all the time? 🤔

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

yes , i generate new triplets of pics,
i dont made any change of parameters :(

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

Have you already solved this problem? I cannot help you tuning parameters for the loss currently since I do not have a GPU to run on my laptop. 🤔

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

A problem still exists :(
I am working on solving it

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

So the training loss is still 0 ? Did you double check the triplets of image (the generated txt file)? Is it reasonable?

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

yes still 0...
i checked it , the same with your triplets.txt

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

i think the problem is overfitting
weights overfit with datasets
but how i solve this problems

from image-similarity-using-deep-ranking.

hodaatef avatar hodaatef commented on July 19, 2024

i solved the problem
thanks for your concern

from image-similarity-using-deep-ranking.

Zhenye-Na avatar Zhenye-Na commented on July 19, 2024

Glad to hear this. ~

from image-similarity-using-deep-ranking.

miege2k avatar miege2k commented on July 19, 2024

Hey I have the same problem but this code is not working for me.

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
data1, data2, data3 = data1.to(device), data2.to(device), data3.to(device)

Have you any idea what the problem is?

from image-similarity-using-deep-ranking.

miege2k avatar miege2k commented on July 19, 2024

So now I fixed the problem. The right code is this(utils.py(91)):

print("==> Start training ...")
net.train()
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
net.to(device)

from image-similarity-using-deep-ranking.

YgluWanh avatar YgluWanh commented on July 19, 2024

unfinished

from image-similarity-using-deep-ranking.

Related Issues (12)

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.