From ac2f54af5ec74de6dd0027618b0c7bcc26e5b772 Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Tue, 14 Mar 2017 09:38:06 +0000
Subject: [PATCH] Update Readme.md

---
 src/data.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/data.c b/src/data.c
index a2390a9..311f882 100644
--- a/src/data.c
+++ b/src/data.c
@@ -39,16 +39,23 @@
 }
 */
 
+int mt_seed = 0;
+
 char **get_random_paths(char **paths, int n, int m)
 {
     char **random_paths = calloc(n, sizeof(char*));
     int i;
     pthread_mutex_lock(&mutex);
-    for(i = 0; i < n; ++i){
-        int index = rand()%m;
+	if (mt_seed == 0) mt_seed = time(0);
+	srand(mt_seed);
+	//printf("n = %d \n", n);
+    for(i = 0; i < n; ++i){		
+        int index = rand()%m;		
         random_paths[i] = paths[index];
         //if(i == 0) printf("%s\n", paths[index]);
+		//printf("grp: %s\n", paths[index]);
     }
+	mt_seed = rand();
     pthread_mutex_unlock(&mutex);
     return random_paths;
 }
@@ -171,6 +178,13 @@
 {
     int i;
     for(i = 0; i < n; ++i){
+        if(boxes[i].x == 0 && boxes[i].y == 0) {
+            boxes[i].x = 999999;
+            boxes[i].y = 999999;
+            boxes[i].w = 999999;
+            boxes[i].h = 999999;
+            continue;
+        }
         boxes[i].left   = boxes[i].left  * sx - dx;
         boxes[i].right  = boxes[i].right * sx - dx;
         boxes[i].top    = boxes[i].top   * sy - dy;
@@ -289,6 +303,7 @@
     find_replace(path, "images", "labels", labelpath);
     find_replace(labelpath, "JPEGImages", "labels", labelpath);
 
+    find_replace(labelpath, "raw", "labels", labelpath);
     find_replace(labelpath, ".jpg", ".txt", labelpath);
     find_replace(labelpath, ".png", ".txt", labelpath);
     find_replace(labelpath, ".JPG", ".txt", labelpath);
@@ -309,7 +324,7 @@
         h =  boxes[i].h;
         id = boxes[i].id;
 
-        if (w < .01 || h < .01) continue;
+        if ((w < .01 || h < .01)) continue;
 
         truth[i*5+0] = x;
         truth[i*5+1] = y;
@@ -706,6 +721,7 @@
 
 void *load_thread(void *ptr)
 {
+	srand(time(0));
     //printf("Loading data: %d\n", rand());
     load_args a = *(struct load_args*)ptr;
     if(a.exposure == 0) a.exposure = 1;
@@ -749,6 +765,7 @@
 
 void *load_threads(void *ptr)
 {
+	srand(time(0));
     int i;
     load_args args = *(load_args *)ptr;
     if (args.threads == 0) args.threads = 1;

--
Gitblit v1.10.0