zrsmithson / Stanford-dogs

A Pytorch image classification using the Stanford Dogs dataset to classify an image of a dog to one of 120 breeds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stanford-dogs

Stanford Dogs Dataset has over 20k images categorized into 120 breeds with uniform bounding boxes. The number of photos for each breed is relatively low, which is usually a good reason to employ transfer learning; but this is a model trained from scratch using a CNN based on NaimishNet

Data

When the script is initially run, the dataset is downloaded to a local folder (by default the project root folder). Some stats are printed, and an initial visualization is saved to show the images and their classes. The data is split into batches (default batch size is 64) and put into a pytorch dataloader. Initial Visualization

Training

Training is done using NLLLoss and SGD optimization with a default learning rate of 0.01. Results are periodically output to show the loss, and this is tracked over time to plot the loss over time. Loss over Time

Analysis

After training, inference is done on the test data to measure breed-specific and overall accuracy. The results are plotted similarly to the initial plot, but the predicted and actual classes are displayed above the image (green if correctly predicted). Results Visualization

About

A Pytorch image classification using the Stanford Dogs dataset to classify an image of a dog to one of 120 breeds


Languages

Language:Python 100.0%