image-classifier-aipnd

所属分类:模式识别(视觉/语音等)
开发工具:Jupyter Notebook
文件大小:244KB
下载次数:0
上传日期:2018-05-23 06:32:31
上 传 者sh-1993
说明:  用于Python Nanodegree(Udacity)人工智能编程的图像分类器项目
(Image Classifier Project for AI Programming with Python Nanodegree (Udacity))

文件列表:
cat_to_name.json (2424, 2018-05-23)
command_utils.py (2624, 2018-05-23)
data_loading.py (2308, 2018-05-23)
model_utils.py (1383, 2018-05-23)
notebooks (0, 2018-05-23)
notebooks\Image Classifier Project.ipynb (338255, 2018-05-23)
predict.py (2392, 2018-05-23)
train.py (3313, 2018-05-23)

# image-classifier-aipnd Image Classifier Project for AI Programming with Python Nanodegree (Udacity) ## Example Commands ``` python train.py --arch densenet --hidden_units 1000,500 --epochs 10 --learning_rate 0.001 --gpu true --data_dir flowers/ --save_dir checkpoint.pth ``` ``` python predict.py --checkpoint checkpoint.pth --input flowers/test/32/image_051001.jpg --top_k 5 --category_names cat_to_name.json --gpu true ``` ## Training To train a model, run `train.py` with the desired model architecture (densenet or vgg) and the path to the image folder: ``` python train.py --arch densenet --data_dir flowers [image folder with train, val and test sub-folders] ``` The command above will use default values for all other values. See below for how to customize these values. ### Usage ``` usage: train.py [-h] [--data_dir DATA_DIR] [--save_dir SAVE_DIR] [--arch ARCH] [--learning_rate LEARNING_RATE] [--hidden_units HIDDEN_UNITS] [--epochs EPOCHS] [--gpu GPU] Provide image_dir, save_dir, architecture, hyperparameters such as learningrate, num of hidden_units, epochs and whether to use gpu or not optional arguments: -h, --help show this help message and exit --data_dir DATA_DIR path to image folder --save_dir SAVE_DIR folder where model checkpoints gets saved to --arch ARCH choose between vgg and densenet --learning_rate LEARNING_RATE learning_rate for model --hidden_units HIDDEN_UNITS hidden_units for model --epochs EPOCHS epochs for model --gpu GPU whether gpu should be used for or not ``` ## Prediction To make a prediction, run `predict.py` with the desired checkpoint and path to the image you want to try and predict: ``` python predict.py --checkpoint densenet201.pth --input flowers/test/23/image_05100.jpg ``` The command above will use default values for all other values. See below for how to customize these values. ### Usage ``` usage: predict.py [-h] [--input INPUT] [--checkpoint CHECKPOINT] [--top_k TOP_K] [--category_names CATEGORY_NAMES] [--gpu GPU] Provide input, checkpoint, top_k, category_names and gpu optional arguments: -h, --help show this help message and exit --input INPUT path to input image --checkpoint CHECKPOINT path to checkpoint --top_k TOP_K number of top_k to show --category_names CATEGORY_NAMES path to cat names file --gpu GPU whether gpu should be used for or not ```

近期下载者

相关文件


收藏者