@@ -51,139 +51,42 @@ int main()
51
51
52
52
bool error = false ;
53
53
54
- for (const auto & model_path : model_paths)
55
- {
54
+ for (const auto & model_path : model_paths) {
56
55
std::cout << " ----" << std::endl;
57
56
std::cout << model_path << std::endl;
58
- #ifdef NDEBUG
59
- try
60
- {
57
+ #ifdef NDEBUG
58
+ try {
61
59
const auto model = fdeep::load_model (model_path, true );
62
60
const std::size_t warm_up_runs = 3 ;
63
61
const std::size_t test_runs = 5 ;
64
- for (std::size_t i = 0 ; i < warm_up_runs; ++i)
65
- {
62
+ for (std::size_t i = 0 ; i < warm_up_runs; ++i) {
66
63
const double duration = model.test_speed ();
67
64
std::cout << " Forward pass took "
68
- << duration << " s." << std::endl;
65
+ << duration << " s." << std::endl;
69
66
}
70
67
double duration_sum = 0 ;
71
68
std::cout << " Starting performance measurements." << std::endl;
72
- for (std::size_t i = 0 ; i < test_runs; ++i)
73
- {
69
+ for (std::size_t i = 0 ; i < test_runs; ++i) {
74
70
const double duration = model.test_speed ();
75
71
duration_sum += duration;
76
72
std::cout << " Forward pass took "
77
- << duration << " s." << std::endl;
73
+ << duration << " s." << std::endl;
78
74
}
79
- const double duration_avg =
80
- duration_sum / static_cast <double >(test_runs);
75
+ const double duration_avg = duration_sum / static_cast <double >(test_runs);
81
76
std::cout << " Forward pass took "
82
- << duration_avg << " s on average." << std::endl;
83
- }
84
- catch (const std::exception & e)
85
- {
86
- std::cerr << " ERROR: " << e.what () << std::endl;
87
- error = true ;
88
- }
89
- #else
90
- const auto model = fdeep::load_model (model_path, true );
91
- #endif
92
- }
93
-
94
- if (error)
95
- {
96
- std::cout << " There were errors." << std::endl;
97
- return 1 ;
98
- }
99
- std::cout << " All imports and test OK." << std::endl;
100
- }std::vector<std::string> model_paths = {
101
- // "convnextbase.json",
102
- // "convnextlarge.json",
103
- // "convnextsmall.json",
104
- // "convnexttiny.json",
105
- // "convnextxlarge.json",
106
- " densenet121.json" ,
107
- " densenet169.json" ,
108
- " densenet201.json" ,
109
- " efficientnetb0.json" ,
110
- " efficientnetb1.json" ,
111
- " efficientnetb2.json" ,
112
- " efficientnetb3.json" ,
113
- " efficientnetb4.json" ,
114
- " efficientnetb5.json" ,
115
- " efficientnetb6.json" ,
116
- " efficientnetb7.json" ,
117
- " efficientnetv2b0.json" ,
118
- " efficientnetv2b1.json" ,
119
- " efficientnetv2b2.json" ,
120
- " efficientnetv2b3.json" ,
121
- " efficientnetv2l.json" ,
122
- " efficientnetv2m.json" ,
123
- " efficientnetv2s.json" ,
124
- // "inceptionresnetv2.json",
125
- " inceptionv3.json" ,
126
- " mobilenet.json" ,
127
- " mobilenetv2.json" ,
128
- " nasnetlarge.json" ,
129
- " nasnetmobile.json" ,
130
- " resnet101.json" ,
131
- " resnet101v2.json" ,
132
- " resnet152.json" ,
133
- " resnet152v2.json" ,
134
- " resnet50.json" ,
135
- " resnet50v2.json" ,
136
- " vgg16.json" ,
137
- " vgg19.json" ,
138
- " xception.json"
139
- };
140
-
141
- bool error = false ;
142
-
143
- for (const auto & model_path : model_paths)
144
- {
145
- std::cout << " ----" << std::endl;
146
- std::cout << model_path << std::endl;
147
- #ifdef NDEBUG
148
- try
149
- {
150
- const auto model = fdeep::load_model (model_path, true );
151
- const std::size_t warm_up_runs = 3 ;
152
- const std::size_t test_runs = 5 ;
153
- for (std::size_t i = 0 ; i < warm_up_runs; ++i)
154
- {
155
- const double duration = model.test_speed ();
156
- std::cout << " Forward pass took "
157
- << duration << " s." << std::endl;
158
- }
159
- double duration_sum = 0 ;
160
- std::cout << " Starting performance measurements." << std::endl;
161
- for (std::size_t i = 0 ; i < test_runs; ++i)
162
- {
163
- const double duration = model.test_speed ();
164
- duration_sum += duration;
165
- std::cout << " Forward pass took "
166
- << duration << " s." << std::endl;
167
- }
168
- const double duration_avg =
169
- duration_sum / static_cast <double >(test_runs);
170
- std::cout << " Forward pass took "
171
- << duration_avg << " s on average." << std::endl;
172
- }
173
- catch (const std::exception & e)
174
- {
77
+ << duration_avg << " s on average." << std::endl;
78
+ } catch (const std::exception & e) {
175
79
std::cerr << " ERROR: " << e.what () << std::endl;
176
80
error = true ;
177
81
}
178
- #else
179
- const auto model = fdeep::load_model (model_path, true );
180
- #endif
82
+ #else
83
+ const auto model = fdeep::load_model (model_path, true );
84
+ #endif
181
85
}
182
86
183
- if (error)
184
- {
87
+ if (error) {
185
88
std::cout << " There were errors." << std::endl;
186
89
return 1 ;
187
90
}
188
91
std::cout << " All imports and test OK." << std::endl;
189
- }
92
+ }
0 commit comments