gistlib
To use ResNet for denoising in MATLAB, you can follow these steps:
main.mnoisyImg = imread('noisy_image.png'); grayImg = rgb2gray(noisyImg); 68 chars3 lines
noisyImg = imread('noisy_image.png'); grayImg = rgb2gray(noisyImg);
denoisingResNet
main.m%Create a denoising network with default settings resnetDenoise = denoisingResnet; 83 chars3 lines
%Create a denoising network with default settings resnetDenoise = denoisingResnet;
main.moptions = trainingOptions('adam', ... %Optimizer 'Epochs', 20, ... %Number of training epochs 'MiniBatchSize', 128, ... %Mini-batch size 'CheckpointPath', 'path/to/checkpoints', ... %Checkpoint directory 'Plots', 'training-progress'); %Display training progress 278 chars6 lines
options = trainingOptions('adam', ... %Optimizer 'Epochs', 20, ... %Number of training epochs 'MiniBatchSize', 128, ... %Mini-batch size 'CheckpointPath', 'path/to/checkpoints', ... %Checkpoint directory 'Plots', 'training-progress'); %Display training progress
main.mdenoisedImg = denoiseImage(noisyImg, resnetDenoise, 'ExecutionEnvironment', 'cpu', 'Verbose', true); 101 chars2 lines
denoisedImg = denoiseImage(noisyImg, resnetDenoise, 'ExecutionEnvironment', 'cpu', 'Verbose', true);
main.mimwrite(denoisedImg, 'denoised_image.png'); 44 chars2 lines
imwrite(denoisedImg, 'denoised_image.png');
gistlibby LogSnag