ved27 / red-net Goto Github PK
View Code? Open in Web Editor NEWRED30 implementation
RED30 implementation
could you please provide the trainning code ?
Here I wrote python inference code for denoise, so one can use it as guideline:
import caffe
from PIL import Image
import numpy as np
import cv2
# load model
caffe.set_mode_cpu() # the model is very greedy for GPU ram, it does not want to work on my 4G GPU
net = caffe.Net('model/REDNet_ch1.prototxt','model/denoising/30.caffemodel', caffe.TEST)
img = np.array(Image.open('256x256.png').convert('YCbCr'))
y =img[...,0]
res8cb =img[...,1]
res8cr = img[...,2]
img = y/255.0
net.blobs['data'].reshape(*(1,1, img.shape[0], img.shape[1]))
img_out = np.zeros(shape=(img.shape[0], img.shape[1],8), dtype=np.float32);
for i in range(1, 5):
i1 = np.rot90(img, i-1)[np.newaxis, np.newaxis,...]
net.blobs['data'].data[...] = i1
net.forward()
res = net.blobs['d15'].data[...]
img_out[:,:,i-1] = np.rot90(res[0,0,:,:], 5-i) + img;
print('-')
for i in range(5, 8):
i1 = np.rot90(np.fliplr(img), i-5)[np.newaxis, np.newaxis,...]
net.blobs['data'].data[...] = i1
net.forward()
res = net.blobs['d15'].data[...]
img_out[:,:,i-1] = np.rot90(res[0,0,:,:], 9-i) + img;
print('-')
img_out = np.mean(img_out,axis=-1);
res8y = (img_out*255.0).astype(np.uint8)
# Optional: color histogram becomes dark, need to fix it.
# But this may highlight remaining noise
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
res8y = clahe.apply(res8y)
res_out = np.concatenate([res8y[...,np.newaxis], res8cb[...,np.newaxis], res8cr[...,np.newaxis]], axis=-1)
Image.fromarray(res_out, mode='YCbCr').convert('RGB').save('out.png')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.