|
@@ -6,6 +6,11 @@
|
|
|
pip install -r requirements.txt
|
|
|
```
|
|
|
|
|
|
+Generate all needed data for each metrics (lab and mscn)
|
|
|
+```
|
|
|
+python generate_all_data.py
|
|
|
+```
|
|
|
+
|
|
|
## How to use
|
|
|
|
|
|
### Multiple folders and scripts are availables :
|
|
@@ -14,23 +19,23 @@ pip install -r requirements.txt
|
|
|
- **fichiersSVD/\*** : all scene files information (zones of each scene, SVD descriptor files information and so on...).
|
|
|
- **fichiersSVD_light/\*** : all scene files information (zones of each scene, SVD descriptor files information and so on...) but here with reduction of information for few scenes. Information used in our case.
|
|
|
- **models/*.py** : all models developed to predict noise in image.
|
|
|
-- **data_svm/\*** : folder which will contain all *.train* & *.test* files in order to train model.
|
|
|
+- **data/\*** : folder which will contain all *.train* & *.test* files in order to train model.
|
|
|
- **saved_models/*.joblib** : all scikit learn models saved.
|
|
|
- **models_info/*.md** : all markdown files generated to get quick information about model performance and prediction.
|
|
|
|
|
|
### Scripts for generating data files
|
|
|
|
|
|
Two scripts can be used for generating data in order to fit model :
|
|
|
-- **generate_data_svm.py** : zones are specified and stayed fixed for each scene
|
|
|
-- **generate_data_svm_random.py** : zones are chosen randomly (just a number of zone is specified)
|
|
|
+- **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)
|
|
|
|
|
|
|
|
|
**Remark** : Note here that all python script have *--help* command.
|
|
|
|
|
|
```
|
|
|
-python generate_data_svm.py --help
|
|
|
+python generate_data_model.py --help
|
|
|
|
|
|
-python generate_data_svm.py --output xxxx --interval 0,20 --kind svdne --scenes "A, B, D" --zones "0, 1, 2" --percent 0.7 --sep : --rowindex 1
|
|
|
+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
|
|
|
```
|
|
|
|
|
|
Parameters explained :
|
|
@@ -48,7 +53,7 @@ Parameters explained :
|
|
|
This is an example of how to train a model
|
|
|
|
|
|
```python
|
|
|
-python models/xxxxx.py --data 'data_svm/xxxxx.train' --output 'model_file_to_save'
|
|
|
+python models/xxxxx.py --data 'data/xxxxx.train' --output 'model_file_to_save'
|
|
|
```
|
|
|
|
|
|
### Predict image using model
|
|
@@ -59,6 +64,12 @@ Now we have a model trained, we can use it with an image as input :
|
|
|
python predict_noisy_image_svd_lab.py --image path/to/image.png --interval "x,x" --model saved_models/xxxxxx.joblib --mode 'svdn'
|
|
|
```
|
|
|
|
|
|
+You can also use specific metric (lab or mscn at the moment)
|
|
|
+
|
|
|
+```python
|
|
|
+python predict_noisy_image_svd_mscn.py --image path/to/image.png --interval "x,x" --model saved_models/xxxxxx.joblib --mode 'svdn'
|
|
|
+```
|
|
|
+
|
|
|
The model will return only 0 or 1 :
|
|
|
- 1 means noisy image is detected.
|
|
|
- 0 means image seem to be not noisy.
|
|
@@ -79,7 +90,7 @@ python prediction_scene.py --data path/to/xxxx.csv --model saved_model/xxxx.jobl
|
|
|
In order to see if a model well generalized, a bash script is available :
|
|
|
|
|
|
```bash
|
|
|
-bash testModelByScene.sh '100' '110' 'saved_models/xxxx.joblib' 'svdne'
|
|
|
+bash testModelByScene.sh '100' '110' 'saved_models/xxxx.joblib' 'svdne' 'lab'
|
|
|
```
|
|
|
|
|
|
Parameters list :
|
|
@@ -94,7 +105,7 @@ Parameters list :
|
|
|
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
|
|
|
-python predict_noisy_image.py --interval "x,x" --model 'saved_models/xxxx.joblib' --mode ["svd", "svdn", "svdne"] --limit_detection xx
|
|
|
+python predict_seuil_expe.py --interval "x,x" --model 'saved_models/xxxx.joblib' --mode ["svd", "svdn", "svdne"] --metric ['lab', 'mscn'] --limit_detection xx
|
|
|
```
|
|
|
|
|
|
Parameters list :
|
|
@@ -114,7 +125,7 @@ The content will be divised into two parts :
|
|
|
The previous script need to already have ran to obtain and display treshold maps on this markdown file.
|
|
|
|
|
|
```python
|
|
|
-python save_model_result_in_md.py --interval "xx,xx" --model saved_models/xxxx.joblib --mode ["svd", "svdn", "svdne"]
|
|
|
+python save_model_result_in_md.py --interval "xx,xx" --model saved_models/xxxx.joblib --mode ["svd", "svdn", "svdne"] --metric ['lab', 'mscn']
|
|
|
```
|
|
|
|
|
|
Parameters list :
|