GithubHelp home page GithubHelp logo

image-denoise-using-wasserstein-gan's People

Contributors

juju-w avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

georgeslabreche

image-denoise-using-wasserstein-gan's Issues

the channel_axis parameter needs to be set when invoking the structural_similarity function

When working with multichannel images the channel_axis parameter needs to be set to -1 (or 2). Without it, the following line of code:

ssim = np.mean(np.array([structural_similarity(imgraw[n], fake_img[n], multichannel=True, data_range=1) for n in range(n_val)]))

Raises a the following error when invoking structural_similarity from scikit-image==0.21.0:

ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.

Suggested change:

# ssim calculation
ssim_values = [
    structural_similarity(
        imgraw[n], 
        fake_img[n], 
        multichannel=True, 
        data_range=1, 
        channel_axis=-1
    ) 
    for n in range(n_val)
]
ssim = np.mean(np.array(ssim_values))

My dependency versions are:

tensorflow<2.11
wget==3.2
tqdm==4.64.1
opencv-python-headless==4.8.0.76
opencv-python==4.8.0.76
scikit-image==0.21.0
numpy==1.25.2
pandas==2.0.3

fake_img generator expects a 4-dim input but is given a 3-dim input

This issue can occurs here:

fake_img = [generator(tf.convert_to_tensor(val_image)).numpy() for val_image in batch_val_noise]

It can be resolved by:

  1. Specifying axis=0 to expand the dimensions of val_image and make it 4-dimensional.
  2. Returning to 3-dimensions by using np.squeeze to squeeze out the extra dimension.

Suggested change:

fake_img = [np.squeeze(generator(tf.expand_dims(tf.convert_to_tensor(val_image), axis=0)).numpy()) for val_image in batch_val_noise]

My dependency versions are:

tensorflow<2.11
wget==3.2
tqdm==4.64.1
opencv-python-headless==4.8.0.76
opencv-python==4.8.0.76
scikit-image==0.21.0
numpy==1.25.2
pandas==2.0.3

divide by zero error prior to saving weights

The call to range(5) produces a sequence of numbers from 0 to 4. This results in a division by zero on the following line:

elif epoch in [N_EPOCHS // t for t in range(5)]:

Maybe what was intended was range(1, 5) for a sequence from 1 to 4 or range(1, 6) for a sequence from 1 to 5?

My dependency versions are:

tensorflow<2.11
wget==3.2
tqdm==4.64.1
opencv-python-headless==4.8.0.76
opencv-python==4.8.0.76
scikit-image==0.21.0
numpy==1.25.2
pandas==2.0.3

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.