YOLOv3 ON CPU!!!!

This commit is contained in:
Joseph Redmon 2018-03-26 08:57:43 -07:00
parent e4acba689c
commit 698d54cb5f
2 changed files with 3 additions and 3 deletions

View File

@ -572,7 +572,7 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
double time; double time;
char buff[256]; char buff[256];
char *input = buff; char *input = buff;
float nms=.3; float nms=0;
while(1){ while(1){
if(filename){ if(filename){
strncpy(input, filename, 256); strncpy(input, filename, 256);
@ -598,7 +598,7 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
printf("%s: Predicted in %f seconds.\n", input, what_time_is_it_now()-time); printf("%s: Predicted in %f seconds.\n", input, what_time_is_it_now()-time);
int nboxes = 0; int nboxes = 0;
detection *dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, 0, 1, &nboxes); detection *dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, 0, 1, &nboxes);
printf("%d\n", nboxes); //printf("%d\n", nboxes);
//if (nms) do_nms_obj(boxes, probs, l.w*l.h*l.n, l.classes, nms); //if (nms) do_nms_obj(boxes, probs, l.w*l.h*l.n, l.classes, nms);
if (nms) do_nms_sort(dets, nboxes, l.classes, nms); if (nms) do_nms_sort(dets, nboxes, l.classes, nms);
draw_detections(im, dets, nboxes, thresh, names, alphabet, l.classes); draw_detections(im, dets, nboxes, thresh, names, alphabet, l.classes);

View File

@ -339,7 +339,7 @@ void upsample_cpu(float *in, int w, int h, int c, int batch, int stride, int for
for(j = 0; j < h*stride; ++j){ for(j = 0; j < h*stride; ++j){
for(i = 0; i < w*stride; ++i){ for(i = 0; i < w*stride; ++i){
int in_index = b*w*h*c + k*w*h + (j/stride)*w + i/stride; int in_index = b*w*h*c + k*w*h + (j/stride)*w + i/stride;
int out_index = b*w*h*c + k*w*h + j*w + i; int out_index = b*w*h*c*stride*stride + k*w*h*stride*stride + j*w*stride + i;
if(forward) out[out_index] = scale*in[in_index]; if(forward) out[out_index] = scale*in[in_index];
else in[in_index] += scale*out[out_index]; else in[in_index] += scale*out[out_index];
} }