diff --git a/.ipynb_checkpoints/Example_prediction-checkpoint.ipynb b/.ipynb_checkpoints/Example_prediction-checkpoint.ipynb new file mode 100644 index 0000000..bce0079 --- /dev/null +++ b/.ipynb_checkpoints/Example_prediction-checkpoint.ipynb @@ -0,0 +1,39 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example of load model for detections" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Example_prediction.ipynb b/Example_prediction.ipynb new file mode 100644 index 0000000..bce0079 --- /dev/null +++ b/Example_prediction.ipynb @@ -0,0 +1,39 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Example of load model for detections" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/README.md b/README.md index 9b93310..acac108 100755 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The models used for detection are SSD [SSD: Single Shot MultiBox Detector](https * [SSD_Keras](https://github.com/pierluigiferrari/ssd_keras#how-to-fine-tune-one-of-the-trained-models-on-your-own-dataset) * [YOLOv3_Keras](https://github.com/experiencor/keras-yolo3) -Grab the pretrained weights of SSD and YOLO3 from https://drive.google.com/drive/folders/1LSc9FkAwJrAAT8pAUWz8aax_biFAMMXS?usp=sharing +Grab the pretrained weights of SSD and YOLO3 from [Drive_Weights](https://drive.google.com/drive/folders/1LSc9FkAwJrAAT8pAUWz8aax_biFAMMXS?usp=sharing) ## Type of Data The images used for the design of this model were extracted by air analysis, specifically: FLIR aerial radiometric thermal infrared pictures, taken by UAV (R-JPEG format). Which were converted into .jpg images for the training of these detection models. @@ -172,10 +172,10 @@ The evaluation is integrated into the training process, if you want to do the in Compute the mAP performance of the model defined in `saved_weights_name` on the validation dataset defined in `valid_image_folder` and `valid_annot_folder`. # Result -All of weights of this trained model grab from https://drive.google.com/drive/folders/1LSc9FkAwJrAAT8pAUWz8aax_biFAMMXS?usp=sharing +All of weights of this trained model grab from [Drive_Weights](https://drive.google.com/drive/folders/1LSc9FkAwJrAAT8pAUWz8aax_biFAMMXS?usp=sharing) ## Panel Detector ### SDD7 -On folder Result_ssd7_panel show code (jupyter notebook), weight and result of this model (mAP 89.8%). +On folder [Result ssd7 panel](Result_ssd7_panel/) show code (jupyter notebook), weight and result of this model (mAP 89.8%). ![](Result_ssd7_panel/result_ssd7_panel/DJI_0020.jpg) @@ -183,14 +183,14 @@ On folder Result_ssd7_panel show code (jupyter notebook), weight and result of t ## Soiling Fault Detector ### SSD300 -On folder Result_ssd300_fault_1 show code (jupyter notebook), weight and result of this model (mAP 79.5%). +On folder [Result ssd300 fault 1](Result_ssd300_fault_1/) show code (jupyter notebook), weight and result of this model (mAP 79.5%). ![](Result_ssd300_fault_1/result_ssd300_fault_1/Mision_11_DJI_0011.jpg) ### YOLO3 -On folder Result_yolo3_fault_1 show history train (yolo3_full_yolo.output), weight and result of this model (mAP 73.02%). +On folder [Result yolo3 fault 1](Result_yolo3_fault_1/) show [history train](Result_yolo3_fault_1/yolo3_full_yolo.output), weight and result of this model (mAP 73.02%). ![](Result_yolo3_fault_1/result_yolo3_fault_1/Mision_11_DJI_0011.jpg) @@ -198,7 +198,7 @@ On folder Result_yolo3_fault_1 show history train (yolo3_full_yolo.output), weig ## Diode Fault Detector ### YOLO3 -On folder Result_yolo3_fault_4 show history train (yolo3_full_yolo.output), weight and result of this model (mAP 73.02%). +On folder [Result yolo3 fault 4](Result_yolo3_fault_4/) show [history train](Result_yolo3_fault_4/yolo3_full_yolo.output), weight and result of this model (mAP 73.02%). ![](Result_yolo3_fault_4/result_yolo3_fault_4/Mision%2041_DJI_0044.jpg) @@ -221,4 +221,4 @@ Before sending your pull requests, make sure you followed this list. # Example to use trained model -In ['Example_Prediction'](ex_prediction.ipynb) +In ['Example_Prediction'](Example_prediction.ipynb) diff --git a/config_300_fault_4.json b/config_300_fault_4.json index 30dacf2..687e669 100644 --- a/config_300_fault_4.json +++ b/config_300_fault_4.json @@ -6,29 +6,29 @@ }, "train": { - "train_image_folder": "../Train&Test_D/Train/images", - "train_annot_folder": "../Train&Test_D/Train/anns", - "train_image_set_filename": "../Train&Test_D/Train/train.txt", + "train_image_folder": "Train&Test_D/Train/images", + "train_annot_folder": "Train&Test_D/Train/anns", + "train_image_set_filename": "Train&Test_D/Train/train.txt", "train_times": 1, "batch_size": 12, "learning_rate": 1e-4, "warmup_epochs": 3, - + "nb_epochs": 100, - "saved_weights_name": "../Result_ssd300_fault_4/ssd300_fault_4.h5", + "saved_weights_name": "Result_ssd300_fault_4/ssd300_fault_4.h5", "debug": false }, "valid": { - "valid_image_folder": "../Train&Test_D/Test/images/", - "valid_annot_folder": "../Train&Test_D/Test/anns/", - "valid_image_set_filename": "../Train&Test_D/Test/test.txt" + "valid_image_folder": "Train&Test_D/Test/images/", + "valid_annot_folder": "Train&Test_D/Test/anns/", + "valid_image_set_filename": "Train&Test_D/Test/test.txt" }, "test": { - "test_image_folder": "../Train&Test_D/Test/images", - "test_annot_folder": "../Train&Test_D/Test/anns", - "test_image_set_filename": "../Train&Test_D/Test/test.txt" + "test_image_folder": "Train&Test_D/Test/images", + "test_annot_folder": "Train&Test_D/Test/anns", + "test_image_set_filename": "Train&Test_D/Test/test.txt" } } diff --git a/config_full_yolo_fault_1_infer.json b/config_full_yolo_fault_1_infer.json index 7763f45..ffc540f 100755 --- a/config_full_yolo_fault_1_infer.json +++ b/config_full_yolo_fault_1_infer.json @@ -4,13 +4,13 @@ "max_input_size": 400, "anchors": [5,7, 10,14, 15, 15, 26,32, 45,119, 54,18, 94,59, 109,183, 200,21], "labels": ["1"], - "backend": "full_yolo_backend.h5" + "backend": "keras-yolo3-master/full_yolo_backend.h5" }, "train": { - "train_image_folder": "../Train&Test_S/Train/images/", - "train_annot_folder": "../Train&Test_S/Train/anns/", - "cache_name": "../Result_yolo3_fault_1/experimento_fault_1_gpu.pkl", + "train_image_folder": "Train&Test_S/Train/images/", + "train_annot_folder": "Train&Test_S/Train/anns/", + "cache_name": "Result_yolo3_fault_1/experimento_fault_1_gpu.pkl", "train_times": 1, @@ -33,16 +33,16 @@ }, "valid": { - "valid_image_folder": "../Train&Test_S/Test/images/", - "valid_annot_folder": "../Train&Test_S/Test/anns/", - "cache_name": "../Result_yolo3_fault_1/val_fault_1.pkl", + "valid_image_folder": "Train&Test_S/Test/images/", + "valid_annot_folder": "Train&Test_S/Test/anns/", + "cache_name": "Result_yolo3_fault_1/val_fault_1.pkl", "valid_times": 1 }, "test": { - "test_image_folder": "../Train&Test_S/Test/images/", - "test_annot_folder": "../Train&Test_S/Test/anns/", - "cache_name": "../Result_yolo3_fault_1/test_fault_1.pkl", + "test_image_folder": "Train&Test_S/Test/images/", + "test_annot_folder": "Train&Test_S/Test/anns/", + "cache_name": "Result_yolo3_fault_1/test_fault_1.pkl", "test_times": 1 } diff --git a/config_full_yolo_fault_1_train.json b/config_full_yolo_fault_1_train.json index 6deb86a..ffc540f 100755 --- a/config_full_yolo_fault_1_train.json +++ b/config_full_yolo_fault_1_train.json @@ -4,13 +4,13 @@ "max_input_size": 400, "anchors": [5,7, 10,14, 15, 15, 26,32, 45,119, 54,18, 94,59, 109,183, 200,21], "labels": ["1"], - "backend": "full_yolo_backend.h5" + "backend": "keras-yolo3-master/full_yolo_backend.h5" }, "train": { - "train_image_folder": "../Train&Test_S/Train/images/", - "train_annot_folder": "../Train&Test_S/Train/anns/", - "cache_name": "../Result_yolo3_fault_1/experimento_fault_1_gpu.pkl", + "train_image_folder": "Train&Test_S/Train/images/", + "train_annot_folder": "Train&Test_S/Train/anns/", + "cache_name": "Result_yolo3_fault_1/experimento_fault_1_gpu.pkl", "train_times": 1, @@ -28,21 +28,21 @@ "class_scale": 1, "tensorboard_dir": "log_experimento_fault_gpu", - "saved_weights_name": "../Result_yolo3_fault_1/yolo3_full_fault_1.h5", + "saved_weights_name": "Result_yolo3_fault_1/yolo3_full_fault_1.h5", "debug": true }, "valid": { - "valid_image_folder": "../Train&Test_S/Test/images/", - "valid_annot_folder": "../Train&Test_S/Test/anns/", - "cache_name": "../Result_yolo3_fault_1/val_fault_1.pkl", + "valid_image_folder": "Train&Test_S/Test/images/", + "valid_annot_folder": "Train&Test_S/Test/anns/", + "cache_name": "Result_yolo3_fault_1/val_fault_1.pkl", "valid_times": 1 }, "test": { - "test_image_folder": "../Train&Test_S/Test/images/", - "test_annot_folder": "../Train&Test_S/Test/anns/", - "cache_name": "../Result_yolo3_fault_1/test_fault_1.pkl", + "test_image_folder": "Train&Test_S/Test/images/", + "test_annot_folder": "Train&Test_S/Test/anns/", + "cache_name": "Result_yolo3_fault_1/test_fault_1.pkl", "test_times": 1 } diff --git a/config_full_yolo_fault_4_infer.json b/config_full_yolo_fault_4_infer.json index 5c1d36f..c927a7b 100755 --- a/config_full_yolo_fault_4_infer.json +++ b/config_full_yolo_fault_4_infer.json @@ -4,13 +4,13 @@ "max_input_size": 400, "anchors": [5,7, 10,14, 15, 15, 26,32, 45,119, 54,18, 94,59, 109,183, 200,21], "labels": ["4"], - "backend": "full_yolo_backend.h5" + "backend": "keras-yolo3-master/full_yolo_backend.h5" }, "train": { - "train_image_folder": "../Train&Test_D/Train/images/", - "train_annot_folder": "../Train&Test_D/Train/anns/", - "cache_name": "../Result_yolo3_fault_4/Result_yolo3_fault_4.pkl", + "train_image_folder": "Train&Test_D/Train/images/", + "train_annot_folder": "Train&Test_D/Train/anns/", + "cache_name": "Result_yolo3_fault_4/Result_yolo3_fault_4.pkl", "train_times": 1, @@ -33,9 +33,9 @@ }, "valid": { - "valid_image_folder": "../Train&Test_D/Test/images/", - "valid_annot_folder": "../Train&Test_D/Test/anns/", - "cache_name": "../Result_yolo3_fault_4/Result_yolo3_fault_4.pkl", + "valid_image_folder": "Train&Test_D/Test/images/", + "valid_annot_folder": "Train&Test_D/Test/anns/", + "cache_name": "Result_yolo3_fault_4/Result_yolo3_fault_4.pkl", "valid_times": 1 }, diff --git a/train_ssd.py b/train_ssd.py index 0b3ee10..e2d78b3 100644 --- a/train_ssd.py +++ b/train_ssd.py @@ -21,9 +21,9 @@ def _main_(args): makedirs(output_path) print ('Training ssd') - os.system('cd ssd_keras-master/ && python train.py -c ../' + config_path + ' > ../' + output_path + '/ssd.output 2> ../' + output_path +'/ssd.err') + os.system('python ssd_keras-master/train.py -c ' + config_path + ' > ' + output_path + '/ssd.output 2> ' + output_path +'/ssd.err') print ('Testing ssd') - os.system('cd ssd_keras-master/ && python evaluate.py -c ../' + config_path + ' > ../' + output_path + '/ssd_test.output 2> ../' + output_path +'/ssd_test.err') + os.system('python ssd_keras-master/evaluate.py -c ' + config_path + ' > ' + output_path + '/ssd_test.output 2> ' + output_path +'/ssd_test.err') if __name__ == '__main__': @@ -32,4 +32,3 @@ if __name__ == '__main__': argparser.add_argument('-o', '--output', help='path to save the experiment') args = argparser.parse_args() _main_(args) - diff --git a/train_yolo.py b/train_yolo.py index 0cd49d5..2d3d3c3 100644 --- a/train_yolo.py +++ b/train_yolo.py @@ -20,9 +20,9 @@ def _main_(args): makedirs(output_path) print ('Training full_yolo3') - os.system('cd keras-yolo3-master/ && python train.py -c ../' + config_path + ' > ../' + output_path + '/yolo3_full_yolo.output 2> ../' + output_path +'/yolo3_full_yolo.err') + os.system('python keras-yolo3-master/train.py -c ' + config_path + ' > ' + output_path + '/yolo3_full_yolo.output 2> ' + output_path +'/yolo3_full_yolo.err') print('Test full_yolo3') - os.system('cd keras-yolo3-master/ && python evaluate.py -c ../' + config_path+ ' > ../' + output_path + '/yolo3_full_yolo_test.output 2> ../' + output_path +'/yolo3_full_yolo_test.err') + os.system('python keras-yolo3-master/evaluate.py -c ' + config_path+ ' > ' + output_path + '/yolo3_full_yolo_test.output 2> ' + output_path +'/yolo3_full_yolo_test.err') if __name__ == '__main__': argparser = argparse.ArgumentParser(description='train and evaluate ssd model on any dataset')