This project is aiming to train a image classification model by transfer learning with ResNet50 pre-trained model. It is impelemented by Keras.
conda for open source package management and environment management
h5py==2.10.0
matplotlib
keras==2.2.5
tensorflow==1.14
visit conda installation & install the compatible version on your system environment.
conda create -n tl-resnet50 keras==2.2.5
conda activate tl-resnet50
pip install -r requirements
mkdir data && mkdir models
Your folder structure should be like the following format
data >
your_dataset >
train >
class_1 >
img_1.jpg
img_2.jpg
img_3.jpg
...
class_2 >
img_1.jpg
img_2.jpg
img_3.jpg
...
validation >
class_1 >
img_1.jpg
img_2.jpg
img_3.jpg
...
class_2 >
img_1.jpg
img_2.jpg
img_3.jpg
...
in both file
input_path = './data/your_dataset/'
in predict.py
validation_img_paths = ['./validation/img_1.jpg', './validation/img_2.jpg', './validation/img_3.jpg']
Training model:
python train.py
Validate training result:
python predict.py