| | |
| | |
|
| | | void replace_image_to_label(const char* input_path, char* output_path)
|
| | | {
|
| | | find_replace(input_path, "/images/train2014/", "/labels/train2014/", output_path); // COCO
|
| | | find_replace(output_path, "/images/val2014/", "/labels/val2014/", output_path); // COCO
|
| | | find_replace(input_path, "/images/train2017/", "/labels/train2017/", output_path); // COCO |
| | | find_replace(output_path, "/images/val2017/", "/labels/val2017/", output_path); // COCO |
| | | find_replace(output_path, "/JPEGImages/", "/labels/", output_path); // PascalVOC
|
| | | find_replace(output_path, "\\images\\train2017\\", "\\labels\\train2017\\", output_path); // COCO |
| | | find_replace(output_path, "\\images\\val2017\\", "\\labels\\val2017\\", output_path); // COCO |
| | | |
| | | find_replace(output_path, "\\images\\train2014\\", "\\labels\\train2014\\", output_path); // COCO
|
| | | find_replace(output_path, "\\images\\val2014\\", "\\labels\\val2014\\", output_path); // COCO
|
| | | find_replace(output_path, "/images/train2014/", "/labels/train2014/", output_path); // COCO |
| | | find_replace(output_path, "/images/val2014/", "/labels/val2014/", output_path); // COCO |
| | | |
| | | find_replace(output_path, "\\JPEGImages\\", "\\labels\\", output_path); // PascalVOC
|
| | | //find_replace(output_path, "/images/", "/labels/", output_path); // COCO
|
| | | //find_replace(output_path, "/VOC2007/JPEGImages/", "/VOC2007/labels/", output_path); // PascalVOC
|
| | |
| | |
|
| | | void malloc_error()
|
| | | {
|
| | | fprintf(stderr, "xMalloc error\n");
|
| | | fprintf(stderr, "xMalloc error - possibly out of CPU RAM \n"); |
| | | exit(EXIT_FAILURE);
|
| | | }
|
| | |
|
| | | void calloc_error()
|
| | | {
|
| | | fprintf(stderr, "Calloc error\n");
|
| | | fprintf(stderr, "Calloc error - possibly out of CPU RAM \n"); |
| | | exit(EXIT_FAILURE);
|
| | | }
|
| | |
|
| | | void realloc_error()
|
| | | {
|
| | | fprintf(stderr, "Realloc error\n");
|
| | | fprintf(stderr, "Realloc error - possibly out of CPU RAM \n"); |
| | | exit(EXIT_FAILURE);
|
| | | }
|
| | |
|
| | |
| | | int j;
|
| | | memset(avg, 0, els*sizeof(float));
|
| | | for(j = 0; j < n; ++j){
|
| | | #pragma omp parallel for
|
| | | for(i = 0; i < els; ++i){
|
| | | avg[i] += a[j][i];
|
| | | }
|
| | | }
|
| | | #pragma omp parallel for
|
| | | for(i = 0; i < els; ++i){
|
| | | avg[i] /= n;
|
| | | }
|
| | |
| | | for(i = 0; i < n; ++i){
|
| | | a[i] = (a[i] - mu)/sigma;
|
| | | }
|
| | | mu = mean_array(a,n);
|
| | | sigma = sqrt(variance_array(a,n));
|
| | | //mu = mean_array(a,n); |
| | | //sigma = sqrt(variance_array(a,n)); |
| | | }
|
| | |
|
| | | void translate_array(float *a, int n, float s)
|
| | |
| | | return mkdir(path, mode);
|
| | | #endif
|
| | | }
|
| | | |
| | | unsigned long custom_hash(char *str) |
| | | { |
| | | unsigned long hash = 5381; |
| | | int c; |
| | | |
| | | while (c = *str++) |
| | | hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ |
| | | |
| | | return hash; |
| | | } |
| | | |
| | | bool is_live_stream(const char * path){ |
| | | const char *url_schema = "://"; |
| | | return (NULL != strstr(path, url_schema)); |
| | | } |