mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Fixed xnor for random=1
This commit is contained in:
@ -465,6 +465,10 @@ void resize_convolutional_layer(convolutional_layer *l, int w, int h)
|
|||||||
l->x_norm = realloc(l->x_norm, l->batch*l->outputs*sizeof(float));
|
l->x_norm = realloc(l->x_norm, l->batch*l->outputs*sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (l->xnor) {
|
||||||
|
//l->binary_input = realloc(l->inputs*l->batch, sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GPU
|
#ifdef GPU
|
||||||
if (old_w < w || old_h < h) {
|
if (old_w < w || old_h < h) {
|
||||||
cuda_free(l->delta_gpu);
|
cuda_free(l->delta_gpu);
|
||||||
@ -480,6 +484,11 @@ void resize_convolutional_layer(convolutional_layer *l, int w, int h)
|
|||||||
l->x_gpu = cuda_make_array(l->output, l->batch*l->outputs);
|
l->x_gpu = cuda_make_array(l->output, l->batch*l->outputs);
|
||||||
l->x_norm_gpu = cuda_make_array(l->output, l->batch*l->outputs);
|
l->x_norm_gpu = cuda_make_array(l->output, l->batch*l->outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (l->xnor) {
|
||||||
|
cuda_free(l->binary_input_gpu);
|
||||||
|
l->binary_input_gpu = cuda_make_array(0, l->inputs*l->batch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef CUDNN
|
#ifdef CUDNN
|
||||||
cudnn_convolutional_setup(l, cudnn_fastest);
|
cudnn_convolutional_setup(l, cudnn_fastest);
|
||||||
|
@ -1109,12 +1109,42 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
|
|||||||
detection *dets = get_network_boxes(&net, im.w, im.h, thresh, hier_thresh, 0, 1, &nboxes, letterbox);
|
detection *dets = get_network_boxes(&net, im.w, im.h, thresh, hier_thresh, 0, 1, &nboxes, letterbox);
|
||||||
if (nms) do_nms_sort(dets, nboxes, l.classes, nms);
|
if (nms) do_nms_sort(dets, nboxes, l.classes, nms);
|
||||||
draw_detections_v3(im, dets, nboxes, thresh, names, alphabet, l.classes, ext_output);
|
draw_detections_v3(im, dets, nboxes, thresh, names, alphabet, l.classes, ext_output);
|
||||||
free_detections(dets, nboxes);
|
|
||||||
save_image(im, "predictions");
|
save_image(im, "predictions");
|
||||||
if (!dont_show) {
|
if (!dont_show) {
|
||||||
show_image(im, "predictions");
|
show_image(im, "predictions");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// pseudo labeling concept - fast.ai
|
||||||
|
{
|
||||||
|
char labelpath[4096];
|
||||||
|
find_replace(input, ".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, ".ppm", ".txt", labelpath);
|
||||||
|
|
||||||
|
FILE* fw = fopen(labelpath, "wb");
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < nboxes; ++i) {
|
||||||
|
char buff[1024];
|
||||||
|
int class_id = -1;
|
||||||
|
float prob = 0;
|
||||||
|
for (j = 0; j < l.classes; ++j) {
|
||||||
|
if (dets[i].prob[j] > thresh && dets[i].prob[j] > prob) {
|
||||||
|
prob = dets[i].prob[j];
|
||||||
|
class_id = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (class_id >= 0) {
|
||||||
|
sprintf(buff, "%d %2.4f %2.4f %2.4f %2.4f\n", class_id, dets[i].bbox.x, dets[i].bbox.y, dets[i].bbox.w, dets[i].bbox.h);
|
||||||
|
fwrite(buff, sizeof(char), strlen(buff), fw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fw);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
free_detections(dets, nboxes);
|
||||||
free_image(im);
|
free_image(im);
|
||||||
free_image(sized);
|
free_image(sized);
|
||||||
//free(boxes);
|
//free(boxes);
|
||||||
|
Reference in New Issue
Block a user