chencodex / triplet-loss-pytorch Goto Github PK
View Code? Open in Web Editor NEWA generic triplet data loader for image classification problems,and a triplet loss net demo.
A generic triplet data loader for image classification problems,and a triplet loss net demo.
想学习一下您的代码,但是没有合适的数据集,如果能提供一下下载链接,将十分感谢!
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:]
你好,这个代码实现的非常好,能否把代码用的数据集的名字给我说一下,我想复现一下实验结果,非常感谢
读取大数据库特别慢,有什么建议的解决方法吗
你好,请问你是用的什么数据集呀
还是只要是图像分类的数据集就可以呢?
您好,我运行了您的代码 但是我只使用三元组损失进行训练,损失一直是在一个很小的值,请问您也是这样吗
请问这段代码是不是不兼容pytorch的dataset?想处理的数据集是dataset形式的,请问有什么办法吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.