From afe245329bdd14f36ca773fd7d497fc628b0535a Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Wed, 10 Jun 2015 18:14:04 +0000
Subject: [PATCH] Better load messaging
---
src/detection.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/detection.c b/src/detection.c
index ac93efb..96f8521 100644
--- a/src/detection.c
+++ b/src/detection.c
@@ -7,16 +7,16 @@
char *class_names[] = {"aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"};
-void draw_detection(image im, float *box, int side, int bg, char *label)
+void draw_detection(image im, float *box, int side, char *label)
{
int classes = 20;
- int elems = 4+classes+bg;
+ int elems = 4+classes;
int j;
int r, c;
for(r = 0; r < side; ++r){
for(c = 0; c < side; ++c){
- j = (r*side + c) * elems + bg;
+ j = (r*side + c) * elems;
int class = max_index(box+j, classes);
if(box[j+class] > .2){
printf("%f %s\n", box[j+class], class_names[class]);
@@ -212,22 +212,24 @@
load_weights(&net, weightfile);
}
detection_layer layer = get_network_detection_layer(net);
+ if (!layer.joint) fprintf(stderr, "Detection layer should use joint prediction to draw correctly.\n");
int im_size = 448;
set_batch_network(&net, 1);
srand(2222222);
clock_t time;
char filename[256];
while(1){
+ printf("Image Path: ");
+ fflush(stdout);
fgets(filename, 256, stdin);
strtok(filename, "\n");
image im = load_image_color(filename,0,0);
image sized = resize_image(im, im_size, im_size);
- printf("%d %d %d\n", im.h, im.w, im.c);
float *X = sized.data;
time=clock();
float *predictions = network_predict(net, X);
printf("%s: Predicted in %f seconds.\n", filename, sec(clock()-time));
- draw_detection(im, predictions, 7, layer.background || layer.objectness, "predictions");
+ draw_detection(im, predictions, 7, "predictions");
free_image(im);
free_image(sized);
#ifdef OPENCV
--
Gitblit v1.10.0