MCPcopy Create free account
hub / github.com/BVLC/caffe / Fill

Method Fill

src/caffe/test/test_data_layer.cpp:43–68  ·  view source on GitHub ↗

Fill the DB with data: if unique_pixels, each pixel is unique but all images are the same; else each image is unique but all pixels within an image are the same.

Source from the content-addressed store, hash-verified

41 // all images are the same; else each image is unique but all pixels within
42 // an image are the same.
43 void Fill(const bool unique_pixels, DataParameter_DB backend) {
44 backend_ = backend;
45 LOG(INFO) << "Using temporary dataset " << *filename_;
46 scoped_ptr<db::DB> db(db::GetDB(backend));
47 db->Open(*filename_, db::NEW);
48 scoped_ptr<db::Transaction> txn(db->NewTransaction());
49 for (int i = 0; i < 5; ++i) {
50 Datum datum;
51 datum.set_label(i);
52 datum.set_channels(2);
53 datum.set_height(3);
54 datum.set_width(4);
55 std::string* data = datum.mutable_data();
56 for (int j = 0; j < 24; ++j) {
57 int datum = unique_pixels ? j : i;
58 data->push_back(static_cast<uint8_t>(datum));
59 }
60 stringstream ss;
61 ss << i;
62 string out;
63 CHECK(datum.SerializeToString(&out));
64 txn->Put(ss.str(), out);
65 }
66 txn->Commit();
67 db->Close();
68 }
69
70 void TestRead() {
71 const Dtype scale = 3;

Callers 15

SetUpMethod · 0.45
Im2colLayerTestMethod · 0.45
TestForwardMethod · 0.45
TYPED_TESTFunction · 0.45
SetUpMethod · 0.45
TYPED_TESTFunction · 0.45
SetUpMethod · 0.45
TestForwardMethod · 0.45
TestBackwardMethod · 0.45
SetUpMethod · 0.45

Calls 6

GetDBFunction · 0.85
OpenMethod · 0.45
NewTransactionMethod · 0.45
PutMethod · 0.45
CommitMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected