I WISH I HAD SOME TESTS THOUGH

This commit is contained in:
Joseph Redmon 2017-11-21 11:34:46 -08:00
parent 16686cec57
commit 56be49aa48
6 changed files with 16 additions and 12 deletions

View File

@ -7,11 +7,12 @@ import sys, os
sys.path.append(os.path.join(os.getcwd(),'python/'))
import darknet as dn
import pdb
dn.set_gpu(0)
net = dn.load_net("cfg/tiny-yolo.cfg", "tiny-yolo.weights", 0)
meta = dn.load_meta("cfg/coco.data")
r = dn.detect(net, meta, "data/dog.jpg")
net = dn.load_net("cfg/yolo-thor.cfg", "/home/pjreddie/backup/yolo-thor_final.weights", 0)
meta = dn.load_meta("cfg/thor.data")
r = dn.detect(net, meta, "data/bedroom.jpg")
print r
# And then down here you could detect a lot more images like:

View File

@ -62,7 +62,7 @@ void optimize_picture(network *net, image orig, int max_layer, float scale, floa
cuda_free(net->delta_gpu);
net->delta_gpu = 0;
#else
net->input = im.data;
copy_cpu(net->inputs, im.data, 1, net->input, 1);
net->delta = delta.data;
forward_network(net);
copy_cpu(last.outputs, last.output, 1, last.delta, 1);

View File

@ -13,7 +13,9 @@ def sample(probs):
return len(probs)-1
def c_array(ctype, values):
return (ctype * len(values))(*values)
arr = (ctype*len(values))()
arr[:] = values
return arr
class BOX(Structure):
_fields_ = [("x", c_float),

View File

@ -236,7 +236,7 @@ void backward_convolutional_layer_gpu(convolutional_layer l, network net)
float *b = net.workspace;
float *c = l.weight_updates_gpu + j*l.nweights/l.groups;
float *im = net.input+(i*l.groups + j)*l.c/l.groups*l.h*l.w;
float *im = net.input_gpu+(i*l.groups + j)*l.c/l.groups*l.h*l.w;
im2col_gpu(im, l.c/l.groups, l.h, l.w,
l.size, l.stride, l.pad, b);

View File

@ -150,24 +150,24 @@ void cudnn_convolutional_setup(layer *l)
l->weightDesc,
l->convDesc,
l->dstTensorDesc,
CUDNN_CONVOLUTION_FWD_PREFER_FASTEST,
0,
CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT,
4000000000,
&l->fw_algo);
cudnnGetConvolutionBackwardDataAlgorithm(cudnn_handle(),
l->weightDesc,
l->ddstTensorDesc,
l->convDesc,
l->dsrcTensorDesc,
CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST,
0,
CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT,
4000000000,
&l->bd_algo);
cudnnGetConvolutionBackwardFilterAlgorithm(cudnn_handle(),
l->srcTensorDesc,
l->ddstTensorDesc,
l->convDesc,
l->dweightDesc,
CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST,
0,
CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT,
4000000000,
&l->bf_algo);
}
#endif

View File

@ -389,6 +389,7 @@ int resize_network(network *net, int w, int h)
error("Cannot resize this type of layer");
}
if(l.workspace_size > workspace_size) workspace_size = l.workspace_size;
if(l.workspace_size > 2000000000) assert(0);
inputs = l.outputs;
net->layers[i] = l;
w = l.out_w;