Releases: libwaifu/Waifu-SR
Releases · libwaifu/Waifu-SR
Waifu-SR::LapSRN
leakyReLU[alpha_] := ElementwiseLayer[Ramp[#] - alpha * Ramp[-#]&]
GetConvolution[i_] := {
("convo_" <> i) -> ConvolutionLayer[64, 3, "PaddingSize" -> {1, 1}, "Biases" -> None],
("leaky_" <> i) -> leakyReLU[0.2]
};
mainCNN = NetChain[{
Table[GetConvolution[ToString@i], {i, 0, 10}],
"decon_11" -> DeconvolutionLayer[64, 4, "Biases" -> None, "PaddingSize" -> {1, 1}],
"leaky_11" -> leakyReLU[0.2],
"convo_12" -> ConvolutionLayer[1, 3, "Biases" -> None, "PaddingSize" -> {1, 1}]
} // Flatten];
LapSRN = NetGraph[{
"main" -> mainCNN,
"res" -> DeconvolutionLayer[1, 4, "Biases" -> None, "PaddingSize" -> {1, 1}],
"add" -> ThreadingLayer[Plus],
"trans" -> TransposeLayer[{1<->3, 1<->2}]
}, {
NetPort["Input"] -> "main",
NetPort["Input"] -> "res",
{"main", "res"} -> "add" -> "trans"
},
"Input" -> NetEncoder[{"Image", {255, 255}, ColorSpace -> "Grayscale"}]
] // NetInitialize
Waifu-SR::VDSR
NetChain[
Join[
ConstantArray[{ConvolutionLayer[64, {3, 3}, "PaddingSize" -> 1], Ramp}, 19],
{ConvolutionLayer[1, {3, 3}, "PaddingSize" -> 1], TransposeLayer[{1<->3, 1<->2}]}
],
"Input" -> {1, 255, 255}
] // NetInitialize
Waifu-SR::VGGSR
leakyReLU[alpha_] := ElementwiseLayer[Ramp[#] - alpha * Ramp[-#]&]
NetChain[{
ResizeLayer[{256 + 14, 256 + 14}],
ConvolutionLayer[32, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[32, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[64, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[64, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[128, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[128, {3, 3}], leakyReLU[0.1],
ConvolutionLayer[3, {3, 3}]
},
"Input" -> NetEncoder[{"Image", 128}],
"Output" -> NetDecoder["Image"]
] // NetInitialize