Synthesis Images noise detection metrics developed including all approaches using SVD or others compression methods

Jérôme BUISINE c43d718f20 Merge branch 'release/v0.2.3' 5 anos atrás
analysis 5bedd5f24a Add of SV filters metric 5 anos atrás
fichiersSVD_light 6ca84d364a Add of notebook analysis data 5 anos atrás
modules 5bedd5f24a Add of SV filters metric 5 anos atrás
.gitignore 95da79a75f Update gitignore file 5 anos atrás
LICENCE e1a8d9154f Add of script generator 6 anos atrás
README.md 2de453cd39 Update of project documentation; Add of scripts to run with custom min max file 6 anos atrás
deep_network_keras_svd.py 9d3f09fdf0 Split data generation script 5 anos atrás
display_bits_shifted_scene.py 8e62160c46 Refactoring of whole project; Use of custom min max file available 6 anos atrás
display_scenes_zones.py 2bce603bb4 Python scripts updated caused by new version of IPFML 6 anos atrás
display_scenes_zones_shifted.py 2bce603bb4 Python scripts updated caused by new version of IPFML 6 anos atrás
display_simulation_curves.py 69fa81b893 Update of display simulations curves 5 anos atrás
display_svd_area_data_scene.py 705c07776a Add of new extracted data 5 anos atrás
display_svd_area_scenes.py dfaee0db83 List of models to simulate 5 anos atrás
display_svd_data_error_scene.py 639b419169 Update of run simulations 5 anos atrás
display_svd_data_scene.py 6ca84d364a Add of notebook analysis data 5 anos atrás
display_svd_zone_scene.py 6a0b0ddaaf Display script updates; Add of new metric 5 anos atrás
generateAndTrain_maxwell.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
generateAndTrain_maxwell_custom.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
generateAndTrain_maxwell_custom_center.sh 15f256d47d Add of new generation script 5 anos atrás
generateAndTrain_maxwell_custom_filters.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
generateAndTrain_maxwell_custom_filters_center.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
generateAndTrain_maxwell_custom_filters_split.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
generateAndTrain_maxwell_custom_split.sh 427b6461e6 Erase of step for split run bash script 5 anos atrás
generate_all_data.py 2bce603bb4 Python scripts updated caused by new version of IPFML 6 anos atrás
generate_all_simulate_curves.sh 69fa81b893 Update of display simulations curves 5 anos atrás
generate_data_model.py dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
generate_data_model_corr_random.py 8a42eb5742 Update of simulation script for keras models 5 anos atrás
generate_data_model_random.py a1b9cd78b1 Study of Julia; Correction of simulation script 5 anos atrás
generate_data_model_random_center.py 15f256d47d Add of new generation script 5 anos atrás
generate_data_model_random_split.py 9d3f09fdf0 Split data generation script 5 anos atrás
generate_metrics_curve.sh 2a5c94de35 Correlation and MSCN analysis 5 anos atrás
julia_train_model.jl a1b9cd78b1 Study of Julia; Correction of simulation script 5 anos atrás
predict_noisy_image_svd.py 639b419169 Update of run simulations 5 anos atrás
predict_seuil_expe.py 2bce603bb4 Python scripts updated caused by new version of IPFML 6 anos atrás
predict_seuil_expe_maxwell.py 8e62160c46 Refactoring of whole project; Use of custom min max file available 6 anos atrás
predict_seuil_expe_maxwell_curve.py 8e62160c46 Refactoring of whole project; Use of custom min max file available 6 anos atrás
prediction_scene.py dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
requirements.txt 5911c7da90 New models creation 6 anos atrás
runAll_display_data_scene.sh 639b419169 Update of run simulations 5 anos atrás
runAll_maxwell.sh 2a5c94de35 Correlation and MSCN analysis 5 anos atrás
runAll_maxwell_area.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
runAll_maxwell_area_normed.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
runAll_maxwell_corr_custom.sh 639b419169 Update of run simulations 5 anos atrás
runAll_maxwell_custom.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_custom_center.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_custom_filters.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_custom_filters_center.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_custom_filters_split.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_custom_split.sh 7a794b7d11 Update of SV filters scripts 5 anos atrás
runAll_maxwell_keras.sh f344a35396 Add of mscn var runs 5 anos atrás
runAll_maxwell_keras_corr.sh 5aede5ae1e Update of scripts 5 anos atrás
runAll_maxwell_keras_corr_custom.sh 5aede5ae1e Update of scripts 5 anos atrás
runAll_maxwell_mscn_var.sh 51606962b8 Update of predict svd script 5 anos atrás
runAll_maxwell_sub_blocks_stats.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
runAll_maxwell_sub_blocks_stats_reduced.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
run_maxwell_simulation.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
run_maxwell_simulation_corr_custom.sh 639b419169 Update of run simulations 5 anos atrás
run_maxwell_simulation_custom.sh a1b9cd78b1 Study of Julia; Correction of simulation script 5 anos atrás
run_maxwell_simulation_keras_corr_custom.sh 8a42eb5742 Update of simulation script for keras models 5 anos atrás
run_maxwell_simulation_keras_custom.sh dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
save_model_result_in_md.py 8e62160c46 Refactoring of whole project; Use of custom min max file available 6 anos atrás
save_model_result_in_md_maxwell.py dea1dbfb30 Update of simulations scripts; New data generation file; 5 anos atrás
testModelByScene.sh 1e4d9432f5 Add possibility of metric implementation quickly 6 anos atrás
testModelByScene_maxwell.sh 705c07776a Add of new extracted data 5 anos atrás
train_model.py 8e62160c46 Refactoring of whole project; Use of custom min max file available 6 anos atrás

README.md

