Comments (7)
不需要,triplet loss只在训练中使用,测试的时候单张图片即可。@ccc013
from caffe.
哦,所以triplet loss层应该加上
include {
phase: TRAIN
}
才对,是吗
from caffe.
是的@ccc013
from caffe.
好的,谢谢...不过我发现triplet loss一直没有下降,而且我也同时有使用softmax loss的。
然后网络结构是这样的:
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 227
scale: 0.00390625
mean_file: "/home/cai/dataset/food-101/data/food101_mean_train.binaryproto"
}
data_param {
source: "/home/cai/dataset/food-101/examples/food101_train_triplet_lmdb"
batch_size: 250
backend: LMDB
}
}
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mirror: false
crop_size: 227
scale: 0.00390625
mean_file: "/home/cai/dataset/food-101/data/food101_mean_val.binaryproto"
}
data_param {
source: "/home/cai/dataset/food-101/examples/food101_val_lmdb"
batch_size: 50
backend: LMDB
}
}
接下来是一些conv层和fc层,最后的fc层和loss层如下:
layer {
name: "ip3"
type: "InnerProduct"
bottom: "fc7"
top: "ip3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 101
weight_filler {
type: "xavier"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "sample_triplet"
type: "SampleTriplet"
bottom: "ip3"
top: "triplet"
sample_triplet_param {
label_num: 10
sample_num: 25
}
include {
phase: TRAIN
}
}
layer {
name: "triplet_loss"
type: "TripletLoss"
bottom: "ip3"
bottom: "triplet"
top: "triplet_loss"
triplet_loss_param {
margin: 0.1
}
include {
phase: TRAIN
}
loss_weight: 0.5
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip3"
bottom: "label"
top: "loss"
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip3"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
所以我想问是不是我的网络结构的设置出现了什么问题,才会导致这个loss一直不变,然后准确率也不变
from caffe.
看了一下你的网络结构,我看到你的结构中把triplet loss加在了分类器输出(ip3)上,个人觉得triplet loss作用在倒数第二层的输出(fc7)上更合适,因为这一层的输出相当于网络学习到的特征,而最后一层ip3则是针对这些特征的分类器,其输出ip3作为分类器的响应。triplet loss的目标是使学习到的特征包含“类内近、类间远“的特性。所以,以fc7作为SampleTriplet的bottom可能更合适一些,以上仅是我个人的观点@ccc013
from caffe.
哦,好像应该是用倒数第二层的输出合适点,我先修改下,看看效果如何,谢谢解答!
from caffe.
Hi Mr @tyandzx
Did you release the layer of recognition in demo phase ?
from caffe.
Related Issues (13)
- FaceNet architecture HOT 4
- 训练准确率一直不变 HOT 2
- about the triplet loss layer HOT 16
- loss 在0.7500上下跳动 HOT 1
- [error] Check failed: ExactNumBottomBlobs() == bottom.size() (2 vs. 3) TripletLoss Layer takes 2 bottom blob(s) as input. HOT 5
- Sample data-label file and model prototxt
- major reference ? HOT 6
- make all error HOT 3
- 多GPU时候应该怎样设置
- about the negative node selection in triplets samples HOT 1
- About label_num and sample_num HOT 4
- Changing condition
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 caffe.