fixed bug: rand() for batches of images

This commit is contained in:
AlexeyAB 2017-01-10 19:49:38 +03:00
parent b5938098d1
commit b831db5e58
2 changed files with 6 additions and 2 deletions

View File

@ -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;