mirror of https://github.com/AlexeyAB/darknet.git
Fixed mosaic=1 letter_box=1
This commit is contained in:
parent
e455cdef78
commit
8aace65afb
14
src/data.c
14
src/data.c
|
@ -896,7 +896,7 @@ void blend_truth_mosaic(float *new_truth, int boxes, float *old_truth, int w, in
|
|||
int top = (yb - hb / 2)*h;
|
||||
int bot = (yb + hb / 2)*h;
|
||||
|
||||
/*
|
||||
|
||||
{
|
||||
// fix out of Mosaic-bound
|
||||
float left_bound = 0, right_bound = 0, top_bound = 0, bot_bound = 0;
|
||||
|
@ -943,8 +943,8 @@ void blend_truth_mosaic(float *new_truth, int boxes, float *old_truth, int w, in
|
|||
yb = ((float)(bot + top) / 2) / h;
|
||||
hb = ((float)(bot - top)) / h;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
{
|
||||
// fix out of bound
|
||||
if (left < 0) {
|
||||
|
@ -976,6 +976,7 @@ void blend_truth_mosaic(float *new_truth, int boxes, float *old_truth, int w, in
|
|||
top = (yb - hb / 2)*h;
|
||||
bot = (yb + hb / 2)*h;
|
||||
}
|
||||
*/
|
||||
|
||||
// leave only within the image
|
||||
if(left >= 0 && right <= w && top >= 0 && bot <= h &&
|
||||
|
@ -1010,9 +1011,9 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
|
|||
else use_mixup = 3;
|
||||
}
|
||||
if (use_mixup == 3 && letter_box) {
|
||||
printf("\n Combination: letter_box=1 & mosaic=1 - isn't supported, use only 1 of these parameters \n");
|
||||
if (check_mistakes) getchar();
|
||||
exit(0);
|
||||
//printf("\n Combination: letter_box=1 & mosaic=1 - isn't supported, use only 1 of these parameters \n");
|
||||
//if (check_mistakes) getchar();
|
||||
//exit(0);
|
||||
}
|
||||
if (random_gen() % 2 == 0) use_mixup = 0;
|
||||
int i;
|
||||
|
@ -1133,6 +1134,7 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
|
|||
//printf("\n pleft = %d, pright = %d, ptop = %d, pbot = %d, ow = %d, oh = %d \n", pleft, pright, ptop, pbot, ow, oh);
|
||||
|
||||
//float scale = rand_precalc_random(.25, 2, r_scale); // unused currently
|
||||
//printf(" letter_box = %d \n", letter_box);
|
||||
|
||||
if (letter_box)
|
||||
{
|
||||
|
@ -1160,7 +1162,6 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
|
|||
//printf("\n pleft = %d, pright = %d, ptop = %d, pbot = %d, ow = %d, oh = %d \n", pleft, pright, ptop, pbot, ow, oh);
|
||||
}
|
||||
|
||||
/*
|
||||
// move each 2nd image to the corner - so that most of it was visible
|
||||
if (use_mixup == 3 && random_gen() % 2 == 0) {
|
||||
if (flip) {
|
||||
|
@ -1176,7 +1177,6 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int c, int bo
|
|||
if (i_mixup == 3) pleft += pright, pright = 0, ptop += pbot, pbot = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
int swidth = ow - pleft - pright;
|
||||
int sheight = oh - ptop - pbot;
|
||||
|
|
Loading…
Reference in New Issue