Beispiel #1
0
import numpy as np
import tensorflow as tf
#from scipy.misc import imresize
from skimage.transform import resize
import matplotlib.pyplot as plt
from CNN_Interpolate_tf import create_CNN_int, create_loss, create_optimizer, create_placeholders, Interpolation_model

#logs_path    = "./logs"  # path to the folder that we want to save the logs for Tensorboard

# ================================= Get training data ============================================
import os
os.chdir('M:\FYS-STK4155\Project3\LoadSegyData')
from LoadTrainingData import load_dat
# Import seismic data for training
data = load_dat('Training_data.mat')

os.chdir('M:\FYS-STK4155\Project3')
# Split data to training set and test set

X_train = data[0:15]
X_test = data[15:20]

X_train = X_train[:, 0:200, :]
X_test = X_test[:, 0:200, :]

#============================= Plotting train and test sets ======================================
# plot the training and test images
n = 5
plt.figure(figsize=(10, 10))
for i in range(n):
#from skimage.transform import resize
import matplotlib.pyplot as plt
os.chdir('M:\FYS-STK4155\Project3')
from CNN_Interpolate_subpix_reg_tf import create_CNN_int, create_loss, create_optimizer, create_placeholders, Interpolation_model, create_huber_loss, create_loss_l1
from DisplayImages import display_gathers, display_training_im, plotCNNFilter
from sklearn.metrics import mean_squared_error, r2_score
from ImageMetrics import PSNR

#logs_path    = "./logs"  # path to the folder that we want to save the logs for Tensorboard

# ================================= Get training data ============================================

os.chdir('M:\FYS-STK4155\Project3\LoadSegyData')
from LoadTrainingData import load_dat
# Import seismic data for training
data = load_dat('Training_data_large.mat')

os.chdir('M:\FYS-STK4155\Project3')
# Split data to training set and test set

X_train = data[0:50]
X_test = data[50:75]

#============================= Define target data and input data for training set and test set ======================================
# Define target images
ratio = 4
target_ = X_train
target_ = np.expand_dims(target_, axis=3)
shape_target = target_.shape

target_test = X_test