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

Method SetUp

src/caffe/test/test_image_data_layer.cpp:28–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 blob_top_data_(new Blob<Dtype>()),
27 blob_top_label_(new Blob<Dtype>()) {}
28 virtual void SetUp() {
29 blob_top_vec_.push_back(blob_top_data_);
30 blob_top_vec_.push_back(blob_top_label_);
31 Caffe::set_random_seed(seed_);
32 // Create test input file.
33 MakeTempFilename(&filename_);
34 std::ofstream outfile(filename_.c_str(), std::ofstream::out);
35 LOG(INFO) << "Using temporary file " << filename_;
36 for (int i = 0; i < 5; ++i) {
37 outfile << EXAMPLES_SOURCE_DIR "images/cat.jpg " << i << std::endl;
38 }
39 outfile.close();
40 // Create test input file for images of distinct sizes.
41 MakeTempFilename(&filename_reshape_);
42 std::ofstream reshapefile(filename_reshape_.c_str(), std::ofstream::out);
43 LOG(INFO) << "Using temporary file " << filename_reshape_;
44 reshapefile << EXAMPLES_SOURCE_DIR "images/cat.jpg " << 0 << std::endl;
45 reshapefile << EXAMPLES_SOURCE_DIR "images/fish-bike.jpg " << 1
46 << std::endl;
47 reshapefile.close();
48 // Create test input file for images with space in names
49 MakeTempFilename(&filename_space_);
50 std::ofstream spacefile(filename_space_.c_str(), std::ofstream::out);
51 LOG(INFO) << "Using temporary file " << filename_space_;
52 spacefile << EXAMPLES_SOURCE_DIR "images/cat.jpg " << 0 << std::endl;
53 spacefile << EXAMPLES_SOURCE_DIR "images/cat gray.jpg " << 1 << std::endl;
54 spacefile.close();
55 }
56
57 virtual ~ImageDataLayerTest() {
58 delete blob_top_data_;

Callers 1

TYPED_TESTFunction · 0.45

Calls 2

set_random_seedFunction · 0.85
MakeTempFilenameFunction · 0.85

Tested by

no test coverage detected