added free_alphabet function; this function used for free alphabet. (#1805)

This commit is contained in:
umbralada 2023-09-02 00:15:01 +03:00 committed by GitHub
parent 30b044abd6
commit ac4e765a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 23 deletions

View File

@ -374,10 +374,9 @@ void test_coco(char *cfgfile, char *weightfile, char *filename, float thresh)
show_image(im, "predictions");
free_image(im);
free_image(sized);
free_alphabet(alphabet);
wait_until_press_key_cv();
destroy_all_windows_cv();
if (filename) break;
}
free(boxes);

View File

@ -413,14 +413,7 @@ void demo(char *cfgfile, char *weightfile, float thresh, float hier_thresh, int
free_ptrs((void **)names, net.layers[net.n - 1].classes);
const int nsize = 8;
for (j = 0; j < nsize; ++j) {
for (i = 32; i < 127; ++i) {
free_image(alphabet[j][i]);
}
free(alphabet[j]);
}
free(alphabet);
free_alphabet(alphabet);
free_network(net);
//cudaProfilerStop();
}

View File

@ -1778,17 +1778,7 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
free_ptrs((void**)names, net.layers[net.n - 1].classes);
free_list_contents_kvp(options);
free_list(options);
int i;
const int nsize = 8;
for (j = 0; j < nsize; ++j) {
for (i = 32; i < 127; ++i) {
free_image(alphabet[j][i]);
}
free(alphabet[j]);
}
free(alphabet);
free_alphabet(alphabet);
free_network(net);
}

View File

@ -280,6 +280,19 @@ image **load_alphabet()
return alphabets;
}
void free_alphabet(image **alphabet)
{
int i, j;
const int nsize = 8;
for (j = 0; j < nsize; ++j) {
for (i = 32; i < 127; ++i) {
free_image(alphabet[j][i]);
}
free(alphabet[j]);
}
free(alphabet);
}
// Creates array of detections with prob > thresh and fills best_class for them

View File

@ -88,6 +88,7 @@ image load_image(char *filename, int w, int h, int c);
image load_image_stb_resize(char *filename, int w, int h, int c);
//LIB_API image load_image_color(char *filename, int w, int h);
image **load_alphabet();
void free_alphabet(image **alphabet);
//float get_pixel(image m, int x, int y, int c);
//float get_pixel_extend(image m, int x, int y, int c);

View File

@ -328,11 +328,11 @@ void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
free_image(im);
free_image(sized);
free_alphabet(alphabet);
wait_until_press_key_cv();
destroy_all_windows_cv();
if (filename) break;
if (filename) break;
}
free(boxes);
for(j = 0; j < l.side*l.side*l.n; ++j) {