data.h
Go to the documentation of this file.
00001 #ifndef DATA_H
00002 #define DATA_H
00003 #include <pthread.h>
00004 
00005 #include "matrix.h"
00006 #include "list.h"
00007 #include "image.h"
00008 #include "tree.h"
00009 
00010 static inline float distance_from_edge(int x, int max)
00011 {
00012     int dx = (max/2) - x;
00013     if (dx < 0) dx = -dx;
00014     dx = (max/2) + 1 - dx;
00015     dx *= 2;
00016     float dist = (float)dx/max;
00017     if (dist > 1) dist = 1;
00018     return dist;
00019 }
00020 
00021 typedef struct{
00022     int w, h;
00023     matrix X;
00024     matrix y;
00025     int shallow;
00026     int *num_boxes;
00027     box **boxes;
00028 } data;
00029 
00030 typedef enum {
00031     CLASSIFICATION_DATA, DETECTION_DATA, CAPTCHA_DATA, REGION_DATA, IMAGE_DATA, COMPARE_DATA, WRITING_DATA, SWAG_DATA, TAG_DATA, OLD_CLASSIFICATION_DATA, STUDY_DATA, DET_DATA, SUPER_DATA
00032 } data_type;
00033 
00034 typedef struct load_args{
00035     int threads;
00036     char **paths;
00037     char *path;
00038     int n;
00039     int m;
00040     char **labels;
00041     int h;
00042     int w;
00043     int out_w;
00044     int out_h;
00045     int nh;
00046     int nw;
00047     int num_boxes;
00048     int min, max, size;
00049     int classes;
00050     int background;
00051     int scale;
00052     float jitter;
00053     float angle;
00054     float aspect;
00055     float saturation;
00056     float exposure;
00057     float hue;
00058     data *d;
00059     image *im;
00060     image *resized;
00061     data_type type;
00062     tree *hierarchy;
00063 } load_args;
00064 
00065 typedef struct{
00066     int id;
00067     float x,y,w,h;
00068     float left, right, top, bottom;
00069 } box_label;
00070 
00071 void free_data(data d);
00072 
00073 pthread_t load_data(load_args args);
00074 
00075 pthread_t load_data_in_thread(load_args args);
00076 
00077 void print_letters(float *pred, int n);
00078 data load_data_captcha(char **paths, int n, int m, int k, int w, int h);
00079 data load_data_captcha_encode(char **paths, int n, int m, int w, int h);
00080 data load_data_old(char **paths, int n, int m, char **labels, int k, int w, int h);
00081 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);
00082 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);
00083 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);
00084 data load_data_super(char **paths, int n, int m, int w, int h, int scale);
00085 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);
00086 data load_go(char *filename);
00087 
00088 box_label *read_boxes(char *filename, int *n);
00089 data load_cifar10_data(char *filename);
00090 data load_all_cifar10();
00091 
00092 data load_data_writing(char **paths, int n, int m, int w, int h, int out_w, int out_h);
00093 
00094 list *get_paths(char *filename);
00095 char **get_labels(char *filename);
00096 void get_random_batch(data d, int n, float *X, float *y);
00097 data get_data_part(data d, int part, int total);
00098 data get_random_data(data d, int num);
00099 void get_next_batch(data d, int n, int offset, float *X, float *y);
00100 data load_categorical_data_csv(char *filename, int target, int k);
00101 void normalize_data_rows(data d);
00102 void scale_data_rows(data d, float s);
00103 void translate_data_rows(data d, float s);
00104 void randomize_data(data d);
00105 data *split_data(data d, int part, int total);
00106 data concat_data(data d1, data d2);
00107 data concat_datas(data *d, int n);
00108 void fill_truth(char *path, char **labels, int k, float *truth);
00109 
00110 #endif


rail_object_detector
Author(s):
autogenerated on Sat Jun 8 2019 20:26:29