10 pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER;
15 FILE *file = fopen(filename,
"r");
18 while((path=
fgetl(file))){
44 char **random_paths = calloc(n,
sizeof(
char*));
46 pthread_mutex_lock(&
mutex);
47 for(i = 0; i < n; ++i){
49 random_paths[i] = paths[index];
52 pthread_mutex_unlock(&
mutex);
58 char **replace_paths = calloc(n,
sizeof(
char*));
60 for(i = 0; i < n; ++i){
73 X.
vals = calloc(X.
rows,
sizeof(
float*));
76 for(i = 0; i < n; ++i){
94 X.
vals = calloc(X.
rows,
sizeof(
float*));
97 for(i = 0; i < n; ++i){
105 matrix load_image_augment_paths(
char **paths,
int n,
int min,
int max,
int size,
float angle,
float aspect,
float hue,
float saturation,
float exposure,
int center)
110 X.
vals = calloc(X.
rows,
sizeof(
float*));
113 for(i = 0; i < n; ++i){
141 FILE *file = fopen(filename,
"r");
148 while(fscanf(file,
"%d %f %f %f %f", &
id, &x, &y, &w, &h) == 5){
151 boxes = realloc(boxes, size*
sizeof(
box_label));
153 boxes[count].
id = id;
158 boxes[count].
left = x - w/2;
159 boxes[count].
right = x + w/2;
160 boxes[count].
top = y - h/2;
161 boxes[count].
bottom = y + h/2;
172 for(i = 0; i < n; ++i){
174 int index = rand()%n;
183 for(i = 0; i < n; ++i){
184 if(boxes[i].x == 0 && boxes[i].y == 0) {
191 boxes[i].
left = boxes[i].
left * sx - dx;
193 boxes[i].
top = boxes[i].
top * sy - dy;
197 float swap = boxes[i].
left;
199 boxes[i].
right = 1. - swap;
207 boxes[i].
x = (boxes[i].
left+boxes[i].
right)/2;
208 boxes[i].
y = (boxes[i].
top+boxes[i].
bottom)/2;
209 boxes[i].
w = (boxes[i].
right - boxes[i].
left);
210 boxes[i].
h = (boxes[i].
bottom - boxes[i].
top);
219 char labelpath[4096];
221 find_replace(labelpath,
"JPEGImages",
"labels", labelpath);
234 for (i = 0; i < count && i < 90; ++i) {
241 if (w < .0 || h < .0)
continue;
250 if (
id < classes) truth[index+id] = 1;
257 char labelpath[4096];
259 find_replace(labelpath,
"JPEGImages",
"labels", labelpath);
273 for (i = 0; i < count; ++i) {
280 if (w < .005 || h < .005)
continue;
282 int col = (int)(x*num_boxes);
283 int row = (int)(y*num_boxes);
285 x = x*num_boxes - col;
286 y = y*num_boxes - row;
288 int index = (col+row*num_boxes)*(5+classes);
289 if (truth[index])
continue;
292 if (
id < classes) truth[index+id] = 1;
308 for(i = 0; i < n; ++i){
309 for(j = 0; j < rle[i]; ++j){
310 im.
data[count++] = curr;
314 for(; count < im.
h*im.
w*im.
c; ++count){
315 im.
data[count] = curr;
322 for(i = 0; i < src.
w*src.
h; ++i){
323 if(src.
data[i]) dest.
data[dest.
w*dest.
h*c + i] = 1;
331 for(k = 0; k < src.
c-1; ++k){
332 for(i = 0; i < s; ++i){
333 if (src.
data[k*s + i]){
334 for(j = k+1; j < src.
c; ++j){
335 src.
data[j*s + i] = 0;
349 for(y = 0; y < im.
h; ++y){
350 for(x = 0; x < im.
w; ++x){
351 if(im.
data[y*im.
w + x]){
352 minx = (x < minx) ? x : minx;
353 miny = (y < miny) ? y : miny;
354 maxx = (x > maxx) ? x : maxx;
355 maxy = (y > maxy) ? y : maxy;
359 box b = {minx, miny, maxx-minx + 1, maxy-miny + 1};
366 char labelpath[4096];
368 find_replace(labelpath,
"JPEGImages",
"mask", labelpath);
372 FILE *file = fopen(labelpath,
"r");
379 while((fscanf(file,
"%d %s", &
id, buff) == 2) && i < num_boxes){
387 truth[i*(mw*mh+1)] =
id;
388 for(j = 0; j < mw*mh; ++j){
389 truth[i*(mw*mh + 1) + 1 + j] = mask.
data[j];
397 if(i < num_boxes) truth[i*(mw*mh+1)] = -1;
404 char labelpath[4096];
406 find_replace(labelpath,
"JPEGImages",
"mask", labelpath);
410 FILE *file = fopen(labelpath,
"r");
416 while((fscanf(file,
"%d %s", &
id, buff) == 2) && i < num_boxes){
426 truth[i*(4 + mw*mh + 1) + 0] = (b.
x + b.
w/2.)/sized.
w;
427 truth[i*(4 + mw*mh + 1) + 1] = (b.
y + b.
h/2.)/sized.
h;
428 truth[i*(4 + mw*mh + 1) + 2] = b.
w/sized.
w;
429 truth[i*(4 + mw*mh + 1) + 3] = b.
h/sized.
h;
431 for(j = 0; j < mw*mh; ++j){
432 truth[i*(4 + mw*mh + 1) + 4 + j] = mask.
data[j];
434 truth[i*(4 + mw*mh + 1) + 4 + mw*mh] =
id;
449 char labelpath[4096];
451 find_replace(labelpath,
"JPEGImages",
"labels", labelpath);
462 if(count > num_boxes) count = num_boxes;
468 for (i = 0; i < count; ++i) {
475 if ((w < .001 || h < .001)) {
480 truth[(i-sub)*5+0] = x;
481 truth[(i-sub)*5+1] = y;
482 truth[(i-sub)*5+2] = w;
483 truth[(i-sub)*5+3] = h;
484 truth[(i-sub)*5+4] =
id;
494 for(i = 0; i < n; ++i){
503 char *begin = strrchr(path,
'/');
506 for(i = 0; i < strlen(begin) && i < n && begin[i] !=
'.'; ++i){
508 if(index > 35) printf(
"Bad %c\n", begin[i]);
524 for(i = 0; i < n; ++i){
543 void fill_truth(
char *path,
char **labels,
int k,
float *truth)
546 memset(truth, 0, k*
sizeof(
float));
548 for(i = 0; i < k; ++i){
549 if(strstr(path, labels[i])){
555 if(count != 1 && (k != 1 || count != 0)) printf(
"Too many or too few labels: %d, %s\n", count, path);
561 for(j = 0; j < k; ++j){
563 int parent = hierarchy->
parent[j];
566 parent = hierarchy->
parent[parent];
572 for(j = 0; j < hierarchy->
groups; ++j){
575 for(i = 0; i < hierarchy->
group_size[j]; ++i){
576 if(truth[count + i]){
582 for(i = 0; i < hierarchy->
group_size[j]; ++i){
594 for(i = 0; i < n; ++i){
595 char labelpath[4096];
597 find_replace(labelpath,
"JPEGImages",
"labels", labelpath);
611 FILE *file = fopen(labelpath,
"r");
612 for(j = 0; j < k; ++j){
613 fscanf(file,
"%f", &(y.
vals[i][j]));
624 for(i = 0; i < n && labels; ++i){
638 for(i = 0; i < n; ++i){
642 FILE *file = fopen(label,
"r");
646 while(fscanf(file,
"%d", &tag) == 1){
678 char labelpath[4096];
680 find_replace(labelpath,
"JPEGImages",
"mask", labelpath);
685 FILE *file = fopen(labelpath,
"r");
690 while(fscanf(file,
"%d %s", &
id, buff) == 2){
705 char labelpath[4096];
707 find_replace(labelpath,
"JPEGImages",
"mask", labelpath);
713 for(i = 0; i < w*h; ++i){
714 mask.
data[w*h*classes + i] = 1;
716 FILE *file = fopen(labelpath,
"r");
721 while(fscanf(file,
"%d %s", &
id, buff) == 2){
726 for(i = 0; i < w*h; ++i){
727 if(part.
data[i]) mask.
data[w*h*classes + i] = 0;
737 data load_data_seg(
int n,
char **paths,
int m,
int w,
int h,
int classes,
int min,
int max,
float angle,
float aspect,
float hue,
float saturation,
float exposure,
int div)
750 d.
y.
cols = h*w*classes/div/div;
753 for(i = 0; i < n; ++i){
785 data load_data_iseg(
int n,
char **paths,
int m,
int w,
int h,
int classes,
int boxes,
int div,
int min,
int max,
float angle,
float aspect,
float hue,
float saturation,
float exposure)
798 for(i = 0; i < n; ++i){
825 data load_data_mask(
int n,
char **paths,
int m,
int w,
int h,
int classes,
int boxes,
int coords,
int min,
int max,
float angle,
float aspect,
float hue,
float saturation,
float exposure)
838 for(i = 0; i < n; ++i){
865 data load_data_region(
int n,
char **paths,
int m,
int w,
int h,
int size,
int classes,
float jitter,
float hue,
float saturation,
float exposure)
879 for(i = 0; i < n; ++i){
885 int dw = (ow*jitter);
886 int dh = (oh*jitter);
893 int swidth = ow - pleft - pright;
894 int sheight = oh - ptop - pbot;
896 float sx = (float)swidth / ow;
897 float sy = (float)sheight / oh;
902 float dx = ((float)pleft/ow)/sx;
903 float dy = ((float)ptop /oh)/sy;
932 for(i = 0; i < n; ++i){
936 d.
X.
vals[i] = calloc(d.
X.
cols,
sizeof(
float));
937 memcpy(d.
X.
vals[i], im1.
data, h*w*3*
sizeof(
float));
938 memcpy(d.
X.
vals[i] + h*w*3, im2.
data, h*w*3*
sizeof(
float));
947 FILE *fp1 = fopen(imlabel1,
"r");
949 while(fscanf(fp1,
"%d %f", &
id, &iou) == 2){
950 if (d.
y.
vals[i][2*
id] < iou) d.
y.
vals[i][2*id] = iou;
955 FILE *fp2 = fopen(imlabel2,
"r");
957 while(fscanf(fp2,
"%d %f", &
id, &iou) == 2){
958 if (d.
y.
vals[i][2*
id + 1] < iou) d.
y.
vals[i][2*
id + 1] = iou;
962 if (d.
y.
vals[i][2*j] > .5 && d.
y.
vals[i][2*j+1] < .5){
963 d.
y.
vals[i][2*j] = 1;
964 d.
y.
vals[i][2*j+1] = 0;
965 }
else if (d.
y.
vals[i][2*j] < .5 && d.
y.
vals[i][2*j+1] > .5){
966 d.
y.
vals[i][2*j] = 0;
967 d.
y.
vals[i][2*j+1] = 1;
985 int index = rand()%n;
986 char *random_path = paths[index];
1012 int swidth = w - pleft - pright;
1013 int sheight = h - ptop - pbot;
1015 float sx = (float)swidth / w;
1016 float sy = (float)sheight / h;
1018 int flip = rand()%2;
1021 float dx = ((float)pleft/w)/sx;
1022 float dy = ((float)ptop /h)/sy;
1036 data load_data_detection(
int n,
char **paths,
int m,
int w,
int h,
int boxes,
int classes,
float jitter,
float hue,
float saturation,
float exposure)
1048 for(i = 0; i < n; ++i){
1053 float dw = jitter * orig.
w;
1054 float dh = jitter * orig.
h;
1077 int flip = rand()%2;
1101 *a.
d =
load_data_regression(a.
paths, a.
n, a.
m, a.
classes, a.
min, a.
max, a.
size, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure);
1103 *a.
d =
load_data_augment(a.
paths, a.
n, a.
m, a.
labels, a.
classes, a.
hierarchy, a.
min, a.
max, a.
size, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure, a.
center);
1109 *a.
d =
load_data_iseg(a.
n, a.
paths, a.
m, a.
w, a.
h, a.
classes, a.
num_boxes, a.
scale, a.
min, a.
max, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure);
1111 *a.
d =
load_data_mask(a.
n, a.
paths, a.
m, a.
w, a.
h, a.
classes, a.
num_boxes, a.
coords, a.
min, a.
max, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure);
1113 *a.
d =
load_data_seg(a.
n, a.
paths, a.
m, a.
w, a.
h, a.
classes, a.
min, a.
max, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure, a.
scale);
1115 *a.
d =
load_data_region(a.
n, a.
paths, a.
m, a.
w, a.
h, a.
num_boxes, a.
classes, a.
jitter, a.
hue, a.
saturation, a.
exposure);
1117 *a.
d =
load_data_detection(a.
n, a.
paths, a.
m, a.
w, a.
h, a.
num_boxes, a.
classes, a.
jitter, a.
hue, a.
saturation, a.
exposure);
1129 *a.
d =
load_data_tag(a.
paths, a.
n, a.
m, a.
classes, a.
min, a.
max, a.
size, a.
angle, a.
aspect, a.
hue, a.
saturation, a.
exposure);
1140 if(pthread_create(&thread, 0,
load_thread, ptr))
error(
"Thread creation failed");
1154 for(i = 0; i < args.
threads; ++i){
1155 args.
d = buffers + i;
1159 for(i = 0; i < args.
threads; ++i){
1160 pthread_join(threads[i], 0);
1164 for(i = 0; i < args.
threads; ++i){
1185 if(pthread_create(&thread, 0,
load_threads, ptr))
error(
"Thread creation failed");
1199 for(i = 0; i <
n; ++i) free(replace_paths[i]);
1200 free(replace_paths);
1237 d.
X.
vals = calloc(n,
sizeof(
float*));
1241 d.
y.
vals = calloc(n,
sizeof(
float*));
1242 d.
y.
cols = w*scale * h*scale * 3;
1244 for(i = 0; i <
n; ++i){
1247 int flip = rand()%2;
1259 data load_data_regression(
char **
paths,
int n,
int m,
int k,
int min,
int max,
int size,
float angle,
float aspect,
float hue,
float saturation,
float exposure)
1264 d.
X =
load_image_augment_paths(paths, n, min, max, size, angle, aspect, hue, saturation, exposure, 0);
1283 d.
X.
vals = calloc(orig[0].X.rows,
sizeof(
float *));
1284 d.
y.
vals = calloc(orig[0].y.rows,
sizeof(
float *));
1286 for(i = 0; i < d.
X.
rows; ++i){
1295 data *ds = calloc(divs*divs,
sizeof(
data));
1297 #pragma omp parallel for 1298 for(i = 0; i < divs*divs; ++i){
1301 d.
w = orig.
w/divs *
size;
1302 d.
h = orig.
h/divs *
size;
1308 #pragma omp parallel for 1309 for(j = 0; j < orig.
X.
rows; ++j){
1310 int x = (i%divs) * orig.
w / divs - (d.
w - orig.
w/divs)/2;
1311 int y = (i/divs) * orig.
h / divs - (d.
h - orig.
h/divs)/2;
1332 #pragma omp parallel for 1333 for(i = 0; i < orig.
X.
rows; ++i){
1340 data load_data_augment(
char **
paths,
int n,
int m,
char **
labels,
int k,
tree *
hierarchy,
int min,
int max,
int size,
float angle,
float aspect,
float hue,
float saturation,
float exposure,
int center)
1347 d.
X =
load_image_augment_paths(paths, n, min, max, size, angle, aspect, hue, saturation, exposure, center);
1353 data load_data_tag(
char **
paths,
int n,
int m,
int k,
int min,
int max,
int size,
float angle,
float aspect,
float hue,
float saturation,
float exposure)
1360 d.
X =
load_image_augment_paths(paths, n, min, max, size, angle, aspect, hue, saturation, exposure, 0);
1373 for(i = 0; i < m1.
rows; ++i){
1376 for(i = 0; i < m2.
rows; ++i){
1397 for(i = 0; i <
n; ++i){
1432 FILE *fp = fopen(filename,
"rb");
1434 for(i = 0; i < 10000; ++i){
1435 unsigned char bytes[3073];
1436 fread(bytes, 1, 3073, fp);
1437 int class = bytes[0];
1438 y.
vals[i][
class] = 1;
1439 for(j = 0; j < X.
cols; ++j){
1440 X.
vals[i][j] = (double)bytes[j+1];
1452 for(j = 0; j < n; ++j){
1453 int index = rand()%d.
X.
rows;
1462 for(j = 0; j < n; ++j){
1463 int index = offset + j;
1472 float scale = 1. / d.
y.
cols;
1474 for(i = 0; i < d.
y.
rows; ++i){
1475 for(j = 0; j < d.
y.
cols; ++j){
1476 d.
y.
vals[i][j] = eps * scale + (1-eps) * d.
y.
vals[i][j];
1492 for(b = 0; b < 5; ++b){
1494 sprintf(buff,
"data/cifar/cifar-10-batches-bin/data_batch_%d.bin", b+1);
1495 FILE *fp = fopen(buff,
"rb");
1497 for(i = 0; i < 10000; ++i){
1498 unsigned char bytes[3073];
1499 fread(bytes, 1, 3073, fp);
1500 int class = bytes[0];
1501 y.
vals[i+b*10000][
class] = 1;
1502 for(j = 0; j < X.
cols; ++j){
1503 X.
vals[i+b*10000][j] = (double)bytes[j+1];
1516 FILE *fp = fopen(filename,
"rb");
1524 while((label =
fgetl(fp))){
1526 if(count == X.
rows){
1530 sscanf(label,
"%d %d", &row, &col);
1531 char *board =
fgetl(fp);
1533 int index = row*19 + col;
1534 y.
vals[count][index] = 1;
1536 for(i = 0; i < 19*19; ++i){
1538 if(board[i] ==
'1') val = 1;
1539 else if(board[i] ==
'2') val = -1;
1540 X.
vals[count][i] = val;
1564 for(i = d.
X.
rows-1; i > 0; --i){
1565 int index = rand()%i;
1566 float *swap = d.
X.
vals[index];
1570 swap = d.
y.
vals[index];
1579 for(i = 0; i < d.
X.
rows; ++i){
1587 for(i = 0; i < d.
X.
rows; ++i){
1608 for(i = 0; i < d.
X.
rows; ++i){
1637 r.
X.
vals = calloc(num,
sizeof(
float *));
1638 r.
y.
vals = calloc(num,
sizeof(
float *));
1641 for(i = 0; i < num; ++i){
1642 int index = rand()%d.
X.
rows;
1651 data *split = calloc(2,
sizeof(
data));
1653 int start = part*d.
X.
rows/total;
1654 int end = (part+1)*d.
X.
rows/total;
1657 train.
shallow = test.shallow = 1;
1659 test.X.rows = test.y.rows = end-start;
1660 train.X.rows = train.y.rows = d.
X.
rows - (end-start);
1661 train.X.cols = test.X.cols = d.
X.
cols;
1662 train.y.cols = test.y.cols = d.
y.
cols;
1664 train.X.vals = calloc(train.X.rows,
sizeof(
float*));
1665 test.X.vals = calloc(test.X.rows,
sizeof(
float*));
1666 train.y.vals = calloc(train.y.rows,
sizeof(
float*));
1667 test.y.vals = calloc(test.y.rows,
sizeof(
float*));
1669 for(i = 0; i < start; ++i){
1670 train.X.vals[i] = d.
X.
vals[i];
1671 train.y.vals[i] = d.
y.
vals[i];
1673 for(i = start; i < end; ++i){
1674 test.X.vals[i-start] = d.
X.
vals[i];
1675 test.y.vals[i-start] = d.
y.
vals[i];
1677 for(i = end; i < d.
X.
rows; ++i){
1678 train.X.vals[i-(end-start)] = d.
X.
vals[i];
1679 train.y.vals[i-(end-start)] = d.
y.
vals[i];
pthread_t load_data(load_args args)
data load_categorical_data_csv(char *filename, int target, int k)
void list_insert(list *l, void *val)
matrix csv_to_matrix(char *filename)
matrix load_image_paths(char **paths, int n, int w, int h)
void normalize_array(float *a, int n)
data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure)
image resize_image(image im, int w, int h)
void get_random_batch(data d, int n, float *X, float *y)
float constrain(float min, float max, float a)
void load_rle(image im, int *rle, int n)
void scale_array(float *a, int n, float s)
void fill_hierarchy(float *truth, int k, tree *hierarchy)
float ** one_hot_encode(float *a, int n, int k)
data get_random_data(data d, int num)
matrix resize_matrix(matrix m, int size)
int max_index(float *a, int n)
matrix load_image_augment_paths(char **paths, int n, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure, int center)
char int_to_alphanum(int i)
data * tile_data(data orig, int divs, int size)
void * load_threads(void *ptr)
void ** list_to_array(list *l)
image grayscale_image(image im)
matrix copy_matrix(matrix m)
void get_next_batch(data d, int n, int offset, float *X, float *y)
char ** get_random_paths(char **paths, int n, int m)
matrix load_image_paths_gray(char **paths, int n, int w, int h)
image float_to_image(int w, int h, int c, float *data)
data load_data_iseg(int n, char **paths, int m, int w, int h, int classes, int boxes, int div, int min, int max, float angle, float aspect, float hue, float saturation, float exposure)
void fill_image(image m, float s)
void scale_data_rows(data d, float s)
box bound_image(image im)
data concat_data(data d1, data d2)
image get_segmentation_image(char *path, int w, int h, int classes)
image get_segmentation_image2(char *path, int w, int h, int classes)
void randomize_data(data d)
data concat_datas(data *d, int n)
data load_data_seg(int n, char **paths, int m, int w, int h, int classes, int min, int max, float angle, float aspect, float hue, float saturation, float exposure, int div)
void print_letters(float *pred, int n)
void load_data_blocking(load_args args)
image random_crop_image(image im, int w, int h)
int alphanum_to_int(char c)
data load_data_captcha_encode(char **paths, int n, int m, int w, int h)
image rotate_crop_image(image im, float rad, float s, int w, int h, float dx, float dy, float aspect)
int * read_intlist(char *s, int *n, int d)
image center_crop_image(image im, int w, int h)
matrix load_tags_paths(char **paths, int n, int k)
void or_image(image src, image dest, int c)
data load_data_augment(char **paths, int n, int m, char **labels, int k, tree *hierarchy, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure, int center)
void fill_truth_mask(char *path, int num_boxes, float *truth, int classes, int w, int h, augment_args aug, int flip, int mw, int mh)
image load_image_color(char *filename, int w, int h)
data load_data_regression(char **paths, int n, int m, int k, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure)
list * get_paths(char *filename)
void correct_boxes(box_label *boxes, int n, float dx, float dy, float sx, float sy, int flip)
data load_go(char *filename)
matrix load_labels_paths(char **paths, int n, char **labels, int k, tree *hierarchy)
box_label * read_boxes(char *filename, int *n)
void fill_truth(char *path, char **labels, int k, float *truth)
data load_data_old(char **paths, int n, int m, char **labels, int k, int w, int h)
data load_data_writing(char **paths, int n, int m, int w, int h, int out_w, int out_h)
data get_data_part(data d, int part, int total)
void fill_truth_region(char *path, float *truth, int classes, int num_boxes, int flip, float dx, float dy, float sx, float sy)
char ** find_replace_paths(char **paths, int n, char *find, char *replace)
image crop_image(image im, int dx, int dy, int w, int h)
void translate_data_rows(data d, float s)
void free_matrix(matrix m)
void * load_thread(void *ptr)
void translate_array(float *a, int n, float s)
void random_distort_image(image im, float hue, float saturation, float exposure)
void fill_truth_detection(char *path, int num_boxes, float *truth, int classes, int flip, float dx, float dy, float sx, float sy)
data load_cifar10_data(char *filename)
void fill_truth_swag(char *path, float *truth, int classes, int flip, float dx, float dy, float sx, float sy)
data load_data_tag(char **paths, int n, int m, int k, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure)
pthread_t load_data_in_thread(load_args args)
char ** get_labels(char *filename)
void fill_truth_iseg(char *path, int num_boxes, float *truth, int classes, int w, int h, augment_args aug, int flip, int mw, int mh)
void exclusive_image(image src)
void randomize_boxes(box_label *b, int n)
data resize_data(data orig, int w, int h)
void find_replace(char *str, char *orig, char *rep, char *output)
matrix make_matrix(int rows, int cols)
data load_data_compare(int n, char **paths, int m, int classes, int w, int h)
data select_data(data *orig, int *inds)
data load_data_swag(char **paths, int n, int classes, float jitter)
image random_augment_image(image im, float angle, float aspect, int low, int high, int w, int h)
void normalize_data_rows(data d)
data load_data_region(int n, char **paths, int m, int w, int h, int size, int classes, float jitter, float hue, float saturation, float exposure)
float rand_uniform(float min, float max)
void fill_truth_captcha(char *path, int n, float *truth)
void place_image(image im, int w, int h, int dx, int dy, image canvas)
matrix load_regression_labels_paths(char **paths, int n, int k)
data * split_data(data d, int part, int total)
void error(const char *s)
augment_args random_augment_args(image im, float angle, float aspect, int low, int high, int w, int h)
data load_data_captcha(char **paths, int n, int m, int k, int w, int h)
data load_data_mask(int n, char **paths, int m, int w, int h, int classes, int boxes, int coords, int min, int max, float angle, float aspect, float hue, float saturation, float exposure)
char * copy_string(char *s)
float * pop_column(matrix *m, int c)
data load_data_super(char **paths, int n, int m, int w, int h, int scale)
matrix concat_matrix(matrix m1, matrix m2)