diff --git a/src/classifier.c b/src/classifier.c index 33540e3d..b7976c45 100644 --- a/src/classifier.c +++ b/src/classifier.c @@ -214,6 +214,9 @@ void train_classifier(char *datacfg, char *cfgfile, char *weightfile, int *gpus, free_ptrs((void**)paths, plist->size); free_list(plist); free(base); + + free_list_contents_kvp(options); + free_list(options); } diff --git a/src/data.c b/src/data.c index 71d31d56..7c964398 100644 --- a/src/data.c +++ b/src/data.c @@ -1499,7 +1499,18 @@ data load_data_augment(char **paths, int n, int m, char **labels, int k, tree *h const int top = cut_y; const int bot = cut_y + cut_h; - const float alpha = (float)(right - left)*(bot - top) / (float)(w*h); + assert(cut_x >= 0 && cut_x <= w); + assert(cut_y >= 0 && cut_y <= h); + assert(cut_w >= 0 && cut_w <= w); + assert(cut_h >= 0 && cut_h <= h); + + assert(right >= 0 && right <= w); + assert(bot >= 0 && bot <= h); + + assert(top <= bot); + assert(left <= right); + + const float alpha = (float)(cut_w*cut_h) / (float)(w*h); const float beta = 1 - alpha; int c, x, y;