You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.2 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef DATA_H
  2. #define DATA_H
  3. #ifdef __linux__
  4. #include <pthread.h>
  5. #else
  6. #endif
  7. #include "darknet.h"
  8. #include "matrix.h"
  9. #include "list.h"
  10. #include "image.h"
  11. #include "tree.h"
  12. namespace DN{
  13. static __inline float distance_from_edge(int x, int max){
  14. int dx = (max / 2) - x;
  15. if (dx < 0) dx = -dx;
  16. dx = (max / 2) + 1 - dx;
  17. dx *= 2;
  18. float dist = (float)dx / max;
  19. if (dist > 1) dist = 1;
  20. return dist;
  21. };
  22. void load_data_blocking(load_args args);
  23. void print_letters(float *pred, int n);
  24. data load_data_captcha(char **paths, int n, int m, int k, int w, int h);
  25. data load_data_captcha_encode(char **paths, int n, int m, int w, int h);
  26. 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);
  27. 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);
  28. 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);
  29. data load_data_super(char **paths, int n, int m, int w, int h, int scale);
  30. 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);
  31. data load_data_regression(char **paths, int n, int m, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure);
  32. data load_go(char *filename);
  33. data load_data_writing(char **paths, int n, int m, int w, int h, int out_w, int out_h);
  34. void get_random_batch(data d, int n, float *X, float *y);
  35. data get_data_part(data d, int part, int total);
  36. data get_random_data(data d, int num);
  37. data load_categorical_data_csv(char *filename, int target, int k);
  38. void normalize_data_rows(data d);
  39. void scale_data_rows(data d, float s);
  40. void translate_data_rows(data d, float s);
  41. void randomize_data(data d);
  42. data *split_data(data d, int part, int total);
  43. data concat_datas(data *d, int n);
  44. void fill_truth(char *path, char **labels, int k, float *truth);
  45. };
  46. #endif