from utils.prepare_data import get_training_data
from utils.prepare_plots import plot_results
from core.denoiser.build_simple_encoderdecoder_w_denoiser_model import simple_encoderdecoder_w_denoiser

if __name__ == "__main__":
    profile_pngs_objs, midcurve_pngs_objs = get_training_data()
    endec = simple_encoderdecoder_w_denoiser()
    original_imgs, decoded_imgs = endec.simple_encoderdecoder_w_denoiser(
        profile_pngs_objs, midcurve_pngs_objs)
    plot_results(original_imgs, decoded_imgs)
from utils.prepare_data import get_training_data
from utils.prepare_plots import plot_results
from simpleencoderdecoder.build_simple_encoderdecoder_model import simple_encoderdecoder
import random
import numpy as np

if __name__ == "__main__":
    profile_gray_objs, midcurve_gray_objs = get_training_data()
    test_gray_images = random.sample(profile_gray_objs, 5)

    profile_gray_objs = np.asarray(profile_gray_objs) / 255.
    midcurve_gray_objs = np.asarray(midcurve_gray_objs) / 255.
    test_gray_images = np.asarray(test_gray_images) / 255.

    retrain_model = True
    endec = simple_encoderdecoder()
    endec.train(profile_gray_objs, midcurve_gray_objs, retrain_model)

    original_profile_imgs, predicted_midcurve_imgs = endec.predict(
        test_gray_images)
    plot_results(original_profile_imgs, predicted_midcurve_imgs)
Пример #3
0
from utils.prepare_data import get_training_data
from utils.prepare_plots import plot_results
from denoiserencoderdecoder.build_denoiser_encoderdecoder_model import denoiser_encoderdecoder
from simpleencoderdecoder.build_simple_encoderdecoder_model import simple_encoderdecoder
from random import random

if __name__ == "__main__":
    profile_gray_objs, midcurve_gray_objs = get_training_data()
    endec = simple_encoderdecoder()
    endec.train(profile_gray_objs, midcurve_gray_objs)
    original_profile_images, noisy_predicted_midcurve_images = endec.predict(
        profile_gray_objs)
    plot_results(original_profile_images[:5],
                 noisy_predicted_midcurve_images[:5])

    denoiser = denoiser_encoderdecoder()
    retrain_model = True
    denoiser.train(noisy_predicted_midcurve_images, midcurve_gray_objs,
                   retrain_model)
    sample_noisy_midcurve_images = random.sample(
        noisy_predicted_midcurve_images, 5)
    original_noisy_midcurve_images, clean_predicted_midcurve_images = denoiser.predict(
        sample_noisy_midcurve_images)
    plot_results(original_noisy_midcurve_images,
                 clean_predicted_midcurve_images)