darknet/src/data.h

56 lines
1.6 KiB
C
Raw Normal View History

2013-11-13 22:50:38 +04:00
#ifndef DATA_H
#define DATA_H
2014-12-12 00:15:26 +03:00
#include <pthread.h>
2013-11-13 22:50:38 +04:00
2013-12-07 01:26:09 +04:00
#include "matrix.h"
#include "list.h"
2013-11-13 22:50:38 +04:00
2015-04-15 10:32:32 +03:00
extern unsigned int data_seed;
2015-04-01 20:25:50 +03:00
static inline float distance_from_edge(int x, int max)
{
int dx = (max/2) - x;
if (dx < 0) dx = -dx;
dx = (max/2) + 1 - dx;
dx *= 2;
float dist = (float)dx/max;
if (dist > 1) dist = 1;
return dist;
}
2013-11-13 22:50:38 +04:00
typedef struct{
2013-12-07 01:26:09 +04:00
matrix X;
matrix y;
int shallow;
} data;
2013-11-13 22:50:38 +04:00
2013-12-07 01:26:09 +04:00
void free_data(data d);
2014-12-13 23:01:21 +03:00
2015-02-24 05:52:05 +03:00
void print_letters(float *pred, int n);
2015-04-10 01:18:54 +03:00
data load_data_captcha(char **paths, int n, int m, int k, int w, int h);
data load_data_captcha_encode(char **paths, int n, int m, int w, int h);
data load_data(char **paths, int n, int m, char **labels, int k, int w, int h);
pthread_t load_data_thread(char **paths, int n, int m, char **labels, int k, int w, int h, data *d);
2014-12-13 23:01:21 +03:00
2015-04-10 01:18:54 +03:00
pthread_t load_data_detection_thread(int n, char **paths, int m, int classes, int w, int h, int nh, int nw, int background, data *d);
data load_data_detection_jitter_random(int n, char **paths, int m, int classes, int w, int h, int num_boxes, int background);
2014-12-28 20:42:35 +03:00
2014-03-13 08:57:34 +04:00
data load_cifar10_data(char *filename);
2014-08-08 23:04:15 +04:00
data load_all_cifar10();
2015-04-10 01:18:54 +03:00
list *get_paths(char *filename);
2014-10-25 22:57:26 +04:00
char **get_labels(char *filename);
void get_random_batch(data d, int n, float *X, float *y);
void get_next_batch(data d, int n, int offset, float *X, float *y);
2013-12-07 01:26:09 +04:00
data load_categorical_data_csv(char *filename, int target, int k);
void normalize_data_rows(data d);
2014-02-14 22:26:31 +04:00
void scale_data_rows(data d, float s);
2014-07-14 09:07:51 +04:00
void translate_data_rows(data d, float s);
2013-12-07 01:26:09 +04:00
void randomize_data(data d);
2013-12-07 21:38:50 +04:00
data *split_data(data d, int part, int total);
data concat_data(data d1, data d2);
2013-11-13 22:50:38 +04:00
#endif