Fixed detection and validate(recall, map) for .png and .bmp images.

This commit is contained in:
AlexeyAB 2018-04-19 14:47:39 +03:00
parent eccfccdaf7
commit c2c8595b08
3 changed files with 14 additions and 3 deletions

View File

@ -15,6 +15,9 @@ darknet.exe partial cfg/yolov2-tiny.cfg yolov2-tiny.weights yolov2-tiny.conv.13
darknet.exe partial cfg/yolo-voc.cfg yolo-voc.weights yolo-voc.conv.23 23 darknet.exe partial cfg/yolo-voc.cfg yolo-voc.weights yolo-voc.conv.23 23
darknet.exe partial cfg/yolov2.cfg yolov2.weights yolov2.conv.23 23
darknet.exe partial cfg/yolo9000.cfg yolo9000.weights yolo9000.conv.22 22 darknet.exe partial cfg/yolo9000.cfg yolo9000.weights yolo9000.conv.22 22

View File

@ -302,6 +302,7 @@ void fill_truth_detection(char *path, int num_boxes, float *truth, int classes,
find_replace(labelpath, "raw", "labels", labelpath); find_replace(labelpath, "raw", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath); find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".bmp", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath); find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath);
int count = 0; int count = 0;

View File

@ -460,6 +460,9 @@ void validate_detector_recall(char *datacfg, char *cfgfile, char *weightfile)
find_replace(path, "images", "labels", labelpath); find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".bmp", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath);
int num_labels = 0; int num_labels = 0;
@ -484,7 +487,7 @@ void validate_detector_recall(char *datacfg, char *cfgfile, char *weightfile)
++correct; ++correct;
} }
} }
fprintf(stderr, " %s - %s - ", paths[i], labelpath); //fprintf(stderr, " %s - %s - ", paths[i], labelpath);
fprintf(stderr, "%5d %5d %5d\tRPs/Img: %.2f\tIOU: %.2f%%\tRecall:%.2f%%\n", i, correct, total, (float)proposals / (i + 1), avg_iou * 100 / total, 100.*correct / total); fprintf(stderr, "%5d %5d %5d\tRPs/Img: %.2f\tIOU: %.2f%%\tRecall:%.2f%%\n", i, correct, total, (float)proposals / (i + 1), avg_iou * 100 / total, 100.*correct / total);
free(id); free(id);
free_image(orig); free_image(orig);
@ -614,8 +617,10 @@ void validate_detector_map(char *datacfg, char *cfgfile, char *weightfile, float
find_replace(path, "images", "labels", labelpath); find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath); find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".bmp", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int num_labels = 0; int num_labels = 0;
box_label *truth = read_boxes(labelpath, &num_labels); box_label *truth = read_boxes(labelpath, &num_labels);
int i, j; int i, j;
@ -861,8 +866,10 @@ void calc_anchors(char *datacfg, int num_of_clusters, int width, int height, int
find_replace(path, "images", "labels", labelpath); find_replace(path, "images", "labels", labelpath);
find_replace(labelpath, "JPEGImages", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath);
find_replace(labelpath, ".jpg", ".txt", labelpath); find_replace(labelpath, ".jpg", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
find_replace(labelpath, ".png", ".txt", labelpath); find_replace(labelpath, ".png", ".txt", labelpath);
find_replace(labelpath, ".bmp", ".txt", labelpath);
find_replace(labelpath, ".JPG", ".txt", labelpath);
find_replace(labelpath, ".JPEG", ".txt", labelpath);
int num_labels = 0; int num_labels = 0;
box_label *truth = read_boxes(labelpath, &num_labels); box_label *truth = read_boxes(labelpath, &num_labels);
//printf(" new path: %s \n", labelpath); //printf(" new path: %s \n", labelpath);