资源简介
caffe实现triplet loss,博客说明:http://blog.csdn.net/gu_gu_/article/details/56282299
代码片段和文件信息
#ifdef USE_OPENCV
#include
#endif // USE_OPENCV
#include
#include
#include “caffe/data_transformer.hpp“
#include “caffe/util/io.hpp“
#include “caffe/util/math_functions.hpp“
#include “caffe/util/rng.hpp“
namespace caffe {
template
DataTransformer::DataTransformer(const TransformationParameter& param
Phase phase)
: param_(param) phase_(phase) {
// check if we want to use mean_file
if (param_.has_mean_file()) {
CHECK_EQ(param_.mean_value_size() 0) <<
“Cannot specify mean_file and mean_value at the same time“;
const string& mean_file = param.mean_file();
if (Caffe::root_solver()) {
LOG(INFO) << “Loading mean file from: “ << mean_file;
}
BlobProto blob_proto;
ReadProtoFromBinaryFileOrDie(mean_file.c_str() &blob_proto);
data_mean_.FromProto(blob_proto);
}
// check if we want to use mean_value
if (param_.mean_value_size() > 0) {
CHECK(param_.has_mean_file() == false) <<
“Cannot specify mean_file and mean_value at the same time“;
for (int c = 0; c < param_.mean_value_size(); ++c) {
mean_values_.push_back(param_.mean_value(c));
}
}
}
template
void DataTransformer::Transform(const Datum& datum
Dtype* transformed_data) {
const string& data = datum.data();
const int datum_channels = datum.channels();
const int datum_height = datum.height();
const int datum_width = datum.width();
const int crop_size = param_.crop_size();
const Dtype scale = param_.scale();
const bool do_mirror = param_.mirror() && Rand(2);
const bool has_mean_file = param_.has_mean_file();
const bool has_uint8 = data.size() > 0;
const bool has_mean_values = mean_values_.size() > 0;
CHECK_GT(datum_channels 0);
CHECK_GE(datum_height crop_size);
CHECK_GE(datum_width crop_size);
Dtype* mean = NULL;
if (has_mean_file) {
CHECK_EQ(datum_channels data_mean_.channels());
CHECK_EQ(datum_height data_mean_.height());
CHECK_EQ(datum_width data_mean_.width());
mean = data_mean_.mutable_cpu_data();
}
if (has_mean_values) {
CHECK(mean_values_.size() == 1 || mean_values_.size() == datum_channels) <<
“Specify either 1 mean_value or as many as channels: “ << datum_channels;
if (datum_channels > 1 && mean_values_.size() == 1) {
// Replicate the mean_value for simplicity
for (int c = 1; c < datum_channels; ++c) {
mean_values_.push_back(mean_values_[0]);
}
}
}
int height = datum_height;
int width = datum_width;
int h_off = 0;
int w_off = 0;
if (crop_size) {
height = crop_size;
width = crop_size;
// We only do random crop when we do training.
if (phase_ == TRAIN) {
h_off = Rand(datum_height - crop_size + 1);
w_off = Rand(datum_width - crop_size + 1);
} else {
h_off = (datum_height - crop_size) / 2;
w_off = (datum_width - crop_size) / 2;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 57946 2017-02-17 19:43 triplet_loss\caffe.proto
文件 19121 2017-02-17 20:18 triplet_loss\data_transformer.cpp
文件 5055 2017-02-19 21:07 triplet_loss\my_triplet_loss_la
文件 1345 2017-01-12 15:59 triplet_loss\my_triplet_loss_la
文件 1895 2017-01-12 15:23 triplet_loss\my_triplet_select_la
文件 1033 2016-11-09 17:01 triplet_loss\my_triplet_select_la
文件 2604 2017-02-21 13:27 triplet_loss\train_bodynet.prototxt
目录 0 2017-02-21 14:28 triplet_loss\
- 上一篇:数据结构张琨版课后习题答案
- 下一篇:RotationWatcher;apk
相关资源
- Caffe安装支持文件
- 用自己的数据进行CaffeNet训练模型
-
Context-ba
sed Adaptive Lossless Image Codin - caffe的配置文件Makefile.conf
- 基于caffe搭建RefineDet并训练自己的模型
- lee的caffe配置install-opencv-master.zip
- caffe实现的性别年龄表情预测分类
- vgg16_caffe.pth
- resnet各种预训练模型
- Caffe/Pytorch转为TensorRT 4.0的
- faster_rcnn-master 直接运行即可,重新编
- FCN Caffe Net
- Low conversion-loss fourth subharmonic mixers
- colossal cave adventure
- Windows下caffe安装详解
- 训练mask_rcnn所用配置文件
- keras做CNN的训练误差loss的下降操作
- Caffe编译的配置文件Makefile.config环境:
- 老版包含windows文件夹的caffe-windows库
- caffe下faster-rcnn的ResNet-50配置文件
- flownet2的网络定义文件
- Caffe-ssd的宽高比聚类
- 修改过的caffe编译时用到的build_win.c
- 【新版】【caffe】将图片转化为lmdb脚
- Strain effect on colossal oxygen ionic conduct
- Hydraulic conductivity determination and leaka
-
thermal conductivity of me
tallic nanofilms: - Impact of surface-bond-order-loss on the phono
- Caffe源码深入解析
- res10_300x300_ssd_iter_140000.caffemodel与dep
评论
共有 条评论