Coder Social home page Coder Social logo

chencodex / triplet-loss-pytorch Goto Github PK

View Code? Open in Web Editor NEW
122.0 122.0 27.0 69 KB

A generic triplet data loader for image classification problems,and a triplet loss net demo.

Python 100.00%
dataloader fine-grained-classification pytorch triplet-loss

triplet-loss-pytorch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

triplet-loss-pytorch's Issues

程序跑的过程中有的时候会突然出现问题

您好,感谢您创建了一个这么好的项目。我将您的项目应用在了我的数据集上,确实获得了性能提升。但是有的时候跑着跑着会出现以下问题,而导致程序终止:

image

刚开始第一个epoch一般不会出现,每次跑基本上都会在某个epoch出现而终止。我基本上没改您的程序,期待您帮忙解决一下这个问题,感谢!(我的训练集有900张(A类173,B类727张),测试集379张(A类75张,B类304张),训练的batch_size是按照您设置的是10,测试的batch_size是100)

hard triplet convergence

I use triple loss between data of two modalities to reduce the distance between different modalities of the same class and increase the distance between different modalities of different class. But when I use batch_all loss, the valid set loss has not changed; now using hard_loss, the valid set loss still has not changed. What is the reason? I found some answers that triplet is difficult to converge. What do you do to deal with triplet loss convergence?

你好,代码出现死循环

data_loader.py的102行:
while len(self.data_queue) < self.batch_size:
time.sleep(0.2)
这个容易出现死循环。

你好,请问可以解释一下这一部分的代码吗?

你好,请问可以解释一下这一部分的代码吗?没看懂你triplet loss是怎么计算的。
temp_x = [torch.stack(input[i], dim=0) for i in range(len(input))]
temp_y = [torch.stack(target[i], dim=0) for i in range(len(target))]
new_x = torch.stack(temp_x, dim=0)
new_y = torch.stack(temp_y, dim=0)

    new_x = [new_x[:, i] for i in range(3)]
    new_y = [new_y[:, i] for i in range(3)]
    sample_input = torch.cat(new_x, 0)
    sample_target = torch.cat(new_y, 0)
    # print (sample_target)
    # print (sample_target[:batch_size])
    # print (sample_target[batch_size:(batch_size * 2)])
    # print (sample_target[-batch_size:])
    target = sample_target.cuda(async=True)
    input_var = torch.autograd.Variable(sample_input.cuda())
    target_var = torch.autograd.Variable(target.cuda())
    # compute output
    output = model(input_var)
    anchor = output[:temp_batch_size]
    positive = output[temp_batch_size:(temp_batch_size * 2)]
    negative = output[-temp_batch_size:]

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.