Create-Your-Own-Image-Classifier
所属分类:模式识别(视觉/语音等)
开发工具:HTML
文件大小:0KB
下载次数:0
上传日期:2024-01-14 09:28:09
上 传 者:
sh-1993
说明: Udacity X AWS AI与Python编程项目II
(Udacity X AWS AI with Python Programming Project II)
文件列表:
Image Classifier Project.html
predict.py
train.py
# Create-Your-Own-Image-Classifier
Udacity X AWS AI with Python Programming Project II
# Image Classification with VGG16
This project implements image classification using the VGG16 model. It includes a training script to train the model and a prediction script to make predictions on new images.
## Table of Contents
- [Overview](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#overview)
- [Requirements](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#requirements)
- [Usage](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#usage)
- [Training](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#training)
- [Prediction](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#prediction)
- [Project Structure](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#project-structure)
- [License](https://github.com/dolivon123456/Create-Your-Own-Image-Classifier/blob/master/#license)
## Overview
This project uses the VGG16 model for image classification. It includes training and prediction scripts written in Python using PyTorch. The training script allows you to train the model on your dataset, while the prediction script allows you to make predictions on new images using a pre-trained model checkpoint.
## Requirements
Before running the scripts, make sure you have the following requirements installed:
- Python 3.x
- PyTorch
- torchvision
- Pillow
## Steps
Install the required libraries using the following command:
```bash
pip install torch torchvision pillow
Usage
Training
To train the model on your dataset, follow these steps:
Organize your dataset into train and valid folders inside a root data directory.
Run the training script:
python train.py data_directory --arch vgg16 --hidden_units 512 --learning_rate 0.001 --epochs 3 --save_dir checkpoints --gpu
Replace data_directory with the path to your root data directory.
Prediction
To make predictions on new images using a pre-trained VGG16 model, follow these steps:
Prepare an image for prediction.
Run the prediction script:
python predict.py input_image checkpoint.pth --category_names cat_to_name.json --gpu
Replace input_image with the path to the image file, checkpoint.pth with the path to your pre-trained model checkpoint, and optionally provide --category_names if you have a JSON file mapping class indices to human-readable class names.
Project Structure
- data/ # Sample data for testing
- checkpoints/ # Directory to save model checkpoints
- predict.py # Prediction script
- train.py # Training script
- README.md # Project documentation
License
This project is licensed under the MIT License - see the LICENSE file for detail
近期下载者:
相关文件:
收藏者: