Skip to content

Commit

Permalink
Fixed mosaic=1 letter_box=1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAB committed Jun 1, 2020
1 parent e455cde commit 8aace65
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 8aace65

Please sign in to comment.