This project uses AI classification, to try to determine the dog breed of a dog in an image. It has the 11 most popular dog breeds. You use a picture of a dog, then the AI will tell you what breed it thinks it is, along with how sure it is. This can be useful to owners of strays, to figure out what breed their dog is. They can use this information to find out more about their dog's expected size, health risks, personality traits, and more.
The AI believes the dog is a beagle, and it is 25.5% sure, meaning it thinks theres a 1/4 chance it is right.
This project uses transfer learning. This basically uses an already trained model, and re-trains it for a specific dataset. How the training works is the model learns through errors in its predictions, and increases its accuracy as it learns. Through doing this, as it trains, it gets better at recognizing different dog breeds. To run it, it takes a sample image given, and determines what dog breed it thinks it is, along with how accurate it thinks it's prediction is.
- First download this file https://drive.google.com/file/d/1ftl7Drk55dsXf6aJ7OhHMiTpBShKcgr1/view?usp=drive_link
- Go to your drive.google.com and upload the file downloaded (Images.zip)
- Visit this: https://colab.research.google.com/drive/1_7BYxN2YPOPBSq5n6RcIchLFSPZFiy1E?usp=sharing
- You can run cell blocks by clicking the underlined button

- Run the first 5 cells this way
- It will ask you for permission, give it permission to your google drive
- The next cell block will train the model.
5.

- The underlined number controls how long it runs. The larger the number, the longer it takes. A larger number will also increase the accuracy of the model. You may modify this as you prefer, but it is not reccomended to increase it too large, as the model won't gain much extra accuracy at very high numbers.
- Once the training is done, run the next 3 blocks
- On the left of your screen click on the folder icon
- Click on the "pytoch classification folder", then under that the "models folder"
-
- Download the resnet18.onnx, by right clicking on it, then clicking download
- Do the same thing on the labels.txt to download it
- Open VS code, and make a folder
- Label it "Dog Classification", or anything else you want
-
- Go to your finder, and find the resnet18 you downloaded, as well as the labels.txt
- Drag and drop the two files into the folder you created
- Now create a new file inside that folder by right clicking on the folder name-new file. Label it something that makes sense. This is where the code to run it will go
- Paste this code inside the new file created: https://docs.google.com/document/d/1TaTkfUd3BuNPbMordSEvcTEgpwrOogCkp6z1_k2JJao/edit?usp=sharing
- Now go into your macbook terminal
- Now cd into your folder-do so by typing in cd (your folder name)
- If your folder is in another folder, you will need to cd into that first.
- Now to select an image of a dog, drag and drop a dog picture into the folder (the same way you dragged and dropped the labels.txt and resnet18 into the folder)
- Rename the image to something that makes sense (eg dog_picture.jpg)
- Make sure your still the in the correct directory, and run the command python3 (the filename where you code is) (the filename of the dog picture) for example python3 my_code.py dog_picture.jpg
- This will run the program, and the AI will tell you in the terminal what breed it thinks the dog is, along with how sure it is
- https://drive.google.com/file/d/1ky4nMr2Cr9EF-QLFWNx_M90sjnaai7ea/view?usp=sharing)