Commit bde612fd authored by Noury Robin's avatar Noury Robin
Browse files

Message de validation

parent a9b51b74
...@@ -81,7 +81,7 @@ def generate_patches(isDebug=True): ...@@ -81,7 +81,7 @@ def generate_patches(isDebug=True):
print(hparams_debug_string()) print(hparams_debug_string())
#filepaths = [x for x in src_path.glob('*.tiff')] #('*.mat') #filepaths = [x for x in src_path.glob('*.tiff')] #('*.mat')
#noisyfilepaths = [x for x in noisy_path.glob('*.tiff')] #('*.mat') #noisyfilepaths = [x for x in noisy_path.glob('*.tiff')] #('*.mat')
cleanmat, noisymat = from_DATABASE(hparams.eval_dir, hparams.train_noise, hparams.train_patterns) cleanmat, noisymat = from_DATABASE(hparams.train_dir, hparams.train_noise, hparams.train_patterns)
#ipdb.set_trace() #ipdb.set_trace()
print("number of clean training data {0} and noisy {1}".format( len(cleanmat), len(noisymat))) print("number of clean training data {0} and noisy {1}".format( len(cleanmat), len(noisymat)))
scales = 1 #et on ne le bouge pas !!!! hparams.scales #old version [1, 0.9, 0.8, 0.7] scales = 1 #et on ne le bouge pas !!!! hparams.scales #old version [1, 0.9, 0.8, 0.7]
...@@ -171,7 +171,7 @@ def generate_patches(isDebug=True): ...@@ -171,7 +171,7 @@ def generate_patches(isDebug=True):
print('shape of inputs: ', cleaninputs.shape) print('shape of inputs: ', cleaninputs.shape)
print('amplitude of inputs: ', np.max(cleaninputs), np.min(cleaninputs)) print('amplitude of inputs: ', np.max(cleaninputs), np.min(cleaninputs))
sess_name = extract_sess_name(hparams.train_patterns, hparams.train_noise, hparams.phase_type, hparams.stride, hparams.patch_size, hparams.patch_per_image) sess_name = extract_sess_name(hparams.train_noise, hparams.train_noise, hparams.phase_type, hparams.stride, hparams.patch_size, hparams.patch_per_image)
if not os.path.exists(args.save_dir): if not os.path.exists(args.save_dir):
os.mkdir(args.save_dir) os.mkdir(args.save_dir)
np.save(os.path.join(args.save_dir, "img_clean_train_" + sess_name), cleaninputs) np.save(os.path.join(args.save_dir, "img_clean_train_" + sess_name), cleaninputs)
......
...@@ -36,10 +36,10 @@ __status__ = "Production" ...@@ -36,10 +36,10 @@ __status__ = "Production"
# Default hyperparameters: # Default hyperparameters:
hparams = tf.contrib.training.HParams( hparams = tf.contrib.training.HParams(
#to train on HOLODEEP tiff images #to train on HOLODEEP tiff images
noise_src_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train2/', noise_src_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train2',
clean_src_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train2/', clean_src_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train2',
eval_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/HOLODEEPmat/', eval_dir = '/info/etu/slbm/e161513/dncnn-tensorflow-holography/HOLODEEPmat/',
train_dir='/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train2/', train_dir='/info/etu/slbm/e161513/dncnn-tensorflow-holography/DB_Train12/',
#to train on matlab images #to train on matlab images
#eval_dir = '/lium/raid01_c/tahon/holography/HOLODEEPmat/', #eval_dir = '/lium/raid01_c/tahon/holography/HOLODEEPmat/',
#to train on natural images #to train on natural images
...@@ -53,8 +53,9 @@ hparams = tf.contrib.training.HParams( ...@@ -53,8 +53,9 @@ hparams = tf.contrib.training.HParams(
originalsize = (1024,1024), #1024 for matlab database, 128 for holodeep database, 180 for natural images originalsize = (1024,1024), #1024 for matlab database, 128 for holodeep database, 180 for natural images
phase_type = 'two', #keep phase between -pi and pi (phi), convert into cosinus (cos) or sinus (sin) phase_type = 'two', #keep phase between -pi and pi (phi), convert into cosinus (cos) or sinus (sin)
#select images for training #select images for training
train_patterns = [1, 2, 3, 4, 5,6,7], #number of images from 1 to 5 #train_patterns = [1, 2, 3, 4, 5,6,7], #number of images from 1 to 5
train_noise = '1-1.5-2-2.5-3', # [0.5, 1, 1.5, 2, 2.5,3], train_patterns = [x+1 for x in range(300)],
train_noise ='3', # [0.5, 1, 1.5, 2, 2.5,3],
#select images for evaluation (during training) #select images for evaluation (during training)
eval_patterns = [1, 2, 3, 4, 5], eval_patterns = [1, 2, 3, 4, 5],
eval_noise = '0-1-1.5-2-2.5', eval_noise = '0-1-1.5-2-2.5',
......
...@@ -68,7 +68,7 @@ hparams.parse(args.params) ...@@ -68,7 +68,7 @@ hparams.parse(args.params)
def denoiser_train(denoiser, lr): def denoiser_train(denoiser, lr):
#avec load_data les images sont déjà normalisée par 255.0 #avec load_data les images sont déjà normalisée par 255.0
sess_name = extract_sess_name(hparams.train_patterns, hparams.train_noise, hparams.phase_type, hparams.stride, hparams.patch_size, hparams.patch_per_image) sess_name = extract_sess_name(hparams.train_noise, hparams.train_noise, hparams.phase_type, hparams.stride, hparams.patch_size, hparams.patch_per_image)
#for training with natural images #for training with natural images
#sess_name = 'natural_phi' #sess_name = 'natural_phi'
print('session name: ', sess_name) print('session name: ', sess_name)
......
...@@ -240,7 +240,7 @@ class denoiser(object): ...@@ -240,7 +240,7 @@ class denoiser(object):
#self.evaluate(iter_num, eval_data, sample_dir=sample_dir, summary_merged=summary_psnr, summary_writer=writer, sess_name=sess_name, phase_type=phase_type, nb_layers=nb_layers) # eval_data value range is 0-255 #self.evaluate(iter_num, eval_data, sample_dir=sample_dir, summary_merged=summary_psnr, summary_writer=writer, sess_name=sess_name, phase_type=phase_type, nb_layers=nb_layers) # eval_data value range is 0-255
for epoch in range(start_epoch, epoch): for epoch in range(start_epoch, epoch):
#np.random.shuffle(data) #no shuffle for the moment #np.random.shuffle(data) #no shuffle for the moment
#shuffle target and source synchronously with random permutation at each epoch. #shuffle targese and source synchronously with random permutation at each epoch.
ind = np.random.permutation(numPatch) ind = np.random.permutation(numPatch)
data_clean = data_clean[ind, :,:,:] data_clean = data_clean[ind, :,:,:]
data_noisy = data_noisy[ind, :,:,:] data_noisy = data_noisy[ind, :,:,:]
......
#!/bin/bash #!/bin/bash
#SBATCH -p gpu #SBATCH -p gpu
#SBATCH --gres gpu:1 #SBATCH --gres gpu:rtx6000:1
#SBATCH --mem 40G
#SBATCH --mail-type=ALL #SBATCH --mail-type=ALL
#SBATCH --mail-user=robin.noury.etu@univ-lemans.fr #SBATCH --mail-user=robin.noury.etu@univ-lemans.fr
#SBATCH -o test_debruitage.out #SBATCH -o test_debruitage.out
#SBATCH --time 20-00 #SBATCH --time 40-00
#noisyImg=$1 #noisyImg=$1
#cleanImg=$2 #cleanImg=$2
#runTest=/lium/raid01_c/tahon/holography/checkpoints/run-test2020-04-12_12\:14\:29.082341/ #runTest=/lium/raid01_c/tahon/holography/checkpoints/run-test2020-04-12_12\:14\:29.082341/
...@@ -17,22 +16,21 @@ for num in 1 2 3 4 5; do ...@@ -17,22 +16,21 @@ for num in 1 2 3 4 5; do
noisyImg=./HOLODEEPmat/Pattern$num/MFH_$lambda/NoisyPhase.mat noisyImg=./HOLODEEPmat/Pattern$num/MFH_$lambda/NoisyPhase.mat
#noisyImg=/lium/raid01_c/tahon/holography/HOLODEEPmat/PATTERN$num/MFH_$lambda/run-test2020-04-12_12\:14\:29.082341/run-test2020-04-12_12\:14\:29.082341/NoisyPhase.mat-27000.mat-27000.mat #noisyImg=/lium/raid01_c/tahon/holography/HOLODEEPmat/PATTERN$num/MFH_$lambda/run-test2020-04-12_12\:14\:29.082341/run-test2020-04-12_12\:14\:29.082341/NoisyPhase.mat-27000.mat-27000.mat
cleanImg=./HOLODEEPmat/Pattern$num/PhaseDATA.mat cleanImg=./HOLODEEPmat/Pattern$num/PhaseDATA.mat
echo $noisyImg >> TEST-TRAIN_1.res echo $noisyImg >> TEST-TRAIN_2_315.res
python main_holo.py --test_noisy_img $noisyImg --test_noisy_key 'NoisyPhase' --test_clean_img $cleanImg --test_clean_key 'Phase' --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_1.res python main_holo.py --test_noisy_img $noisyImg --test_noisy_key 'NoisyPhase' --test_clean_img $cleanImg --test_clean_key 'Phase' --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_2_315.res
done done
done done
test1=./DATAEVAL/DATA_1_Phase_Type1_2_0.25_1.5_4_50.mat test1=./DATAEVAL/DATA_1_Phase_Type1_2_0.25_1.5_4_50.mat
test2=./DATAEVAL/DATA_20_Phase_Type4_2_0.25_2.5_4_100.mat test2=./DATAEVAL/DATA_20_Phase_Type4_2_0.25_2.5_4_100.mat
test3=./DATAEVAL/VibPhaseDATA.mat test3=./DATAEVAL/VibPhaseDATA.mat
test4=./Base_exp_test_double_impact/Temps_200/NoisyPhase.mat
keyNoisy='Phaseb' keyNoisy='Phaseb'
keyClean='Phase' keyClean='Phase'
echo $test1 echo $test1
python main_holo.py --test_noisy_img $test1 --test_noisy_key $keyNoisy --test_clean_img $test1 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_1.res python main_holo.py --test_noisy_img $test1 --test_noisy_key $keyNoisy --test_clean_img $test1 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_2_315.res
echo $test2 echo $test2
python main_holo.py --test_noisy_img $test2 --test_noisy_key $keyNoisy --test_clean_img $test2 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_1.res python main_holo.py --test_noisy_img $test2 --test_noisy_key $keyNoisy --test_clean_img $test2 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_2_315.res
echo $test3 echo $test3
python main_holo.py --test_noisy_img $test3 --test_noisy_key $keyNoisy --test_clean_img $test3 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_1.res python main_holo.py --test_noisy_img $test3 --test_noisy_key $keyNoisy --test_clean_img $test3 --test_clean_key $keyClean --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_2_315.res
echo $test4
python main_holo.py --test_noisy_img $test4 --test_noisy_key $keyNoisy --test_flip False --test_ckpt_index $runTest >> TEST-TRAIN_1.res
#!/bin/bash #!/bin/bash
#SBATCH -p gpu #SBATCH -p gpu
#SBATCH --gres gpu:1 #SBATCH --gres gpu:1
#SBATCH --mem 40G #SBATCH --mem 80G
#SBATCH --mail-type=ALL #SBATCH --mail-type=ALL
#SBATCH --mail-user=robin.noury.etu@univ-lemans.fr #SBATCH --mail-user=robin.noury.etu@univ-lemans.fr
#SBATCH -o holo_two_train_noise0-1.5.out #SBATCH -o holo_train12.out
#SBATCH --time 20-00 #SBATCH --time 50-00
source activate hologaphy source activate hologaphy
#python generate_patches_holo_fromMAT.py --params "phase_type=two" #python generate_patches_holo_fromMAT.py --params "phase_type=two"
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment