Syntesis images noise detection using CNN approach

Jérôme BUISINE 0c91d181de update log information il y a 3 ans
analysis abb0ca03ba Prepare data using new dataset format (thresholds saved in file) il y a 4 ans
display cafb09f54f Refactoring and new project architecture il y a 5 ans
generate 124af56005 use of datasets path instead il y a 3 ans
models b509851b5d Add of models folder with metrics il y a 5 ans
prediction 56b71d2491 update way of saving model using Keras API il y a 4 ans
run abb0ca03ba Prepare data using new dataset format (thresholds saved in file) il y a 4 ans
simulation a159d882df Add of simulation folder il y a 5 ans
.gitignore 0e8f116e08 Clear jupyter lab checkpoints files il y a 5 ans
LICENSE f80a4942e7 Creation of dataset file script added il y a 5 ans
README.md 13e29e2a61 Add description information il y a 3 ans
__init__.py cafb09f54f Refactoring and new project architecture il y a 5 ans
cnn_models.py 54ff693378 update 2D cnn model architecture il y a 4 ans
config.py 0193803d6e Update configuration params il y a 3 ans
prediction_model.py 288e5df499 Update of train model process and modules il y a 5 ans
requirements.txt add1a54332 Update of whole project for calculco il y a 5 ans
train_lstm_weighted.py 0c91d181de update log information il y a 3 ans
train_model.py c361cbf571 fix params type issue il y a 4 ans

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

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.
  • 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.
  • prediction_model.py: script which is used to run specific model with data in order to predict.

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"
  • diff_filter: Bilateral diff filter
    • Param definition: window size expected
    • Example: "5, 5"
  • sobel_based_filter Sobel based filter
    • Param definition: K window size and pixel limite to remove
    • Example: "3, 30"
  • 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_sequence_file.py --output data/output_data_filename --folder <generated_data_folder> --features "svd_reconstruction, ipca_reconstruction, fast_ica_reconstruction" --params "100, 200 :: 50, 10 :: 50" --sequence 5 --size "100, 100" --selected_zones <zones_files.csv>

Then, train model using your custom dataset:

python train_lstm_model.py --train data/custom_dataset.train --test data/custom_dataset.test --chanels "1,3,3" --epochs 30 --batch_size 64 --seq_norm 1 --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