index 3cd76d124cb7c7cef07890a858535d4217bb2289..c4bb8cc5311bdef05b86e84a5aad0ca45075882a 100644 (file)
// Copyright 2013 Yangqing Jia
+#include <stdint.h>
+#include <string>
#include <vector>
#include <leveldb/db.h>
#include "caffe/layer.hpp"
#include "caffe/vision_layers.hpp"
+using std::string;
+
namespace caffe {
template <typename Dtype>
// Read a data point, and use it to initialize the top blob.
Datum datum;
datum.ParseFromString(iter_->value().ToString());
- const BlobProto& blob = datum.blob();
// image
(*top)[0]->Reshape(
- this->layer_param_.batchsize(), blob.channels(), blob.height(),
- blob.width());
+ this->layer_param_.batchsize(), datum.channels(), datum.height(),
+ datum.width());
// label
(*top)[1]->Reshape(this->layer_param_.batchsize(), 1, 1, 1);
// datum size
- datum_size_ = blob.data_size();
+ datum_size_ = datum.data().size();
}
template <typename Dtype>
for (int i = 0; i < this->layer_param_.batchsize(); ++i) {
// get a blob
datum.ParseFromString(iter_->value().ToString());
- const BlobProto& blob = datum.blob();
+ const string& data = datum.data();
for (int j = 0; j < datum_size_; ++j) {
- top_data[i * datum_size_ + j] = blob.data(j);
+ top_data[i * datum_size_ + j] = (uint8_t)data[j];
}
top_label[i] = datum.label();
// go to the next iter