《Multi-Frame Video Super-Resolution Using Convolution Neural Networks》 读书笔记

论文地址

MSE M S E 定义

MSE(Y^,Y)=1213HWi=1Hj=1wk=13(Y^ijkYijk)2 M S E ( Y ^ , Y ) = 1 2 1 3 H W ∑ i = 1 H ∑ j = 1 w ∑ k = 1 3 ( Y ^ i j k − Y i j k ) 2

PSRN P S R N 定义

PSRN(Y^,Y)=20log(s)10logMSE(Y^,Y) P S R N ( Y ^ , Y ) = 20 log ⁡ ( s ) − 10 log ⁡ M S E ( Y ^ , Y )

s s 为像素最大可能值

SSIM定义

SSIM(Y^,Y)=(2μY^μY+c1)(2σY^Y+c2)(μ2Y^+μ2Y+c1)(σ2Y^+σ2Y+c2) S S I M ( Y ^ , Y ) = ( 2 μ Y ^ μ Y + c 1 ) ( 2 σ Y ^ Y + c 2 ) ( μ Y ^ 2 + μ Y 2 + c 1 ) ( σ Y ^ 2 + σ Y 2 + c 2 )

s s 为像素最大可能值,μY Y Y 的均值,σY2为方差, σY^Y σ Y ^ Y 为协方差, c1,c2 c 1 , c 2 分别为 0.01s2,0.03s2 0.01 s 2 , 0.03 s 2

在该片论文中,选择 SSIM S S I M 对模型进行好坏的评价。

框架

网络结构

为了保证能够对任意大小的图像进行super-resolution,在网络结构上使用了全卷积(Full Convolution)。
在输入前使用双三次插值(bicubic interpolation)进行上采样(upsample).在网络中保持图像大小不变。
使用了9层layer,且均使用relu function,同时在训练过程中dropout。
对于每个权重矩阵(weigte matrix),均进行L2 正则化(L2 regularization)。L2 正则化通过在损失函数中增加一些超参数与权重矩阵的MSE的乘积,来限制权重的大小。
以下为L2 正则化的公式:

L2(W)=λW22 L 2 ( W ) = λ ‖ W ‖ 2 2

relu函数公式:
relu(x)=max(0,x) r e l u ( x ) = m a x ( 0 , x )

