资源简介
安装caffe的代码
代码片段和文件信息
//
// This script converts the CIFAR dataset to the leveldb format used
// by caffe to perform classification.
// Usage:
// convert_cifar_data input_folder output_db_file
// The CIFAR dataset could be downloaded at
// http://www.cs.toronto.edu/~kriz/cifar.html
#include // NOLINT(readability/streams)
#include
#include “boost/scoped_ptr.hpp“
#include “glog/logging.h“
#include “google/protobuf/text_format.h“
#include “stdint.h“
#include “caffe/proto/caffe.pb.h“
#include “caffe/util/db.hpp“
#include “caffe/util/format.hpp“
using caffe::Datum;
using boost::scoped_ptr;
using std::string;
namespace db = caffe::db;
const int kCIFARSize = 32;
const int kCIFARImageNBytes = 3072;
const int kCIFARBatchSize = 10000;
const int kCIFARTrainBatches = 5;
void read_image(std::ifstream* file int* label char* buffer) {
char label_char;
file->read(&label_char 1);
*label = label_char;
file->read(buffer kCIFARImageNBytes);
return;
}
void convert_dataset(const string& input_folder const string& output_folder
const string& db_type) {
scoped_ptr train_db(db::GetDB(db_type));
train_db->Open(output_folder + “/cifar10_train_“ + db_type db::NEW);
scoped_ptr txn(train_db->NewTransaction());
// Data buffer
int label;
char str_buffer[kCIFARImageNBytes];
Datum datum;
datum.set_channels(3);
datum.set_height(kCIFARSize);
datum.set_width(kCIFARSize);
LOG(INFO) << “Writing Training data“;
for (int fileid = 0; fileid < kCIFARTrainBatches; ++fileid) {
// Open files
LOG(INFO) << “Training Batch “ << fileid + 1;
string batchFileName = input_folder + “/data_batch_“
+ caffe::format_int(fileid+1) + “.bin“;
std::ifstream data_file(batchFileName.c_str()
std::ios::in | std::ios::binary);
CHECK(data_file) << “Unable to open train file #“ << fileid + 1;
for (int itemid = 0; itemid < kCIFARBatchSize; ++itemid) {
read_image(&data_file &label str_buffer);
datum.set_label(label);
datum.set_data(str_buffer kCIFARImageNBytes);
string out;
CHECK(datum.SerializeToString(&out));
txn->Put(caffe::format_int(fileid * kCIFARBatchSize + itemid 5) out);
}
}
txn->Commit();
train_db->Close();
LOG(INFO) << “Writing Testing data“;
scoped_ptr test_db(db::GetDB(db_type));
test_db->Open(output_folder + “/cifar10_test_“ + db_type db::NEW);
txn.reset(test_db->NewTransaction());
// Open files
std::ifstream data_file((input_folder + “/test_batch.bin“).c_str()
std::ios::in | std::ios::binary);
CHECK(data_file) << “Unable to open test file.“;
for (int itemid = 0; itemid < kCIFARBatchSize; ++itemid) {
read_image(&data_file &label str_buffer);
datum.set_label(label);
datum.set_data(str_buffer kCIFARImageNBytes);
string out;
CHECK(datum.SerializeToString(&out));
txn->Put(caffe::format_int(itemid 5) out);
}
txn->Commit();
test_db->Close();
}
int main(int argc char** ar
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-06 20:41 caffe-master\
文件 101863 2016-12-06 20:41 caffe-master\.Doxyfile
文件 2518 2016-12-06 20:41 caffe-master\.gitattributes
文件 1210 2016-12-06 20:41 caffe-master\.gitignore
文件 1966 2016-12-06 20:41 caffe-master\.travis.yml
文件 3012 2016-12-06 20:41 caffe-master\CMakeLists.txt
文件 1917 2016-12-06 20:41 caffe-master\CONTRIBUTING.md
文件 620 2016-12-06 20:41 caffe-master\CONTRIBUTORS.md
文件 210 2016-12-06 20:41 caffe-master\INSTALL.md
文件 2095 2016-12-06 20:41 caffe-master\LICENSE
文件 23696 2016-12-06 20:41 caffe-master\Makefile
文件 4283 2016-12-06 20:41 caffe-master\Makefile.config.example
文件 4835 2016-12-06 20:41 caffe-master\README.md
文件 719 2016-12-06 20:41 caffe-master\appveyor.yml
文件 1180 2016-12-06 20:41 caffe-master\caffe.cloc
目录 0 2016-12-06 20:41 caffe-master\cmake\
文件 4373 2016-12-06 20:41 caffe-master\cmake\ConfigGen.cmake
文件 11197 2016-12-06 20:41 caffe-master\cmake\Cuda.cmake
文件 5564 2016-12-06 20:41 caffe-master\cmake\Dependencies.cmake
目录 0 2016-12-06 20:41 caffe-master\cmake\External\
文件 1939 2016-12-06 20:41 caffe-master\cmake\External\gflags.cmake
文件 1719 2016-12-06 20:41 caffe-master\cmake\External\glog.cmake
文件 1764 2016-12-06 20:41 caffe-master\cmake\Misc.cmake
目录 0 2016-12-06 20:41 caffe-master\cmake\Modules\
文件 1666 2016-12-06 20:41 caffe-master\cmake\Modules\FindAtlas.cmake
文件 1545 2016-12-06 20:41 caffe-master\cmake\Modules\FindGFlags.cmake
文件 1451 2016-12-06 20:41 caffe-master\cmake\Modules\FindGlog.cmake
文件 6723 2016-12-06 20:41 caffe-master\cmake\Modules\FindLAPACK.cmake
文件 1119 2016-12-06 20:41 caffe-master\cmake\Modules\FindLMDB.cmake
文件 1728 2016-12-06 20:41 caffe-master\cmake\Modules\FindLevelDB.cmake
文件 3250 2016-12-06 20:41 caffe-master\cmake\Modules\FindMKL.cmake
............此处省略769个文件信息
相关资源
- SSD源码的QT工程
- 无痛的机器学习 第一季
- 薛开宇caffe学习笔记完整版
- caffe深度学习薛开宇笔记-基于卷积神
- ilsvrc_2012_mean.npy
- Caffe官方教程中译本_CaffeCN社区翻译(
- 手写数字识别10000次cnn结果 (.caffem
- 基于卷积神经网络的声音识别
- mnist的模型
- 深度学习---Caffe之经典模型详解与实战
- 编译好的Caffe2压缩包
- 格式转换后的mnist数据集
- Kaggle入门——猫狗大战
- caff-lenet5数据集
- caffe imagenet_mean.binaryproto
- caffe2安装文件
- MobileNetSSD_deploy.caffemodel
- mnist图片数据集 png格式
- 深度学习-21天实战caffe高清.pdf版
- caffe验证码识别数据集及模型
- hdf5-1.8.17.tar.gz
- 深度学习 21天实战Caffe.pdf 高清完整版
- 深度学习 21天实战Caffe.pdf (赵永科著
- caffe2源码
- ResNet-50-model.caffemodel
- caffe 5类训练和测试图
- DNN模型所需要的三个文件- bvlc_google
- ResNet-101-model.caffemodel
- 深度学习:21天实战Caffe 高清完整版
- caffe离线环境搭建
评论
共有 条评论