42 class GraphAlexnetExample :
public Example 45 void do_setup(
int argc,
char **argv)
override 47 std::string data_path;
52 const std::array<float, 3> mean_rgb{ { 122.68f, 116.67f, 104.01f } };
53 std::unique_ptr<IPreprocessor> preprocessor = arm_compute::support::cpp14::make_unique<CaffePreproccessor>(mean_rgb);
56 const int target = argc > 1 ? std::strtol(argv[1],
nullptr, 10) : 0;
59 const bool is_neon = (target_hint == Target::NEON);
68 std::cout <<
"Usage: " << argv[0] <<
" [target] [path_to_data] [image] [labels] [fast_math_hint]\n\n";
69 std::cout <<
"No data folder provided: using random values\n\n";
73 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" [path_to_data] [image] [labels] [fast_math_hint]\n\n";
74 std::cout <<
"No data folder provided: using random values\n\n";
79 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" [image] [labels] [fast_math_hint]\n\n";
80 std::cout <<
"No image provided: using random values\n\n";
86 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" [labels] [fast_math_hint]\n\n";
87 std::cout <<
"No text file with labels provided: skipping output accessor\n\n";
94 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" " << argv[4] <<
" [fast_math_hint]\n\n";
95 std::cout <<
"No fast math info provided: disabling fast math\n\n";
102 fast_math_hint = (std::strtol(argv[5],
nullptr, 1) == 0) ? FastMathHint::DISABLED : FastMathHint::ENABLED;
114 PadStrideInfo(4, 4, 0, 0))
120 << convolution_5x5_hint
125 PadStrideInfo(1, 1, 2, 2), 2)
130 << convolution_3x3_hint
136 PadStrideInfo(1, 1, 1, 1))
144 PadStrideInfo(1, 1, 1, 1), 2)
152 PadStrideInfo(1, 1, 1, 1), 2)
182 config.use_tuner = (target == 2);
183 graph.finalize(target_hint, config);
185 void do_run()
override 192 Stream graph{ 0,
"AlexNet" };
200 int main(
int argc,
char **argv)
202 return arm_compute::utils::run_example<GraphAlexnetExample>(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.
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.
int main(int argc, char **argv)
Main program for AlexNet.
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.
Normalization applied cross maps.
ILayer & set_name(std::string name)
Sets the name of the layer.