Coder Social home page Coder Social logo

关于测试集的batch大小设置 about caffe HOT 7 OPEN

ccc013 avatar ccc013 commented on September 17, 2024
关于测试集的batch大小设置

from caffe.

Comments (7)

tyandzx avatar tyandzx commented on September 17, 2024

不需要,triplet loss只在训练中使用,测试的时候单张图片即可。@ccc013

from caffe.

ccc013 avatar ccc013 commented on September 17, 2024

哦,所以triplet loss层应该加上
include {
phase: TRAIN
}
才对,是吗

from caffe.

tyandzx avatar tyandzx commented on September 17, 2024

是的@ccc013

from caffe.

ccc013 avatar ccc013 commented on September 17, 2024

好的,谢谢...不过我发现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.

tyandzx avatar tyandzx commented on September 17, 2024

看了一下你的网络结构,我看到你的结构中把triplet loss加在了分类器输出(ip3)上,个人觉得triplet loss作用在倒数第二层的输出(fc7)上更合适,因为这一层的输出相当于网络学习到的特征,而最后一层ip3则是针对这些特征的分类器,其输出ip3作为分类器的响应。triplet loss的目标是使学习到的特征包含“类内近、类间远“的特性。所以,以fc7作为SampleTriplet的bottom可能更合适一些,以上仅是我个人的观点@ccc013

from caffe.

ccc013 avatar ccc013 commented on September 17, 2024

哦,好像应该是用倒数第二层的输出合适点,我先修改下,看看效果如何,谢谢解答!

from caffe.

z-pc avatar z-pc commented on September 17, 2024

Hi Mr @tyandzx
Did you release the layer of recognition in demo phase ?

from caffe.

Related Issues (13)

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.