diff --git a/src/data.c b/src/data.c index 8fb1a258..19dca8a9 100644 --- a/src/data.c +++ b/src/data.c @@ -44,10 +44,12 @@ char **get_random_paths(char **paths, int n, int m) char **random_paths = calloc(n, sizeof(char*)); int i; pthread_mutex_lock(&mutex); + //printf("n = %d \n", n); for(i = 0; i < n; ++i){ - int index = rand()%m; + int index = (rand()*rand())%m; random_paths[i] = paths[index]; //if(i == 0) printf("%s\n", paths[index]); + //printf("%s\n", paths[index]); } pthread_mutex_unlock(&mutex); return random_paths; @@ -714,6 +716,7 @@ data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, in 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; @@ -757,6 +760,7 @@ pthread_t load_data_in_thread(load_args args) void *load_threads(void *ptr) { + srand(time(0)); int i; load_args args = *(load_args *)ptr; if (args.threads == 0) args.threads = 1; diff --git a/src/detector.c b/src/detector.c index a389407a..7535df84 100644 --- a/src/detector.c +++ b/src/detector.c @@ -78,7 +78,7 @@ void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, i int count = 0; //while(i*imgs < N*120){ while(get_current_batch(net) < net.max_batches){ - if(l.random && count++%10 == 0){ + if(l.random && count++%10 == 0){ printf("Resizing\n"); int dim = (rand() % 10 + 10) * 32; if (get_current_batch(net)+100 > net.max_batches) dim = 544;