纯C++超分辨率重建FSRCNN --改编--(二)核参数修改 和多参激励vl_nnrelu

这里主要说明和LapSRN一些不同之处。

前面的LapSRN中 filters_getDepth ,filters_getSize只是拼凑,

vl_impl_nnconv_forward_blas_CPU_float中改为:

filters_getDepth=filters_biases->输入维度;
filters_getSize=filters_biases->输出维度;

filters_getHeight=	filters_getWidth=  filters_biases->核宽;

vl_impl_nnconv_backward_blas_CPU_float中改为:

filters_getDepth=filters_biases->输出维度;
filters_getHeight=filters_getWidth=filters_biases->核宽;

多参数 vl_nnrelu 激励函数:

void vl_nnrelu(卷积层 * out, float * leak)//激励函数
{

	float * s=out->data, *s0;
	float p;
	int width=out->width; 
	int height=out->height; 

	for (int c=0; c<out->depth; ++c)
	{
		for (int i=0; i<height; ++i)
		{
			for (int j=0; j<width; ++j)
			{
				s0 = s+i*width+j;
				p  = *s0;//
				if(p<0)
					*s0 *= *leak;
			}
			
		}
		s+=width*height;//到下一通道
		leak++;//下一个leak值
	}
}

主函数fscrcnn放到下一篇,这里结束。

猜你喜欢

转载自blog.csdn.net/juebai123/article/details/82193069