Comments (25)
@pinguo-luhaofang 我觉得 @chendd14 的说法是对的
如果按照
if aps[i][1] >= ans[i][1]:
self.no_residual_list.append(i) 这个逻辑
hard samples(aps[i][1] >= ans[i][1]:)都不反传梯度了
from tripletloss.
对的,每次取10对,在反传梯度的时候进行样本筛选的调整,这里进行排序只是为尽可能让更多的triplet满足筛选条件。
from tripletloss.
@BrettLL 我是通过不回传梯度,来达到样本对semi-hard的筛选的目的。那些符合筛选条件的样本对会进行参数更新。
from tripletloss.
@jiangxuehan @chendd14 我觉的
if aps[i][1] >= ans[i][1]:
self.no_residual_list.append(i)
这个逻辑是对的,hard negative 是不参与误差反传的,因为有可能导致bad local minimal
这个在FaceNet文章的公式(4)当中有做了说明。 只选择 ans > aps的样本
from tripletloss.
datalayer层中每个人选了十对triplet,但是select里面怎么保证每对都满足条件呢?还是把不满足条件的triplet舍弃掉,还有如果每个人的样本数量不固定,比较少的话。这个策略是不是不适用
from tripletloss.
@dianxin556 你好,谢谢你的提问,如果每次选择的样本都存在问题,那么说明cnn的分类模型训练是存在问题的。
from tripletloss.
好像vgg对数据均衡要求比较高 每个人的样本数量相差太大的话 很难收敛,,
亲身体会
from tripletloss.
谢谢@pinguo-luhaofnag,@yzk0281.那每次输入的batchsize必须是固定的吗?还是只要是3的倍数就可以。
from tripletloss.
我就取的30
from tripletloss.
如果不指定大小可以吗,比如说一个人下面有n个样本,就用n*3这么大可以吗
from tripletloss.
这个,,,我就不知道了 luhaofang大神来回答下。。
from tripletloss.
@pinguo-luhaofang 这样选择的10对样本有可能有的并不满足aps[i][1] >= ans[i][1]的条件,还是只选择10对样本中满足这个条件的样本对?那是不是应该是:
if aps[i][1] >= ans[i][1]:
self.no_residual_list.append(i)
else:
self.tripletlist.append([i,aps[i][0],ans[i][0]])
from tripletloss.
@pinguo-luhaofang ,我看你前一个版本选择的条件是写if an>ap,.....
最新的版本是ap>=an,新版的这个是不满足条件的样本吗?
from tripletloss.
2个版本的选择条件都是an > ap ,差异在于当前的代码使用的是记录minibatch里边不符合筛选条件的样本对code1。
在回传梯度的时候,这部分的样本是没有返回梯度的 code2。
from tripletloss.
@pinguo-luhaofang ,恩,谢谢。那你算loss的时候,是没有去除这些样本,并且把不产生loss的也加入了no_residual_list,对吧?您在数据集上训练的话,多久可以看到收敛?
from tripletloss.
这些样本对是产生loss的,因为他们经过loss function计算出的值是不为0的。
一个epoch(全样本图片各抽样一次),就开始收敛了。
from tripletloss.
@pinguo-luhaofang 你现在的代码是,
if aps[i][1] >= ans[i][1]:
self.no_residual_list.append(i)
else:
self.tripletlist.append([i,aps[i][0],ans[i][0]])
我怎么觉得应该是
if aps[i][1] <= ans[i][1]:
self.no_residual_list.append(i)
else:
self.tripletlist.append([i,aps[i][0],ans[i][0]])
from tripletloss.
@pinguo-luhaofang @chendd14 你们对于现在这个版本的代码有做实验了吗?
ap>an指的是那些有损失的,但是这个时候self.no_residual_list.append(i) 这样的逻辑确实反了吧?
from tripletloss.
@pinguo-luhaofang 个人感觉错了 我个人把这两行注释掉了 因为之后的一层里面已经有了判断 现在跑了跑 lfw分类效果确实提升了 但是还是没收敛=-= 感觉收敛了效果应该会不错
from tripletloss.
@qiufan
现在收敛了没?效果怎样
from tripletloss.
@yzk0281 没=-= 需要研究一下 又跑了3天基本没变化
from tripletloss.
@qiufan 请问你做embedding的时候 用的什么数据进行的 ?是用的vgg基本模型训练时候的数据还是要进行测试的数据,比如lfw?
from tripletloss.
@LiuJinxue 对的, 我后来又仔细的看了论文, 这个地方是对的。然而我还是没能收敛,因为数据库的问题源码里面的triplet 选择代码总会在随机的数的时候无限循环,自己改了之后又不能收敛。不知道是不是triplet 的选择需要多多注意?
from tripletloss.
@qiufan 无线循环是因为anchor找不到足够的positvie, 可以减少batch_size, 或者增加数据集每个类别的样本数量,每一类必须不少于batch_size/3 + 1的图片数。我的问题是收敛得太快了,所以就改小了lr。但最终的实验效果还是不如直接用vgg的fc7层
from tripletloss.
@LiuJinxue 嗯,谢谢。我知道是无限循环的原因。那是不是说,每一次训练,都需要anchor保持同一类?完全随机是不可以的?还是不能收敛好忧桑。。。
from tripletloss.
Related Issues (20)
- the module name is right,but it still failed with boost::python::error_already_set
- 训练到后面 loss都变为0.1 an,ap变为0 HOT 6
- training problem HOT 5
- training problem
- Hard Sample
- the triplet loss architecture is unsupervised, is this correct?
- tipletselectlayer - computing the distance against the anchor image HOT 2
- shuffle
- fc9_1 weights is increase with the train iterations from 0.0x to 40.x HOT 1
- Training your code on custom dataset HOT 1
- how to train it on 2 gpus
- Use of the margin HOT 2
- Negative mining in TripletSelectLayer HOT 1
- what does no_residual_list for?
- 数据集组织需要什么特别处理么? HOT 1
- online triplet sample selection usage?
- 您好,我想用自己的数据集跑这个网络,除了修改config路径,还需要修改哪里? HOT 2
- Online triplet generation HOT 1
- 工作推荐
- ap,an都变得特别大
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tripletloss.