MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / parse_convolutional

Function parse_convolutional

src/Detector/darknet/src/parser.c:169–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169convolutional_layer parse_convolutional(list *options, size_params params)
170{
171 int n = option_find_int(options, "filters",1);
172 int groups = option_find_int_quiet(options, "groups", 1);
173 int size = option_find_int(options, "size",1);
174 int stride = -1;
175 //int stride = option_find_int(options, "stride",1);
176 int stride_x = option_find_int_quiet(options, "stride_x", -1);
177 int stride_y = option_find_int_quiet(options, "stride_y", -1);
178 if (stride_x < 1 || stride_y < 1) {
179 stride = option_find_int(options, "stride", 1);
180 if (stride_x < 1) stride_x = stride;
181 if (stride_y < 1) stride_y = stride;
182 }
183 else {
184 stride = option_find_int_quiet(options, "stride", 1);
185 }
186 int dilation = option_find_int_quiet(options, "dilation", 1);
187 int antialiasing = option_find_int_quiet(options, "antialiasing", 0);
188 if (size == 1) dilation = 1;
189 int pad = option_find_int_quiet(options, "pad",0);
190 int padding = option_find_int_quiet(options, "padding",0);
191 if(pad) padding = size/2;
192
193 char *activation_s = option_find_str(options, "activation", "logistic");
194 ACTIVATION activation = get_activation(activation_s);
195
196 int assisted_excitation = option_find_float_quiet(options, "assisted_excitation", 0);
197
198 int share_index = option_find_int_quiet(options, "share_index", -1000000000);
199 convolutional_layer *share_layer = NULL;
200 if(share_index >= 0) share_layer = &params.net.layers[share_index];
201 else if(share_index != -1000000000) share_layer = &params.net.layers[params.index + share_index];
202
203 int batch,h,w,c;
204 h = params.h;
205 w = params.w;
206 c = params.c;
207 batch=params.batch;
208 if(!(h && w && c)) error("Layer before convolutional layer must output image.", DARKNET_LOC);
209 int batch_normalize = option_find_int_quiet(options, "batch_normalize", 0);
210 int cbn = option_find_int_quiet(options, "cbn", 0);
211 if (cbn) batch_normalize = 2;
212 int binary = option_find_int_quiet(options, "binary", 0);
213 int xnor = option_find_int_quiet(options, "xnor", 0);
214 int use_bin_output = option_find_int_quiet(options, "bin_output", 0);
215 int sway = option_find_int_quiet(options, "sway", 0);
216 int rotate = option_find_int_quiet(options, "rotate", 0);
217 int stretch = option_find_int_quiet(options, "stretch", 0);
218 int stretch_sway = option_find_int_quiet(options, "stretch_sway", 0);
219 if ((sway + rotate + stretch + stretch_sway) > 1) {
220 error("Error: should be used only 1 param: sway=1, rotate=1 or stretch=1 in the [convolutional] layer", DARKNET_LOC);
221 }
222 int deform = sway || rotate || stretch || stretch_sway;
223 if (deform && size == 1) {
224 error("Error: params (sway=1, rotate=1 or stretch=1) should be used only with size >=3 in the [convolutional] layer", DARKNET_LOC);
225 }
226

Callers 1

parse_network_cfg_customFunction · 0.85

Calls 7

option_find_intFunction · 0.85
option_find_int_quietFunction · 0.85
option_find_strFunction · 0.85
get_activationFunction · 0.85
option_find_float_quietFunction · 0.85
errorFunction · 0.85
make_convolutional_layerFunction · 0.85

Tested by

no test coverage detected