mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
mAP calculation during training, if is used flag -map
This commit is contained in:
@ -19,6 +19,32 @@ image get_maxpool_delta(maxpool_layer l)
|
||||
return float_to_image(w,h,c,l.delta);
|
||||
}
|
||||
|
||||
|
||||
void cudnn_maxpool_setup(layer *l)
|
||||
{
|
||||
#ifdef CUDNN
|
||||
cudnnStatus_t maxpool_status;
|
||||
maxpool_status = cudnnCreatePoolingDescriptor(&l->poolingDesc);
|
||||
|
||||
maxpool_status = cudnnSetPooling2dDescriptor(
|
||||
l->poolingDesc,
|
||||
CUDNN_POOLING_MAX,
|
||||
CUDNN_PROPAGATE_NAN, // CUDNN_PROPAGATE_NAN, CUDNN_NOT_PROPAGATE_NAN
|
||||
l->size,
|
||||
l->size,
|
||||
0, //l.pad,
|
||||
0, //l.pad,
|
||||
l->stride,
|
||||
l->stride);
|
||||
|
||||
cudnnCreateTensorDescriptor(&l->srcTensorDesc);
|
||||
cudnnCreateTensorDescriptor(&l->dstTensorDesc);
|
||||
cudnnSetTensor4dDescriptor(l->srcTensorDesc, CUDNN_TENSOR_NCHW, CUDNN_DATA_FLOAT, l->batch, l->c, l->h, l->w);
|
||||
cudnnSetTensor4dDescriptor(l->dstTensorDesc, CUDNN_TENSOR_NCHW, CUDNN_DATA_FLOAT, l->batch, l->out_c, l->out_h, l->out_w);
|
||||
#endif // CUDNN
|
||||
}
|
||||
|
||||
|
||||
maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding)
|
||||
{
|
||||
maxpool_layer l = {0};
|
||||
@ -47,26 +73,9 @@ maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int s
|
||||
l.indexes_gpu = cuda_make_int_array(output_size);
|
||||
l.output_gpu = cuda_make_array(l.output, output_size);
|
||||
l.delta_gpu = cuda_make_array(l.delta, output_size);
|
||||
#ifdef CUDNN
|
||||
cudnnStatus_t maxpool_status;
|
||||
maxpool_status = cudnnCreatePoolingDescriptor(&l.poolingDesc);
|
||||
|
||||
maxpool_status = cudnnSetPooling2dDescriptor(
|
||||
l.poolingDesc,
|
||||
CUDNN_POOLING_MAX,
|
||||
CUDNN_PROPAGATE_NAN, // CUDNN_PROPAGATE_NAN, CUDNN_NOT_PROPAGATE_NAN
|
||||
l.size,
|
||||
l.size,
|
||||
0, //l.pad,
|
||||
0, //l.pad,
|
||||
l.stride,
|
||||
l.stride);
|
||||
cudnn_maxpool_setup(&l);
|
||||
|
||||
cudnnCreateTensorDescriptor(&l.srcTensorDesc);
|
||||
cudnnCreateTensorDescriptor(&l.dstTensorDesc);
|
||||
cudnnSetTensor4dDescriptor(l.srcTensorDesc, CUDNN_TENSOR_NCHW, CUDNN_DATA_FLOAT, l.batch, l.c, l.h, l.w);
|
||||
cudnnSetTensor4dDescriptor(l.dstTensorDesc, CUDNN_TENSOR_NCHW, CUDNN_DATA_FLOAT, l.batch, l.out_c, l.out_h, l.out_w);
|
||||
#endif // CUDNN
|
||||
#endif // GPU
|
||||
l.bflops = (l.size*l.size*l.c * l.out_h*l.out_w) / 1000000000.;
|
||||
fprintf(stderr, "max %d x %d / %d %4d x%4d x%4d -> %4d x%4d x%4d %5.3f BF\n", size, size, stride, w, h, c, l.out_w, l.out_h, l.out_c, l.bflops);
|
||||
|
Reference in New Issue
Block a user