From 552207d6f0af585960c9c43e6a6d7c53fb4ae6bd Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Fri, 17 Aug 2018 16:58:05 +0000
Subject: [PATCH] Minor fix

---
 src/data.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/data.c b/src/data.c
index 2a0a7e9..46f86c1 100644
--- a/src/data.c
+++ b/src/data.c
@@ -320,6 +320,7 @@
     if (count > num_boxes) count = num_boxes;
     float x, y, w, h;
     int id;
+    int sub = 0;
 
     for (i = 0; i < count; ++i) {
         x = boxes[i].x;
@@ -337,23 +338,27 @@
             sprintf(buff, "echo %s \"Wrong annotation: class_id = %d. But class_id should be [from 0 to %d]\" >> bad_label.list", labelpath, id, classes);
             system(buff);
             getchar();
+            ++sub;
             continue;
         }
         if ((w < lowest_w || h < lowest_h)) {
             //sprintf(buff, "echo %s \"Very small object: w < lowest_w OR h < lowest_h\" >> bad_label.list", labelpath);
             //system(buff);
+            ++sub;
             continue;
         }
         if (x == 999999 || y == 999999) {
             printf("\n Wrong annotation: x = 0, y = 0 \n");
             sprintf(buff, "echo %s \"Wrong annotation: x = 0 or y = 0\" >> bad_label.list", labelpath);
             system(buff);
+            ++sub;
             continue;
         }
         if (x <= 0 || x > 1 || y <= 0 || y > 1) {
             printf("\n Wrong annotation: x = %f, y = %f \n", x, y);
             sprintf(buff, "echo %s \"Wrong annotation: x = %f, y = %f\" >> bad_label.list", labelpath, x, y);
             system(buff);
+            ++sub;
             continue;
         }
         if (w > 1) {
@@ -371,11 +376,11 @@
         if (x == 0) x += lowest_w;
         if (y == 0) y += lowest_h;
 
-        truth[i*5+0] = x;
-        truth[i*5+1] = y;
-        truth[i*5+2] = w;
-        truth[i*5+3] = h;
-        truth[i*5+4] = id;
+        truth[(i-sub)*5+0] = x;
+        truth[(i-sub)*5+1] = y;
+        truth[(i-sub)*5+2] = w;
+        truth[(i-sub)*5+3] = h;
+        truth[(i-sub)*5+4] = id;
     }
     free(boxes);
 }
@@ -784,7 +789,7 @@
 
         image ai = image_data_augmentation(src, w, h, pleft, ptop, swidth, sheight, flip, jitter, dhue, dsat, dexp);
         d.X.vals[i] = ai.data;
-        
+
         //show_image(ai, "aug");
         //cvWaitKey(0);
 

--
Gitblit v1.10.0