Fixed memory leak for ./darknet classifier predict ... < list.txt

pull/6241/head
AlexeyAB 6 years ago
parent 9064755c3b
commit a95bc3f5b6
  1. 6
      src/classifier.c
  2. 1
      src/convolutional_kernels.cu
  3. 10
      src/http_stream.cpp

@ -778,6 +778,7 @@ void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *fi
char *name_list = option_find_str(options, "names", 0);
if(!name_list) name_list = option_find_str(options, "labels", "data/labels.list");
int classes = option_find_int(options, "classes", 2);
printf(" classes = %d, output in cfg = %d \n", classes, net.layers[net.n - 1].c);
if (top == 0) top = option_find_int(options, "top", 1);
if (top > classes) top = classes;
@ -821,8 +822,13 @@ void predict_classifier(char *datacfg, char *cfgfile, char *weightfile, char *fi
}
if(r.data != im.data) free_image(r);
free_image(im);
free_image(resized);
if (filename) break;
}
free(indexes);
free_network(net);
free_list_contents_kvp(options);
free_list(options);
}

@ -394,6 +394,7 @@ void forward_convolutional_layer_gpu(convolutional_layer l, network_state state)
//add_bias_gpu(l.output_gpu, l.biases_gpu, l.batch, l.n, l.out_w*l.out_h);
if (l.activation == SWISH) activate_array_swish_ongpu(l.output_gpu, l.outputs*l.batch, l.activation_input_gpu, l.output_gpu);
else if (l.activation == MISH) activate_array_mish_ongpu(l.output_gpu, l.outputs*l.batch, l.activation_input_gpu, l.output_gpu);
else if (l.activation == NORM_CHAN) activate_array_normalize_channels_ongpu(l.output_gpu, l.outputs*l.batch, l.batch, l.out_c, l.out_w*l.out_h, l.output_gpu);
else if (l.activation != LINEAR && l.activation != LEAKY) activate_array_ongpu(l.output_gpu, l.outputs*l.batch, l.activation);
//if(l.activation != LINEAR && l.activation != LEAKY) activate_array_ongpu(l.output_gpu, l.outputs*l.batch, l.activation);
//if (l.binary || l.xnor) swap_binary(&l);

@ -553,6 +553,15 @@ std::string get_system_frame_time_string()
// ----------------------------------------
#ifdef __CYGWIN__
int send_http_post_request(char *http_post_host, int server_port, char *videosource,
detection *dets, int nboxes, int classes, char **names, long long int frame_id, int ext_output, int timeout)
{
std::cerr << " send_http_post_request() isn't implemented \n";
return 0;
}
#else // __CYGWIN__
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif
@ -620,6 +629,7 @@ int send_http_post_request(char *http_post_host, int server_port, char *videosou
return 0;
}
#endif // __CYGWIN__
#endif // OPENCV

Loading…
Cancel
Save