GithubHelp home page GithubHelp logo

swz30 / cycleisp Goto Github PK

View Code? Open in Web Editor NEW
484.0 484.0 69.0 12.38 MB

[CVPR 2020--Oral] CycleISP: Real Image Restoration via Improved Data Synthesis

License: Other

Python 100.00%
camera-imaging-pipeline computer-vision cvpr2020 cycleisp data-synthesis image-denoising image-restoration low-level-vision pytorch raw2rgb rgb2raw

cycleisp's People

Contributors

adityac8 avatar swz30 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cycleisp's Issues

Log Files from Training

Thank you for your awesome code!

I am hoping you might open-source the log files you have from training. Maybe the training and validation loss as a function of epoch
(and/or batch) with an estimate of the runtime?

the raw2rgb results have artifacts

I choose adobe fivek_dataset one picture “a3501-dgw_154.dng”, use rawpy to get raw picture(RGBG) and sRGB image(all crop to 512*512), but the result has artifact。here is the code:

def read_dng():
    with torch.no_grad():
        path = r'E:\MachineLearning_Data\fivek_dataset\raw_photos\HQa3501to4200\photos\a3501-dgw_154.dng'
        raw = rawpy.imread(path)
        raw_img = raw.raw_image_visible
        print(np.max(raw_img))
        width, height = 512, 512
        start_w, start_h = 1000, 1000
        raw_img_save = raw_img[start_h:start_h+height, start_w:start_w+width]
        # raw_img_save.tofile('a3501-dgw_154_crop.raw')
        raw_img_save = pack_raw(np.expand_dims(raw_img_save/(2**14-1), -1))
        raw_img_save = torch.tensor(raw_img_save, dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2).cuda()
        img_rgb = raw.postprocess(no_auto_bright=True, user_wb=raw.daylight_whitebalance)
        img_rgb_save = img_rgb[start_h:start_h+height, start_w:start_w+width, :]
        cv2.imwrite('a3501-dgw_154_crop.jpg', img_rgb_save[..., ::-1])
        img_rgb_save = torch.tensor(img_rgb_save/255.0, dtype=torch.float32).permute(2, 0, 1).cuda()
        ccm_tensor = model_ccm(img_rgb_save.unsqueeze(0))
        rgb_noisy = model_raw2rgb(raw_img_save, ccm_tensor)
        rgb_noisy = rgb_noisy.squeeze(0).permute(1, 2, 0)
        cv2.imwrite('raw2rgb_rgbg.jpg', ((rgb_noisy*255.0).cpu().detach().numpy()[..., ::-1]).astype(np.uint8))
[read_dng()]

Training code

Hello. could u please show us the training part code, thank u~

Raw2Rgb network doesnt match the one in paper

In the forward method of Raw2Rgb module in cycleisp.py, x = self.body【-1】(x) indicates that x is activated by 'nn.PReLU(n_feats)'. As the Figure-2 of paper show, it should be followed by the k-th RRG block here instead of activtion.

def forward(self, x, ccm_feat):
    x = self.head(x)
    for i in range(len(self.body)-1):
        x = self.body[i](x)
    body_out = x.clone()
    x = x * ccm_feat          ## Attention 
    x = x + body_out       
    x = self.body[-1](x)
    x = self.tail(x)
    x = self.tail_rgb(x)
    x = nn.functional.pixel_shuffle(x, 2)
    return x

Initial training of CycleISP

Hi,
I'm trying to do the initial training on the MIT-Adobe FiveK dataset. The raw image is huge which makes the loader slow. Did you do the cropping online?
Thanks.

Training code

Any updates on when will you release the training codes?

Some questions about GPU settings

Hello, I tried to train the DenoiseNet with my own code on an NVIDIA 1080 Ti GPU, but the GPU memory runs out and I can only train it with size of 64 and batch of 1.
I would like to know more training details about the GPU settings, such as GPU numbers, etc.

Training code

Could you please share your code for training model or your loss for training model?

Training Code

Any updates on when will you release the training codes?

License information

Hello,

Great work! I was wondering is it possible to add an MIT license to the code?

How to test raw images without gt?

Thanks for your good work!
How to test raw images without gt? Without gt, I can not get the variance, then I can not get the restored image.

Question about the SIDD raw results.

Can CycleISP reach 52.41dB PSNR on SIDD benchmark or just on validation set?

Even with the pretrained model, I cannot get that result on the offical server.

Version update for skimage.measure compare_psnr and compare_ssim

To run the code change "from skimage.measure.simple_metrics import compare_psnr " to " from skimage.metrics import peak_signal_noise_ratio as compare_psnr " and
"from skimage.measure import compare_ssim" to
from skimage.metrics import structural_similarity as compare_ssim
in utils/image_utils.py

These are the new version update for skimage

About 'lycon' module

Hi,when I run the 'test_dnd_rgb.py',If I didn't set the Parameter:'--save images',I can ran the code.
However,if I set the Parameter,I met the error:

Traceback (most recent call last):
  File "/workspace/Cycle/test_dnd_rgb.py", line 66, in <module>
    lycon.save(args.result_dir + 'png/'+ filenames[batch][:-4] + '.png', denoised_img)
  File "/opt/conda/lib/python3.7/site-packages/lycon/core.py", line 24, in save
    _lycon.save(path, image, options)
SystemError: <built-in function save> returned a result with an error set

Can u tell me why? Is the error of the 'lycon' version?But I only can pip install the version==0.2.0,the other version can't be pip install.

rgb2raw branch mosaic problem

In the Rgb2Raw branch,the feature map before Mosaic is HxWx3,and you use this code to generate final raw output:

def mosaic(images):
  shape = images.shape
  red = images[:, 0, 0::2, 0::2]
  green_red = images[:, 1, 0::2, 1::2]
  green_blue = images[:, 1, 1::2, 0::2]
  blue = images[:, 2, 1::2, 1::2]
  images = torch.stack((red, green_red, green_blue, blue), dim=1)
  # images = tf.reshape(images, (shape[0] // 2, shape[1] // 2, 4))
  return images

this just use litter data of images to generate raw, I find some details in your paper in Section3.1,

the Bayer sampling function f_Bayer is applied

So why just output a feature map with shape HxWx1 to full use the data?

question about the training dataset

I want to know if you only used raw images to train the RGB2RAW Network Branch and RAW2RGB Network Branch. For example, you used clean sRGB images as ground truth for optimizing RAW2RGB network, and I don't know how to get the ground truth.

Installation with lycon

We need to install cmake to run lycon. Although it is better to use cv2 than lycon
conda install cmake
pip install lycon

do this if you still want to use lycon

When is the time to open source code?

Hello
I want to reproduce the results of this thesis through the code you provided. I don't know when you will open source. I hope you open source as soon as possible to help my research. Thank you very much.

good work!

Your work is very good, can you provide the training code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.