Code Monkey home page Code Monkey logo

all-in-one-underwater-image-enhancement-using-domain-adversarial-learning's Introduction

All-In-One-Underwater-Image-Enhancement-using-Domain-Adversarial-Learning

Code for All-In-One Underwater Image Enhancement using Domain-Adversarial Learning [paper] [arXiv]

Synthesized NYU Depth V2 Underwater Dataset based on Anwar et al. (2018)

All the dependencies can be installed by creating a conda environment from the environment.yml file as follows

conda env create --name envname -f=environments.yml

Some parts of code adopted from https://github.com/milesial/Pytorch-UNet and https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix

If you find this work helpful and plan to use this in your project, please cite us by using the following bibtex

@InProceedings{Uplavikar_2019_CVPR_Workshops,
author = {M Uplavikar, Pritish and Wu, Zhenyu and Wang, Zhangyang},
title = {All-in-One Underwater Image Enhancement Using Domain-Adversarial Learning},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2019}
}

all-in-one-underwater-image-enhancement-using-domain-adversarial-learning's People

Contributors

pritishuplavikar 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

Watchers

 avatar  avatar  avatar

all-in-one-underwater-image-enhancement-using-domain-adversarial-learning's Issues

#test results

HI,I use the "test.py" to test the checkpoint"fe_86.pth",but the results is not the same as the numbers given in the essay.I am puzzled about it,dont't know where is the wrong.please help me ,thank you!

The weight of model

Hello, thank you very much for the source code provided by your team. I ran into some problems in implementing the code. Is the weight given by the source code the same as that used in this experiment?

fE_55.pth

Hello!
I am interested in your "visualize.py ",but i need your fE_55.pth.
Meanwhile,i don't konw the 'name' in the file you made,becuse there's no 'nyu_uw_dataset'.
THANKS!

Underwater image generation is backwards

Issue

There are strange things going on in dataset_synthesis/nyu_uw_syn_script.py. If this is the code that was used to generate Figure 4 in the paper and train the model, as appears to be the case after running it, then the results are not valid.

  1. Non-standard use of the values N_lambda
  2. Random number ranges differ from those in citation

I believe (2) is an attempt to correct for (1). Regardless, the result is that the closer regions of the images are water-colored (blue or green), while the farther regions are air-colored, which is non-physical and the opposite of the "fog" effect that this model should generate. See examples below.

Probable Root Cause

The dataset synthesis is based on this project, cited through Deep Underwater Image Enhancement ([3] in the paper). The relevant "magic numbers" N_lambda (Table I in DUIE) come from a textbook, Hydrologic Optics (1975), which I was not able to find online. No code is available through either cite for the version of the well-studied atmospheric fog model that uses this particular N_lambda parameterization, and the papers do not provide quite enough information to reproduce it due to an ambiguity in going from N_lambda(d(x)) (Eq. 2 in both DUIE and All-In-One) to N_lambda as a scalar value (Table 1 in DUIE).

nyu_uw_syn_script.py has T(x) = N_lambda * d(x) (after appropriate scaling). Not being able to find the 1975 book, I turned to a newer paper, Domain Adaptive Adversarial Learning Based on Physics Model Feedback for Underwater Image Enhancement, which fully specifies the model, including the random ranges (Table I) and has T(x) = N_lambda ^ d(x) (Eq. 2). I'd guess that the existing formula in nyu_uw_syn_script.py came from accidentally omitting the parentheses while copying Eq. 2 from DUIE.

Fix

For a quick fix, replace lines 106-109 in the script

T_x = np.ndarray((480, 640, 3))
T_x[:,:,0] = N_lambda[water_type][2] * depth
T_x[:,:,1] = N_lambda[water_type][1] * depth
T_x[:,:,2] = N_lambda[water_type][0] * depth

which is equivalent to

 T_x = np.flip(N_lambda[water_type])[None, None, :] * depth[:, :, None]

with:

 T_x = np.flip(N_lambda[water_type])[None, None, :] ** depth[:, :, None]

this does not replicate DUIE due to differences in the random ranges, but it produces acceptable results.

The parameters could be further tweaked to improve quality, but I would advise other researchers to do one of the following:

  1. Write your own dataset synthesis code following Domain Adaptive Adversarial Learning Based on Physics Model Feedback for Underwater Image Enhancement
  2. Use the pre-generated NYUv2-Jerlov dataset cited above at https://li-chongyi.github.io/proj_underwater_image_synthesis.html

There's a lot of other excellent stuff in this repo, but this was definitely a stumbling block for my work, so I'd welcome input from the authors or other users on how this affects the results! I decided that the 2 options I presented were higher-value than submitting a PR to fix this code, though someone else certainly could write one up for the sake of replicability.

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.