Use the following command to see thee different parameters you can use.
```
python3 main_holo.py --help
```
Modifiable parameters are located in the config file under YAML format.
An example is given in dataset.yaml
## Localization of data and generation of patches
Data is either .tiff images or .mat MATLAB matrices. Three databases are available for the moment:
Data is either .tiff images or .mat MATLAB matrices.
While tiff matrices contains discrete pixels values, matlab matrices contains directly the phase image.
Four databases are available for the moment:
* HOLODEEPmat: MATLAB images for training and development purposes: 5 patterns and 5 noise level, 1024x1024
* DATAEVAL: 3 MATLAB images for evaluation purposes: Data1, Data20 and VibMap.
* DB99: 128 MATLAB images , 1024x1024
* NATURAL: 400 images in B&W for image denoising, noisy images are obtained with additive Gaussian noise: 180x180
Clean reference data is located in argument.clean_src_dir
Noisy input data is located in argument.noisy_src_dir
Images from HOLODEEP are referred by their name according to their pattern number (argument.train_patterns from 1 to 5), their noise level (hparams.train_noises 0, 1, 1.5, 2 or 2.5). Images for train and developpement (or test) and final evaluation (eval) are given by "train", "test" or "eval" suffix.
All phase data is converted using sine or cosine functions and normalized between 0 and 1 for being in agreement with the output of the network. A propotional coefficient is applied on the predicted image to rescale the pahse amplitude between -pi and pi.
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.
The train/dev/test datasets are explicited in a csv file containing the following header and the list of corresponding image lcoations
```
python3 generate_patches_holo.py --patch_size 100
python3 generate_patches_holo_fromMat.py
clean, noisy, Ns
NOISEFREE.tiff,NOISY.tiff,0
```
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.
The Ns value corresponds to the speckle grain size used to generate the noisy image from the clean image.
Images from HOLODEEP are referred by their name according to their pattern number (argument.train_patterns from 1 to 5), their noise level (hparams.train_noises 0, 1, 1.5, 2 or 2.5). Images for train and developpement (or test) and final evaluation (eval) are given by "train", "test" or "eval" suffix.
All phase data is converted using sine or cosine functions and normalized between 0 and 1 for being in agreement with the output of the network. A propotional coefficient is applied on the predicted image to rescale the phase amplitude between -pi and pi.
Patch size is given as an argument to the DataLoader directly in the config file.
## Manual
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).
...
...
@@ -54,69 +50,92 @@ The application is used with the main_holo.py script with different arguments fr
To start a training with default parameters you can use the command.
```
#launch a training
python3 main_holo.py
python main_holo.py --config dataset.yaml
```
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 data are generated with the generate_patches_holo.py and generate_patches_holo_fromMAT.py scripts and saved in a directory named "data1".
# data augmentation function applied on all patches.
```
The possible data augmentation functions are the followings:
**add45*: adds an angle of pi/4 to the current phase
**transpose*: transposes the patch in the phase domain
**cossin*: compute the cosine and sine transforms of the phase values. If no, compute the cosine or sine transforms
**flip*: flip up down the cosine or sine image
**rot90* (90, 180, 270): rotate the cosine or sine image of 90 degrees (or 180, or 270)
**add45transpose*: combines both augmentation functions
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.
You can precise in the config file the different hyperparameters for the training:
```
#launch a training in which the image will be 50 by 50 in black and white
output_dir: null # directory of saved checkpoints for denoising operation or retraining
start_epoch: 130 #'epoch\'s number from which we going to retrain' if > 0 a model has to be saved in the input_dir
```
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
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