Fixed blur= parameter for train detector

This commit is contained in:
AlexeyAB 2019-12-04 02:02:22 +03:00
parent 5d0352f961
commit 649abac372
2 changed files with 8 additions and 4 deletions

View File

@ -882,10 +882,10 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
flip = use_flip ? random_gen() % 2 : 0; flip = use_flip ? random_gen() % 2 : 0;
//blur = rand_int(0, 1) ? (use_blur) : 0;
int tmp_blur = rand_int(0, 2); // 0 - disable, 1 - blur background, 2 - blur the whole image int tmp_blur = rand_int(0, 2); // 0 - disable, 1 - blur background, 2 - blur the whole image
if (tmp_blur == 2) blur = use_blur; if (tmp_blur == 0) blur = 0;
else blur = tmp_blur; else if (tmp_blur == 1) blur = 1;
else blur = use_blur;
} }
int pleft = rand_precalc_random(-dw, dw, r1); int pleft = rand_precalc_random(-dw, dw, r1);
@ -935,7 +935,7 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
if (min_w_h / 8 < blur && blur > 1) blur = min_w_h / 8; // disable blur if one of the objects is too small if (min_w_h / 8 < blur && blur > 1) blur = min_w_h / 8; // disable blur if one of the objects is too small
image ai = image_data_augmentation(src, w, h, pleft, ptop, swidth, sheight, flip, dhue, dsat, dexp, image ai = image_data_augmentation(src, w, h, pleft, ptop, swidth, sheight, flip, dhue, dsat, dexp,
blur, boxes, d.y.vals[i]); blur, boxes, truth);
if (i_mixup) { if (i_mixup) {
image old_img = ai; image old_img = ai;

View File

@ -1236,6 +1236,10 @@ image image_data_augmentation(mat_cv* mat, int w, int h,
dst.copyTo(sized); dst.copyTo(sized);
} }
//char txt[100];
//sprintf(txt, "blur = %d", blur);
//cv::putText(sized, txt, cv::Point(100, 100), cv::FONT_HERSHEY_COMPLEX_SMALL, 1.7, CV_RGB(255, 0, 0), 1, CV_AA);
// Mat -> image // Mat -> image
out = mat_to_image(sized); out = mat_to_image(sized);
} }