Transfer Learning Suite
1.0.0
이 저장소는 Transfer Learning Suite 역할을 합니다. 목표는 내장된 Keras 이미지 분류 모델을 사용하여 쉽게 전이 학습을 수행할 수 있는 것입니다! 이 저장소를 개선하기 위한 제안이나 보고 싶은 새로운 기능을 환영합니다!
Semantic Segmentation Suite를 확인해 볼 수도 있습니다.
모든 Keras 내장 모델을 사용할 수 있습니다:
모델 | 크기 | 상위 1 정확도 | 상위 5개 정확도 | 매개변수 | 깊이 |
---|---|---|---|---|---|
VGG16 | 528MB | 0.715 | 0.901 | 138,357,544 | 23 |
VGG19 | 549MB | 0.727 | 0.910 | 143,667,240 | 26 |
ResNet50 | 99MB | 0.759 | 0.929 | 25,636,712 | 168 |
예외 | 88MB | 0.790 | 0.945 | 22,910,480 | 126 |
인셉션V3 | 92MB | 0.788 | 0.944 | 23,851,784 | 159 |
인셉션ResNetV2 | 215MB | 0.804 | 0.953 | 55,873,736 | 572 |
모바일넷 | 17MB | 0.665 | 0.871 | 4,253,864 | 88 |
DenseNet121 | 33MB | 0.745 | 0.918 | 8,062,504 | 121 |
DenseNet169 | 57MB | 0.759 | 0.928 | 14,307,880 | 169 |
DenseNet201 | 80MB | 0.770 | 0.933 | 20,242,984 | 201 |
NASNetMobile | 21MB | 해당 없음 | 해당 없음 | 5,326,716 | 해당 없음 |
NASNetLarge | 342MB | 해당 없음 | 해당 없음 | 88,949,818 | 해당 없음 |
main.py: 학습 및 예측 모드
utils.py: 도우미 유틸리티 함수
checkpoints: 학습 중 각 에포크에 대한 체크포인트 파일
예측: 예측 결과
이 프로젝트에는 다음과 같은 종속성이 있습니다.
Numpy sudo pip install numpy
OpenCV Python sudo apt-get install python-opencv
TensorFlow sudo pip install --upgrade tensorflow-gpu
케라스 sudo pip install keras
시작하기 위해 해야 할 유일한 일은 다음 구조로 폴더를 설정하는 것입니다.
├── "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
| | ├── .....
그런 다음 간단히 main.py
실행할 수 있습니다! 선택적 명령줄 인수를 확인하세요.
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