dropout 公式:
Dropout(x,p)={x,0,with prob.pwith prob.1p D r o p o u t ( x , p ) = { x , with prob. p 0 , with prob. 1 − p

训练算法

在论文中,使用了Momentum和Adam两种更新算法。两种更新算法的在此不表。

超参数

k k 为层数,在这里k=9
ni n i 代表第i层的神经元(neuron)个数,
fi f i 为第i层卷积核大小

其中 fi[1,11],ni{8,16,32,64,96} f i ∈ [ 1 , 11 ] , n i ∈ { 8 , 16 , 32 , 64 , 96 }
根据机器性能设定上界。
在output layer 中 nk=3 n k = 3 ,保证为RGB三通道。
学习率(learning rate),正则化参数(regularization strength),丢弃参数(dropout parameter)在此不表

权重初始化

在此不表

单帧与多帧CNN对比

文章中训练了两种不同类型的模型,一种为单帧CNN(SICNN)和多帧CNN(MFCNN)。在SICNN中,文章严格按照上文所述的结构进行建模。而在MFCNN中,文章对模型进行了一定的调整,使得它能够不仅仅参考当前帧,还能参考当前帧的附近d帧。在文章中,MFCNN将临近的 2d+1 2 ∗ d + 1 帧堆叠起来对当前帧进行预测。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Non-local Neural Networks (NLNet) 是一个用于图像和视频处理的深度学习模型,它在处理长距离的空间关系时表现出色。下面是一个使用 TensorFlow 2 实现的 NLNet 模型的示例代码: ```python import tensorflow as tf from tensorflow.keras.layers import Conv2D, BatchNormalization, Activation, Add, Input, Lambda, Concatenate from tensorflow.keras.models import Model from tensorflow.keras.regularizers import l2 def non_local_block(x, compression=2, mode='embedded_gaussian', reg=l2(0.)): ''' Non-local block with optional compression and different modes: - 'dot_product': dot product similarity (original paper) - 'embedded_gaussian': embedded Gaussian similarity (default) - 'concatenation': concatenation-based similarity (not recommended) ''' # Get input shape and channels input_shape = tf.shape(x) channels = input_shape[-1] # Define theta, phi, and g theta = Conv2D(channels // compression, 1, use_bias=False, kernel_regularizer=reg)(x) phi = Conv2D(channels // compression, 1, use_bias=False, kernel_regularizer=reg)(x) g = Conv2D(channels // compression, 1, use_bias=False, kernel_regularizer=reg)(x) # Reshape theta and phi to (N, H*W, C') theta = Lambda(lambda x: tf.reshape(x, (input_shape[0], -1, channels // compression)))(theta) phi = Lambda(lambda x: tf.reshape(x, (input_shape[0], -1, channels // compression)))(phi) # Compute similarity between theta and phi if mode == 'dot_product': similarity = Lambda(lambda x: tf.matmul(x[0], x[1], transpose_b=True))([theta, phi]) elif mode == 'embedded_gaussian': theta = Lambda(lambda x: tf.expand_dims(x, 2))(theta) phi = Lambda(lambda x: tf.expand_dims(x, 1))(phi) theta_phi = Add()([theta, phi]) f = Conv2D(1, 1, use_bias=False, kernel_regularizer=reg)(theta_phi) f = Activation('softmax')(f) similarity = Lambda(lambda x: tf.matmul(x[0], x[1]))([f, g]) elif mode == 'concatenation': theta_phi = Concatenate(axis=-1)([theta, phi]) h = Conv2D(channels // compression, 1, use_bias=False, kernel_regularizer=reg)(theta_phi) similarity = Lambda(lambda x: tf.matmul(x[0], x[1], transpose_b=True))([h, g]) # Reshape similarity to (N, H, W, C') similarity = Lambda(lambda x: tf.reshape(x, (input_shape[0], input_shape[1], input_shape[2], channels // compression)))(similarity) # Compute output y = Conv2D(channels, 1, use_bias=False, kernel_regularizer=reg)(similarity) y = Add()([y, x]) y = BatchNormalization()(y) y = Activation('relu')(y) return y def build_nlnet(input_shape, num_classes, num_blocks=5, compression=2, mode='embedded_gaussian', reg=l2(0.)): ''' Build NLNet model with optional number of blocks, compression, and mode. ''' # Define input inputs = Input(shape=input_shape) # Initial convolution x = Conv2D(64, 3, padding='same', use_bias=False, kernel_regularizer=reg)(inputs) x = BatchNormalization()(x) x = Activation('relu')(x) # Non-local blocks for i in range(num_blocks): x = non_local_block(x, compression=compression, mode=mode, reg=reg) # Final convolution and pooling x = Conv2D(128, 1, use_bias=False, kernel_regularizer=reg)(x) x = BatchNormalization()(x) x = Activation('relu')(x) x = Conv2D(num_classes, 1, use_bias=False, kernel_regularizer=reg)(x) x = BatchNormalization()(x) x = Activation('softmax')(x) x = Lambda(lambda x: tf.reduce_mean(x, axis=(1, 2)))(x) # Define model model = Model(inputs=inputs, outputs=x) return model ``` 此代码实现了一个用于图像分类的 NLNet 模型,其中包含多个非局部块。该模型使用可配置的压缩因子和模式,并支持 L2 正则化。要使用此代码,请调用 `build_nlnet()` 函数并传递输入形状、类别数以及其他可选参数。例如: ```python input_shape = (224, 224, 3) num_classes = 1000 model = build_nlnet(input_shape, num_classes, num_blocks=5, compression=2, mode='embedded_gaussian', reg=l2(0.0001)) ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值