Giter Club home page Giter Club logo

Comments (12)

yu4u avatar yu4u commented on June 15, 2024

Try it!
The models in this repo were basically trained using images with "ideal" noises.
Therefore, it might not work well for real noises.

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

@yu4u I used your script command:
python3 train.py --image_dir dataset/291 --test_dir dataset/Set14 --image_size 128 --batch_size 8 --lr 0.001 --source_noise_model text,0,50 --target_noise_model text,0,50 --val_noise_model text,25,25 --loss mae --output_path text_noise
python3 train.py --image_dir dataset/291 --test_dir dataset/Set14 --image_size 128 --batch_size 8 --lr 0.001 --source_noise_model impulse,0,95 --target_noise_model impulse,0,95 --val_noise_model impulse,70,70 --loss l0 --output_path impulse_noise
and use --model unet for training, but when I test the result , why they are noised all by white Gaussian noise? i see that result image, the middle image is noised by white Gaussian . Why?

from noise2noise.

yu4u avatar yu4u commented on June 15, 2024

Please refer to README.

python3 test_model.py --weight_file [trained_model_path] --image_dir dataset/Set14

optional arguments:
  -h, --help            show this help message and exit
  --image_dir IMAGE_DIR
                        test image dir (default: None)
  --model MODEL         model architecture ('srresnet' or 'unet') (default:
                        srresnet)
  --weight_file WEIGHT_FILE
                        trained weight file (default: None)
  --test_noise_model TEST_NOISE_MODEL
                        noise model for test images (default: gaussian,25,25)
  --output_dir OUTPUT_DIR
                        if set, save resulting images otherwise show result
                        using imshow (default: None)

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

@yu4u I am new in denoise and image reconstruction, the function for calculating PSNR is right? def cal_PSNR(pred_img, gt_img): return 10.0 * np.log10((255.0 ** 2) / (np.mean(np.square(pred_img - gt_img))))
can you help me check this? I test the model with random-impulse noise, I do not think the denoisy images are good, but the PSNR calculate from the function is almost 25. So are there some problems? Thank you!

from noise2noise.

yu4u avatar yu4u commented on June 15, 2024

PSNR=25 indicates poor image quality as you felt.

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

Hi! @yu4u I am sorry for interrupting you again! But there is a problem about Evaluation. the PSNR from the validation can see from the h5df file. And I use PSNR formula on the Internet to calculate the PSNR again, but the two values are not the same. why?
the PSNR formula on the Internet:
def cal_PSNR(pre,gt): return 10.0*np.log10((255.0 ** 2) / (np.mean(np.square(pre-gt)))

from noise2noise.

yu4u avatar yu4u commented on June 15, 2024

The two implementations are same.
... Is this not what you meant?

    a = np.random.uniform(0, 255, (100, 100, 3))
    b = np.random.uniform(0, 255, (100, 100, 3))
    print(cal_PSNR(a, b))
    sess = tf.Session()
    r = PSNR(tf.constant(a), tf.constant(b))
    with sess.as_default():
        print(r.eval())

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

@yu4u after training, I see the value from the filename, such as the val_PSNR is 25, but I test the images which are validate dataset again, but the PSNR calculate by the following formula is not the same with yours. I do not know why, so this is the question... hoping for your kind respond.

from noise2noise.

yu4u avatar yu4u commented on June 15, 2024

How different? If the difference is not so large, it would have been caused by the randomness of the noisy images. The noisy images are created online without fixing the random seed (yes this should be fixed for reproducibility).

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

The difference is big, I used your code on my own dataset, the performance is good! But the only thing confused me is that the values of val_PSNR and PSNR that I tested latter are not the same, the val_PSNR is almost 27, but the test PSNR using the formula above is almost 32. I am sure the val_folder and test_folder are the same..... and for comparison, I have crop my images all to 1281283 size. The random seed? The val generator calculated in order, is it related to randomness? @yu4u

from noise2noise.

yu4u avatar yu4u commented on June 15, 2024

Hmm, something is wrong.
As you indicated, PSNR calculated in test_model.py is higher than that in training log...

from noise2noise.

wqz960 avatar wqz960 commented on June 15, 2024

yes! But I have debugged the Val_inputimg, the input seems correct, for API in keras, I don’t know how to fix it. Can you help me for this? I need the validation log for showing something.Thank you!

from noise2noise.

Related Issues (20)

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.