yun-liu / RCF

Richer Convolutional Features for Edge Detection
Other
753 stars 259 forks source link

咨询有关RCF代码得疑问 #54

Open youchangshi opened 5 years ago

youchangshi commented 5 years ago

你好,我有两个问咨询下, 我机器环境 UBUNTU16.04, GTX1080TI, CUDA9.0 1,我下载下来RCF没有改动如何东西,直接按照说明,从5stage-vgg.caffemodel基础上训练RCF-MS,但是在BSDS500上得F指标只是0.8?而不是0.811? 论文说 the weights of 1 *1 conv layer in stage 1-5 are initialized from zero-mean Gaussian distributions with standard deviation 0.01,但是在train_val.prototxt 里头配置 这些层为 layer { name: "conv2_2_down" type: "Convolution" bottom: "conv2_2" top: "conv2_2_down" param { lr_mult: 0.1 decay_mult: 1 } param { lr_mult: 0.2 decay_mult: 0 } convolution_param { num_output: 21 kernel_size: 1 } }, 这样配置应该默认初始化是0啊,是这个配置原因吗?

2 看了RCF论文的损失函数中需要一个阈值判定像素点为正负例,但是我找了相关代码没有发现这个阈值判定在哪里? 我找的相关区域代码如下 template void SigmoidCrossEntropyLossLayer::Forward_cpu( const vector<Blob>& bottom, const vector<Blob>& top) { ............................. ........................ int dim = count / num; for (int i = 0; i < num; ++i) { ................ for (int j = 0; j < dim; j ++) { if (target[idim+j] == 1) { count_pos ++; temp_loss_pos -= input_data[idim + j] (target[idim+j] - (input_data[idim + j] >= 0)) - log(1 + exp(input_data[idim + j] - 2 input_data[idim + j] (input_data[idim + j] >= 0))); } else if (target[idim+j] == 0) { count_neg ++; temp_loss_neg -= input_data[idim + j] (target[idim+j] - (input_data[idim + j] >= 0)) - log(1 + exp(input_data[idim + j] - 2 input_data[idim + j] (input_data[idim + j] >= 0))); } } ........................ } .......................... }

template void AutoCropLayer::Forward_cpu(const vector<Blob>& bottom, const vector<Blob>& top) { .................................................. for (int n = 0; n < top[0]->num(); ++n) { for (int c = 0; c < top[0]->channels(); ++c) { for (int h = 0; h < top[0]->height(); ++h) { caffe_copy(top[0]->width(), bottom_data + bottom[0]->offset(n, c, croph + h, cropw), top_data + top[0]->offset(n, c, h)); } } } }

template void DeconvolutionLayer::Forwardcpu(const vector<Blob>& bottom, const vector<Blob>& top) { .............................. for (int i = 0; i < bottom.size(); ++i) { .................................... for (int n = 0; n < this->num; ++n) { this->backward_cpu_gemm(bottom_data + n this->bottomdim, weight, top_data + n this->topdim); if (this->biasterm) { const Dtype bias = this->blobs_[1]->cpu_data(); this->forward_cpu_bias(top_data + n this->topdim, bias); } } } }

yun-liu commented 5 years ago

感谢您关注我们的工作。

  1. 初始化为0是因为我后来发现初始化为0或者gaussian初始化都差不多;结果的话我也不清楚,论文里那个0.811的结果是follow最近的那些edge的论文,用BSDS500 + PASCAL Context训练的,不过只用BSDS500训练结果按理说也不会0.8。我的环境是Ubuntu 16.04 + CUDA 8.0
  2. 这个阈值的代码在data_transform.cpp里,你应该从data layer开始读,就会发现读入的数据用data_transform.cpp里的函数做了处理。