@@ -6,12 +6,22 @@ This project aims at automatically denoising phase images using a CNN residual f
...
@@ -6,12 +6,22 @@ This project aims at automatically denoising phase images using a CNN residual f
## Prerequisites TODO
## Prerequisites TODO
This project needs the following python3 packages
This project needs the following python3 packages
```
```
pip3 install arparse pathlib os sys PIL numpy scipy
conda install -c pytorch pytorch
conda install pillow
conda install scipy
conda install matplotlib
conda install -c pytorch torchvision
```
```
Python == 3.9
PyTorch == 1.7.1
PyTorch == 1.7.1
## Parameters
## Parameters
Modifiable parameters are located in argument.py
Modifiable parameters are located in argument.py
Use the following command to see thee different parameters you can use.
```
python3 main_holo.py --help
```
## Localization of data and generation of patches
## Localization of data and generation of patches
...
@@ -30,30 +40,31 @@ All phase data is converted using sine or cosine functions and normalized betwee
...
@@ -30,30 +40,31 @@ All phase data is converted using sine or cosine functions and normalized betwee
Patch size can be given as an argument in the command line either if images .tiff are all in the same directory, or if the .mat files are given in seperated directories.
Patch size can be given as an argument in the command line either if images .tiff are all in the same directory, or if the .mat files are given in seperated directories.
This command generates two numpy matrices of size (nb_patch, patch_size, patch_size,1) one for noisy images, the other for clean references.
This command generates two numpy matrices of size (args.batch_size * nb_image, patch_size, patch_size,1) one for noisy images, the other for clean references.
## Manual
## Manual
You have to manualy download the holography database and put it in the directory.
In order to train models you have to manualy download an holography database and give the path to that directory for training database (args.train_dir) evaluating database (args.eval_dir) and testing database (args.test_dir).
The database can be found on skinner /info/etu/m1/s171085/Projets/Portage-Keras-PyTorch/Portage-reseau-de-neurones-de-Keras-vers-PyTorch/dncnn-tensorflow-holography-master/Holography (a new link will be available later)
The application can be used with the main_holo.py script with different arguments from the argument.py script
A database can be found on skinner /info/etu/m1/s171085/Projets/Portage-Keras-PyTorch/Portage-reseau-de-neurones-de-Keras-vers-PyTorch/dncnn-tensorflow-holography-master/Holography or here https://lium-cloud.univ-lemans.fr/index.php/s/8gLGetFsFcGQgMo
To start a training with default param you can use the command
The application is used with the main_holo.py script with different arguments from the argument.py script.
To start a training with default parameters you can use the command.
```
```
#launch a training
#launch a training
python3 main_holo.py
python3 main_holo.py
```
```
You can precise the training and eval data with the arguments noisy_train, clean_train, noisy_eval and clean_eval
You can precise the training data with the arguments noisy_train, clean_train. Ans the eval data with the arguments eval_patterns and eval_noises.
The usable data are generated with the generate_patches_holo.py and generate_patches_holo_fromMAT.py scripts and saved in a directory named "data1".
The data are generated with the generate_patches_holo.py and generate_patches_holo_fromMAT.py scripts and saved in a directory named "data1".
For data adapation you have to give the size and the number of channel of the image you will be using in the argument image_size and image_mode (for training or testing).
For data adapation you have to give the size and the number of channel of the image you will be using in the argument (train|eval|test)_image_size and image_mode.
```
```
#launch a training in which the image will be 50 by 50 in black and white
#launch a training in which the image will be 50 by 50 in black and white
To do a de-noising operation you can use the test_mode argument.
To do a de-noising operation you have to use the test_mode argument.
You can use the argument test_noisy_img, test_noisy_key, test_clean_img and test_clean_key to precise which image you want to de-noise
You can use the argument test_noisy_img, test_noisy_key, test_clean_img and test_clean_key to precise which image you want to de-noise
The clean image will only be used to give the level of remaining noise after the de-noising operation. If you don't have a clean reference just give the noisy reference again.
```
```
#launch a denoising operation on the image DATA_1_Phase_Type1_2_0.25_1.5_4_50.mat with the model experiment_xxx at the epoch 130
#launch a denoising operation on the image DATA_1_Phase_Type1_2_0.25_1.5_4_50.mat with the model experiment_xxx at the epoch 130
If you do not give an image to de-noise an evaluation of the entire training and testing database you start.
If you do not give an image to de-noise, an evaluation of the entire training and testing database will be done start.
```
```
#launch a denoising operation on the 25 images of Holography/DATABASE and Holography/DATAEVAL/DATAEVAL database with the model experiment_xxx at the epoch 130
#launch a denoising operation on the 25 images of Holography/DATABASE and Holography/DATAEVAL/DATAEVAL database with the model experiment_xxx at the epoch 130