Syntesis images noise detection using CNN approach

Jérôme BUISINE b509851b5d Add of models folder with metrics 11 months ago
display cafb09f54f Refactoring and new project architecture 1 year ago
generate 9b58b823c3 Erase of configuration file 1 year ago
models b509851b5d Add of models folder with metrics 11 months ago
modules @ 917b396477 b509851b5d Add of models folder with metrics 11 months ago
prediction 9b58b823c3 Erase of configuration file 1 year ago
simulation a159d882df Add of simulation folder 11 months ago
.gitignore cafb09f54f Refactoring and new project architecture 1 year ago
.gitmodules 43515d6945 Update of submodules 1 year ago
LICENSE f80a4942e7 Creation of dataset file script added 1 year ago
README.md a159d882df Add of simulation folder 11 months ago
__init__.py cafb09f54f Refactoring and new project architecture 1 year ago
cnn_models.py b509851b5d Add of models folder with metrics 11 months ago
custom_config.py cafb09f54f Refactoring and new project architecture 1 year ago
requirements.txt 630b46743f Add of static transformation 1 year ago
run.sh 9032a6ccf6 Update of run script 1 year ago
run_tl_test.sh f26aaff16c Update of Transfer learning bash script 11 months ago
train_model.py 8fc7c020c1 Add of all models into this project and no longer in common modules 11 months ago

README.md

Noise detection with CNN

Requirements

git clone --recursive https://github.com/prise-3d/Thesis-NoiseDetection-CNN.git
pip install -r requirements.txt

Project structure

Link to your dataset

You have to create a symbolic link to your own database which respects this structure:

  • dataset/
    • Scene1/
    • zone00/
    • ...
    • zone15/
      • seuilExpe (file which contains threshold samples of zone image perceived by human)
    • Scene1_00050.png
    • Scene1_00070.png
    • ...
    • Scene1_01180.png
    • Scene1_01200.png
    • Scene2/
    • ...
    • ...

Create your symbolic link:

ln -s /path/to/your/data dataset

Code architecture description

  • modules/*: contains all modules usefull for the whole project (such as configuration variables)
  • analysis/*: contains all jupyter notebook used for analysis during thesis
  • generate/*: contains python scripts for generate data from scenes (described later)
  • prediction/*: all python scripts for predict new threshold from computed models
  • simulation/*: contains all bash scripts used for run simulation from models
  • display/*: contains all python scripts used for display Scene information (such as Singular values...)
  • run/*: bash scripts to run few step at once :
    • generate custom dataset
    • train model
    • keep model performance
    • run simulation (if necessary)
  • others/*: folders which contains others scripts such as script for getting performance of model on specific scene and write it into Mardown file.
  • data_attributes.py: files which contains all extracted features implementation from an image.
  • custom_config.py: override the main configuration project of modules/config/global_config.py
  • train_model.py: script which is used to run specific model available.

Generated data directories:

  • data/*: folder which will contain all generated .train & .test files in order to train model.
  • saved_models/*: all scikit learn or keras models saved.
  • models_info/*: all markdown files generated to get quick information about model performance and prediction obtained after running run/runAll_*.sh script.
  • results/: This folder contains model_comparisons.csv file used for store models performance.

How to use

Generate reconstructed data from specific method of reconstruction (run only once time or clean data folder before):

python generate/generate_reconstructed_data.py -h

Generate custom dataset from one reconstructed method or multiples (implemented later)

python generate/generate_dataset.py -h

Reconstruction parameter (--params)

List of expected parameter by reconstruction method:

  • svd_reconstruction: Singular Values Decomposition
    • Param definition: interval data used for reconstruction (begin, end)
    • Example: "100, 200"
  • ipca_reconstruction: Iterative Principal Component Analysis
    • Param definition: number of components used for compression and batch size
    • Example: "30, 35"
  • fast_ica_reconstruction: Fast Iterative Component Analysis
    • Param definition: number of components used for compression
    • Example: "50"
  • static Use static file to manage (such as z-buffer, normals card...)
    • Param definition: Name of image of scene need to be in {sceneName}/static/xxxx.png
    • Example: "img.png"

Example:

python generate/generate_dataset.py --output data/output_data_filename --features "svd_reconstruction, ipca_reconstruction, fast_ica_reconstruction" --renderer "maxwell" --scenes "A, D, G, H" --params "100, 200 :: 50, 10 :: 50" --nb_zones 10 --random 1

Then, train model using your custom dataset:

python train_model.py --data data/custom_dataset --output output_model_name

Predict image using model

Now we have a model trained, we can use it with an image as input:

python prediction/predict_noisy_image.py --image path/to/image.png --model saved_models/xxxxxx.json --features 'svd_reconstruction' --params '100, 200'
  • features: feature choices need to be one of the listed above.

The model will return only 0 or 1:

  • 1 means noisy image is detected.
  • 0 means image seem to be not noisy.

Simulate model on scene

All scripts named prediction/predict_seuil_expe*.py are used to simulate model prediction during rendering process.

Once you have simulation done. Checkout your threshold_map/%MODEL_NAME%/simulation_curves_zones_*/ folder and use it with help of display_simulation_curves.py script.

License

MIT