Slide 1

Slide 1 text

Dog Breed Classifier ChihYu

Slide 2

Slide 2 text

Outline 1. Understand the Problem 2. End goal 3. Data Exploration 4. Data Preprocessing and Model Formulation 5. Model Training 6. Model Deployment 7. Simple Demo 8. Further Improvements 9. References

Slide 3

Slide 3 text

Understand the Problem

Slide 4

Slide 4 text

Problem Statement Given an image of a dog, your algorithm will identify an estimate of the canine’s breed. Otherwise, your algorithm should return an error message. There are 133 dog breeds in the training dataset. Conclusions 1. This is a computer vision task 2. This is a multi-classification task.

Slide 5

Slide 5 text

End goal

Slide 6

Slide 6 text

My end goal is to have these models deployed and serve the real people in the world. The best condition is to store these models directly inside users’ browsers and they can use the application offline(through progressive web app techniques). Note: 1. Actually there are two versions of my proposed models, and the reason that the second version is raised is because it disobey my end goal. 2. The model I am going to introduce later is the second version.

Slide 7

Slide 7 text

Data Exploration

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Data Preprocessing and Model Formulation

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Model Architecture 1. Dog Detection a. Model: a pretrained MobileNetV2 model w/o finetuning b. Input: an preprocessed image(224*224*3) c. Output: a boolean that indicates if a dog is inside the image 2. Dog Breed Classification a. Model: a pretrained MobileNetV2 model with finetuning b. Input: an preprocessed image(224*224*3) c. Output: top-3 prediction

Slide 13

Slide 13 text

It’s all about transfer learning.

Slide 14

Slide 14 text

Andrej Karpathy once said...

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Data Preprocessing from PyTorch documentation All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (3 x H x W), where H and W are expected to be at least 224. The images have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225] . It should be complemented with the chosen model. So we’d better follow the same preprocessing step first.

Slide 17

Slide 17 text

Model Training

Slide 18

Slide 18 text

Computing Environment 1. GCP AI Platform Notebook with 1 Nvidia P100 GPU 2. Using PyTorch 3. Fine-tuning Time: several hours

Slide 19

Slide 19 text

Training Problems In order to train faster and prevent neural networks from stopping improving, I applied two techniques: learning rate finder and the one cycle policy.

Slide 20

Slide 20 text

Other tools worth trying 1. Tune: a scalable hyperparameter tuning library 2. Weights&Biases: a platform for experiment tracking, model optimization and dataset versioning Note: Above two tools are complementary with each other, and they can be combined together.

Slide 21

Slide 21 text

Model Deployment

Slide 22

Slide 22 text

Used tools 1. Docker a. Enable easy environment setup b. Easy to ship and manage applications c. Suitable for cloud-native applications 2. GCP Cloud Run a. Serverless computing environment using containers b. Minimal effort to manage the infrastructure c. We only need to deploy our built images

Slide 23

Slide 23 text

Simple Demo

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Further Improvements

Slide 28

Slide 28 text

1. Add more training data, for example, more dog breeds in Taiwan. 2. Put models to the users’ browsers and enable offline usage. 3. Novel dog breeds detection. 4. Online learning that enables improving the model performance on the fly.

Slide 29

Slide 29 text

References 1. Dog Breed Classifier GitHub Repo: https://github.com/cyyeh/dog-breed-classifier-project

Slide 30

Slide 30 text

Thank you!