Noise detection using SVM

Requirements

pip install -r requirements.txt

Generate all needed data for each metrics

python generate_all_data.py --metric all

For noise detection, many metrics are available :

  • lab
  • mscn
  • mscn_revisited
  • low_bits_2
  • low_bits_4
  • low_bits_5
  • low_bits_6
  • low_bits_4_shifted_2

You can also specify metric you want to compute and image step to avoid some images :

python generate_all_data.py --metric mscn --step 50
  • step : keep only image if image id % 50 == 0 (assumption is that keeping spaced data will let model better fit).

How to use

Multiple folders and scripts are availables :

  • fichiersSVD_light/* : all scene files information (zones of each scene, SVD descriptor files information and so on...).
  • train_model.py : script which is used to run specific model available.
  • data/* : folder which will contain all .train & .test files in order to train model.
  • saved_models/*.joblib : all scikit learn models saved.
  • models_info/* : all markdown files generated to get quick information about model performance and prediction. This folder contains also model_comparisons.csv obtained after running runAll_maxwell.sh script.
  • modules/* : contains all modules usefull for the whole project (such as configuration variables)

Scripts for generating data files

Two scripts can be used for generating data in order to fit model :

  • generate_data_model.py : zones are specified and stayed fixed for each scene
  • generate_data_model_random.py : zones are chosen randomly (just a number of zone is specified)
  • generate_data_model_random_maxwell.py : zones are chosen randomly (just a number of zone is specified). Only maxwell scene are used.

Remark : Note here that all python script have --help command.

python generate_data_model.py --help

python generate_data_model.py --output xxxx --interval 0,20  --kind svdne --scenes "A, B, D" --zones "0, 1, 2" --percent 0.7 --sep : --rowindex 1 --custom custom_min_max_filename

Parameters explained :

  • output : filename of data (which will be split into two parts, .train and .test relative to your choices).
  • interval : the interval of data you want to use from SVD vector.
  • kind : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.
  • scenes : scenes choice for training dataset.
  • zones : zones to take for training dataset.
  • percent : percent of data amount of zone to take (choose randomly) of zone
  • sep : output csv file seperator used
  • rowindex : if 1 then row will be like that 1:xxxxx, 2:xxxxxx, ..., n:xxxxxx
  • custom : specify if you want your data normalized using interval and not the whole singular values vector. If it is, the value of this parameter is the output filename which will store the min and max value found. This file will be usefull later to make prediction with model (optional parameter).

Train model

This is an example of how to train a model

python train_model.py --data 'data/xxxxx.train' --output 'model_file_to_save' --choice 'model_choice'

Expected values for the choice parameter are ['svm_model', 'ensemble_model', 'ensemble_model_v2'].

Predict image using model

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

python predict_noisy_image_svd.py --image path/to/image.png --interval "x,x" --model saved_models/xxxxxx.joblib --metric 'lab' --mode 'svdn' --custom 'min_max_filename'
  • metric : metric choice need to be one of the listed above.
  • custom : specify filename with custom min and max from your data interval. This file was generated using custom parameter of one of the generate_data_model*.py script (optional parameter).

The model will return only 0 or 1 :

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

All SVD metrics developed need :

  • Name added into metric_choices_labels global array variable of modules/utils/config.py file.
  • A specification of how you compute the metric into get_svd_data method of modules/utils/data_type.py file.

Predict scene using model

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

python prediction_scene.py --data path/to/xxxx.csv --model saved_model/xxxx.joblib --output xxxxx --scene xxxx

Remark : scene parameter expected need to be the correct name of the Scene.

Visualize data

All scripts with names display_*.py are used to display data information or results.

Just use --help option to get more information.

Simulate model on scene

All scripts named predict_seuil_expe*.py are used to simulate model prediction during rendering process. Do not forget the custom parameter filename if necessary.

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.

Others scripts

Test model on all scene data

In order to see if a model well generalized, a bash script is available :

bash testModelByScene.sh '100' '110' 'saved_models/xxxx.joblib' 'svdne' 'lab'

Parameters list :

  • 1 : Begin of interval of data from SVD to use
  • 2 : End of interval of data from SVD to use
  • 3 : Model we want to test
  • 4 : Kind of data input used by trained model
  • 5 : Metric used by model

Get treshold map

Main objective of this project is to predict as well as a human the noise perception on a photo realistic image. Human threshold is available from training data. So a script was developed to give the predicted treshold from model and compare predicted treshold from the expected one.

python predict_seuil_expe.py --interval "x,x" --model 'saved_models/xxxx.joblib' --mode ["svd", "svdn", "svdne"] --metric ['lab', 'mscn', ...] --limit_detection xx --custom 'custom_min_max_filename'

Parameters list :

  • model : mode file saved to use
  • interval : the interval of data you want to use from SVD vector.
  • mode : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.
  • limit_detection : number of not noisy images found to stop and return threshold (integer).
  • custom : custom filename where min and max values are stored (optional parameter).

Display model performance information

Another script was developed to display into Mardown format the performance of a model.

The content will be divised into two parts :

  • Predicted performance on all scenes
  • Treshold maps obtained from model on each scenes

The previous script need to already have ran to obtain and display treshold maps on this markdown file.

python save_model_result_in_md.py --interval "xx,xx" --model saved_models/xxxx.joblib --mode ["svd", "svdn", "svdne"] --metric ['lab', 'mscn']

Parameters list :

  • model : mode file saved to use
  • interval : the interval of data you want to use from SVD vector.
  • mode : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.

Markdown file with all information is saved using model name into models_info folder.

Others...

All others bash scripts are used to combine and run multiple model combinations...

How to contribute

This git project uses git-flow implementation. You are free to contribute to it.git