40 class GraphVGG19Example :
public Example 43 void do_setup(
int argc,
char **argv)
override 45 std::string data_path;
50 const std::array<float, 3> mean_rgb{ { 123.68f, 116.779f, 103.939f } };
51 std::unique_ptr<IPreprocessor> preprocessor = arm_compute::support::cpp14::make_unique<CaffePreproccessor>(mean_rgb);
54 const int target = argc > 1 ? std::strtol(argv[1],
nullptr, 10) : 0;
57 const bool is_opencl = target_hint == Target::CL;
66 std::cout <<
"Usage: " << argv[0] <<
" [target] [path_to_data] [image] [labels] [fast_math_hint]\n\n";
67 std::cout <<
"No data folder provided: using random values\n\n";
71 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" [path_to_data] [image] [labels] [fast_math_hint]\n\n";
72 std::cout <<
"No data folder provided: using random values\n\n";
77 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" [image] [labels] [fast_math_hint]\n\n";
78 std::cout <<
"No image provided: using random values\n\n";
84 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" [labels] [fast_math_hint]\n\n";
85 std::cout <<
"No text file with labels provided: skipping output accessor\n\n";
92 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" " << argv[4] <<
" [fast_math_hint]\n\n";
93 std::cout <<
"No fast math info provided: disabling fast math\n\n";
100 fast_math_hint = (std::strtol(argv[5],
nullptr, 1) == 0) ? FastMathHint::DISABLED : FastMathHint::ENABLED;
104 << first_convolution3x3_hint
113 PadStrideInfo(1, 1, 1, 1))
116 << convolution3x3_hint
121 PadStrideInfo(1, 1, 1, 1))
130 PadStrideInfo(1, 1, 1, 1))
137 PadStrideInfo(1, 1, 1, 1))
146 PadStrideInfo(1, 1, 1, 1))
153 PadStrideInfo(1, 1, 1, 1))
160 PadStrideInfo(1, 1, 1, 1))
167 PadStrideInfo(1, 1, 1, 1))
176 PadStrideInfo(1, 1, 1, 1))
183 PadStrideInfo(1, 1, 1, 1))
190 PadStrideInfo(1, 1, 1, 1))
197 PadStrideInfo(1, 1, 1, 1))
206 PadStrideInfo(1, 1, 1, 1))
213 PadStrideInfo(1, 1, 1, 1))
220 PadStrideInfo(1, 1, 1, 1))
227 PadStrideInfo(1, 1, 1, 1))
257 config.use_tuner = (target == 2);
258 graph.finalize(target_hint, config);
260 void do_run()
override 267 Stream graph{ 0,
"VGG19" };
275 int main(
int argc,
char **argv)
277 return arm_compute::utils::run_example<GraphVGG19Example>(argc, argv);
graph::Target set_target_hint(int target)
Utility function to return the TargetHint.
std::unique_ptr< graph::ITensorAccessor > get_output_accessor(const std::string &labels_path, size_t top_n=5, std::ostream &output_stream=std::cout)
Generates appropriate output accessor according to the specified labels_path.
1 channel, 1 F32 per channel
ConvolutionMethod
Available ConvolutionMethod.
int main(int argc, char **argv)
Main program for VGG19.
std::unique_ptr< graph::ITensorAccessor > get_input_accessor(const std::string &ppm_path, std::unique_ptr< IPreprocessor > preprocessor=nullptr, bool bgr=true)
Generates appropriate input accessor according to the specified ppm_path.
FastMathHint
Enable or disable fast math for Convolution layer.
std::unique_ptr< graph::ITensorAccessor > get_weights_accessor(const std::string &path, const std::string &data_file, DataLayout file_layout=DataLayout::NCHW)
Generates appropriate weights accessor according to the specified path.
Stream frontend class to construct simple graphs in a stream fashion.
ILayer & set_name(std::string name)
Sets the name of the layer.