{"id":18268410,"url":"https://github.com/coreyjs/aipnd-project","last_synced_at":"2025-07-26T03:07:03.976Z","repository":{"id":73449844,"uuid":"308182463","full_name":"coreyjs/aipnd-project","owner":"coreyjs","description":"This project is an image classification neural network that is trained on images of plants.","archived":false,"fork":false,"pushed_at":"2020-10-31T14:14:35.000Z","size":7845,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T21:25:59.789Z","etag":null,"topics":["ai","classification-network","flower","image-classification","image-classifier","machine-learning","neural-network","notebook","python","pytorch","udacity","udacity-nanodegree"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreyjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-29T01:15:44.000Z","updated_at":"2023-09-06T10:56:21.000Z","dependencies_parsed_at":"2023-02-24T04:15:31.515Z","dependency_job_id":null,"html_url":"https://github.com/coreyjs/aipnd-project","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyjs%2Faipnd-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyjs%2Faipnd-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyjs%2Faipnd-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyjs%2Faipnd-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreyjs","download_url":"https://codeload.github.com/coreyjs/aipnd-project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247968240,"owners_count":21025797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","classification-network","flower","image-classification","image-classifier","machine-learning","neural-network","notebook","python","pytorch","udacity","udacity-nanodegree"],"created_at":"2024-11-05T11:31:24.828Z","updated_at":"2025-04-09T02:46:56.554Z","avatar_url":"https://github.com/coreyjs.png","language":"HTML","readme":"# AI Programming - Image Classification Neural Network\n\n\n\u003e Project code for Udacity's AI Programming with Python Nanodegree program.\n\n![Screenshot 2020-10-31 101251](https://user-images.githubusercontent.com/1228838/97781440-c40e9600-1b61-11eb-9bc5-4096fe527443.png)\n![Screenshot 2020-10-31 1013243](https://user-images.githubusercontent.com/1228838/97781441-c40e9600-1b61-11eb-8bc7-272af114d698.png)\n\n\nIn this project we train an image classifier to recognize the different species of flowers.\nThe first part of this project can be found in the notebook `Image Classifier Project.ipynb`.  Here is\nwhere we work through defining the neural network architecture, process our images and\ntrain/validate and test our network's accuracy.\n\n\u003e Note, an HTML version of this notebook can be found here: 'Image Classifier Project.html'\n\n---\nAlong with the notebook this classification network can be ran on the command line. \n\nFor the dataset we are using, you can set those up with the following:\n\n```bash\nmkdir -p data_images \u0026\u0026 cd data_images\ncurl https://s3.amazonaws.com/content.udacity-data.com/nd089/flower_data.tar.gz | tar xz\n```\n\n### 1. Train\n\nTrain a new network on a data set with train.py\n\n - Basic usage: python train.py data_directory\n - Prints out training loss, validation loss, and validation accuracy as the network trains\n    Options:\n       \n  Set directory to save checkpoints: `python train.py data_dir --save_dir save_directory`\n   \n  Choose architecture: `python train.py data_dir --arch \"vgg13\"`\n   \n  Set hyperparameters: `python train.py data_dir --learning_rate 0.01 --hidden_units 512 --epochs 20`\n   \n  Use GPU for training: `python train.py data_dir --gpu`\n \n```bash\nusage: python train.py ./data_sets/train --gpu --learning_rate 0.02 --epohcs 10 --arch vgg11\n\nTrain a network on a dataset\n\npositional arguments:\n  data_dir              Directory of the training images\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --gpu                 Use GPU for training, defaults to False\n  --arch ARCH           Choose an architecture for the network, defaults to VGG19\n  --save_dir SAVE_DIR   Set directory to save checkpoints\n  --learning_rate LEARNING_RATE\n                        Set the learning rate hyperparameter, defaults to 0.01\n  --hidden_units HIDDEN_UNITS\n                        Set the hidden unit amount, defaults to 512\n  --epochs EPOCHS       Set the total amount of epochs this network should train for, defaults to 20\n```\n---\nAvailable Architecture's:\n```python\narch_types = {\n    'densenet121': models.densenet121,\n    'densenet169': models.densenet169,\n    'densenet161': models.densenet161,\n    'densenet201': models.densenet201,\n    'vgg11': models.vgg11,\n    'vgg13': models.vgg13,\n    'vgg16': models.vgg16,\n    'vgg19': models.vgg19,\n}\n```\n---\n\nExample, training the network:\n\n```bash\n\u003e python train.py ./data_images --arch \"vgg19\" --learning_rate 0.01 --gpu --epochs 10\n---\nInfo -- Using GPU\nInfo -- (13) Epochs.  Learning Rate: 0.01.  Hidden Units: 2048.  NN Arch: vgg19\n1/13 Epochs\nEpoch: 1/13  Training Loss: 6.293  Validation Loss: 4.084  Validation Accuracy: 0.166\nEpoch: 1/13  Training Loss: 4.017  Validation Loss: 3.147  Validation Accuracy: 0.290\n```\n\n### Checkpoints\n\nWhen training a neural network it will automatically save a checkpoint file in `./checkpoints/checkpoint-[ARCHNAME].pth`.\nYou can override this with the flag `--save_dir /my/save/dir`.\n\n---\n\n### 2. Prediction\nPredict flower name from an image with predict.py along with the probability of that name. That is, you'll pass in a single image /path/to/image and return the flower name and class probability.\n\n Basic usage: python predict.py /path/to/image checkpoint\n Options:\n   - Return top KKK most likely classes: `python predict.py input checkpoint --top_k 3`\n   - Use a mapping of categories to real names: `python predict.py input checkpoint --category_names cat_to_name.json`\n   - Use GPU for inference: `python predict.py input checkpoint --gpu`\n   \n```\nusage: python predict.py ./data_sets/valid/1/img.jpg\n\nPredict a flower name from an image along with the probability of that name.\n\npositional arguments:\n  image_path            Path to image to predict\n  checkpoint            Checkpoint file location\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --gpu                 Use GPU for training, defaults to False\n  --top_k TOP_K         Return top K most likely classes\n  --category_names CATEGORY_NAMES\n                        Mapping file of class id to real names, defaults to cat_to_name.json\n```\n\nExample of predicting with a supplied image:\n\n```bash\n\u003e  python predict.py ./data_images/valid/71/image_04517.jpg ./checkpoints/checkpoint-vgg19.pth --gpu\n--\nInfo -- Using GPU\nImage resized to: (256, 191), from: (667, 500)\nleft: 16.0, upper: -16.5, right: 240.0, lower: 207.5\n---------------Results-----------------\nPrediction: GAZANIA(71) with accuracy 0.99999\nPrediction: BLACK-EYED SUSAN(63) with accuracy 0.00001\nPrediction: ENGLISH MARIGOLD(5) with accuracy 0.00000\n---------------------------------------\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyjs%2Faipnd-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreyjs%2Faipnd-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyjs%2Faipnd-project/lists"}