Ce référentiel sert de Transfer Learning Suite. L'objectif est de pouvoir facilement effectuer un apprentissage par transfert à l'aide de n'importe quel modèle de classification d'images Keras intégré ! Toutes les suggestions pour améliorer ce référentiel ou toute nouvelle fonctionnalité que vous aimeriez voir sont les bienvenues !
Vous pouvez également consulter ma suite de segmentation sémantique.
Tous les modèles intégrés Keras sont disponibles :
Modèle | Taille | Précision de premier ordre | Précision Top 5 | Paramètres | Profondeur |
---|---|---|---|---|---|
VGG16 | 528 Mo | 0,715 | 0,901 | 138 357 544 | 23 |
VGG19 | 549 Mo | 0,727 | 0,910 | 143 667 240 | 26 |
ResNet50 | 99 Mo | 0,759 | 0,929 | 25 636 712 | 168 |
Xception | 88 Mo | 0,790 | 0,945 | 22 910 480 | 126 |
CréationV3 | 92 Mo | 0,788 | 0,944 | 23 851 784 | 159 |
CréationResNetV2 | 215 Mo | 0,804 | 0,953 | 55 873 736 | 572 |
MobileNet | 17 Mo | 0,665 | 0,871 | 4 253 864 | 88 |
DenseNet121 | 33 Mo | 0,745 | 0,918 | 8 062 504 | 121 |
DenseNet169 | 57 Mo | 0,759 | 0,928 | 14 307 880 | 169 |
DenseNet201 | 80 Mo | 0,770 | 0,933 | 20 242 984 | 201 |
NASNetMobile | 21 Mo | N / A | N / A | 5 326 716 | N / A |
NASNetGrand | 342 Mo | N / A | N / A | 88 949 818 | N / A |
main.py : mode Entraînement et Prédiction
utils.py : fonctions utilitaires d'assistance
points de contrôle : fichiers de points de contrôle pour chaque époque pendant l'entraînement
Prédictions : résultats des prévisions
Ce projet a les dépendances suivantes :
Numpy sudo pip install numpy
OpenCV Python sudo apt-get install python-opencv
TensorFlow sudo pip install --upgrade tensorflow-gpu
Keras sudo pip install keras
La seule chose que vous devez faire pour commencer est de configurer les dossiers dans la structure suivante :
├── "dataset_name"
| ├── train
| | ├── class_1_images
| | ├── class_2_images
| | ├── class_X_images
| | ├── .....
| ├── val
| | ├── class_1_images
| | ├── class_2_images
| | ├── class_X_images
| | ├── .....
| ├── test
| | ├── class_1_images
| | ├── class_2_images
| | ├── class_X_images
| | ├── .....
Ensuite, vous pouvez simplement exécuter main.py
! Découvrez les arguments facultatifs de la ligne de commande :
usage: main.py [-h] [--num_epochs NUM_EPOCHS] [--mode MODE] [--image IMAGE]
[--continue_training CONTINUE_TRAINING] [--dataset DATASET]
[--resize_height RESIZE_HEIGHT] [--resize_width RESIZE_WIDTH]
[--batch_size BATCH_SIZE] [--dropout DROPOUT] [--h_flip H_FLIP]
[--v_flip V_FLIP] [--rotation ROTATION] [--zoom ZOOM]
[--shear SHEAR] [--model MODEL]
optional arguments:
-h, --help show this help message and exit
--num_epochs NUM_EPOCHS
Number of epochs to train for
--mode MODE Select "train", or "predict" mode. Note that for
prediction mode you have to specify an image to run
the model on.
--image IMAGE The image you want to predict on. Only valid in
"predict" mode.
--continue_training CONTINUE_TRAINING
Whether to continue training from a checkpoint
--dataset DATASET Dataset you are using.
--resize_height RESIZE_HEIGHT
Height of cropped input image to network
--resize_width RESIZE_WIDTH
Width of cropped input image to network
--batch_size BATCH_SIZE
Number of images in each batch
--dropout DROPOUT Dropout ratio
--h_flip H_FLIP Whether to randomly flip the image horizontally for
data augmentation
--v_flip V_FLIP Whether to randomly flip the image vertically for data
augmentation
--rotation ROTATION Whether to randomly rotate the image for data
augmentation
--zoom ZOOM Whether to randomly zoom in for data augmentation
--shear SHEAR Whether to randomly shear in for data augmentation
--model MODEL Your pre-trained classification model of choice