42 class GraphSqueezenetExample :
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;
64 std::cout <<
"Usage: " << argv[0] <<
" [target] [path_to_data] [image] [labels] [fast_math_hint]\n\n";
65 std::cout <<
"No data folder provided: using random values\n\n";
69 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" [path_to_data] [image] [labels] [fast_math_hint]\n\n";
70 std::cout <<
"No data folder provided: using random values\n\n";
75 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" [image] [labels] [fast_math_hint]\n\n";
76 std::cout <<
"No image provided: using random values\n\n";
82 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" [labels] [fast_math_hint]\n\n";
83 std::cout <<
"No text file with labels provided: skipping output accessor\n\n";
90 std::cout <<
"Usage: " << argv[0] <<
" " << argv[1] <<
" " << argv[2] <<
" " << argv[3] <<
" " << argv[4] <<
" [fast_math_hint]\n\n";
91 std::cout <<
"No fast math info provided: disabling fast math\n\n";
98 fast_math_hint = (std::strtol(argv[5],
nullptr, 1) == 0) ? FastMathHint::DISABLED : FastMathHint::ENABLED;
109 PadStrideInfo(2, 2, 0, 0))
116 PadStrideInfo(1, 1, 0, 0))
118 graph << get_expand_fire_node(data_path,
"fire2", 64U, 64U);
123 PadStrideInfo(1, 1, 0, 0))
125 graph << get_expand_fire_node(data_path,
"fire3", 64U, 64U);
130 PadStrideInfo(1, 1, 0, 0))
132 graph << get_expand_fire_node(data_path,
"fire4", 128U, 128U);
138 PadStrideInfo(1, 1, 0, 0))
140 graph << get_expand_fire_node(data_path,
"fire5", 128U, 128U);
145 PadStrideInfo(1, 1, 0, 0))
147 graph << get_expand_fire_node(data_path,
"fire6", 192U, 192U);
152 PadStrideInfo(1, 1, 0, 0))
154 graph << get_expand_fire_node(data_path,
"fire7", 192U, 192U);
159 PadStrideInfo(1, 1, 0, 0))
161 graph << get_expand_fire_node(data_path,
"fire8", 256U, 256U);
167 PadStrideInfo(1, 1, 0, 0))
169 graph << get_expand_fire_node(data_path,
"fire9", 256U, 256U);
174 PadStrideInfo(1, 1, 0, 0))
183 config.use_tuner = (target == 2);
184 graph.finalize(target_hint, config);
186 void do_run()
override 193 Stream graph{ 0,
"SqueezeNetV1" };
195 BranchLayer get_expand_fire_node(
const std::string &data_path, std::string &¶m_path,
unsigned int expand1_filt,
unsigned int expand3_filt)
197 std::string total_path =
"/cnn_data/squeezenet_v1.0_model/" + param_path +
"_";
200 1U, 1U, expand1_filt,
203 PadStrideInfo(1, 1, 0, 0))
208 3U, 3U, expand3_filt,
211 PadStrideInfo(1, 1, 1, 1))
214 return BranchLayer(BranchMergeMethod::DEPTH_CONCATENATE, std::move(i_a), std::move(i_b));
223 int main(
int argc,
char **argv)
225 return arm_compute::utils::run_example<GraphSqueezenetExample>(argc, argv);
graph::Target set_target_hint(int target)
Utility function to return the TargetHint.
int main(int argc, char **argv)
Main program for Squeezenet v1.0.
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
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.