File size: 3,016 Bytes
cba3d0d
 
 
 
 
 
 
 
 
 
 
 
 
95da6da
 
 
 
 
 
 
 
 
 
4cc4589
95da6da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: Era Week12 Lightning.resnet
emoji: 🐠
colorFrom: green
colorTo: green
sdk: gradio
sdk_version: 3.39.0
app_file: app.py
pinned: false
license: mit
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# CIFAR10 Image classification using a Custom ResNet Model

## What is the app about?

[This app](https://huggingface.co/spaces/nviraj/ERA-V1-Assignment12) built using [Gradio](https://www.gradio.app/) provides an interface to run inferences for CIFAR10 image classification using a custom ResNet model trained using PyTorch and Lightning with \>90% accuracy.

### What input does it require?

- **Example Input**
  - Please note that example inputs have been provided for you to test the app below the Submit button. Please select one of the examples to see the app in action
- **Inference Related**
  - Image
    - Any image for the following 10 CIFAR10 classes [airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks]
    - It accepts any resolution and image type
  - How many top classes to predict?
    - Max of 10 classes
  - Do you want to show the GradCAM image?
    - This shows you features deemed important by the model in making the prediction
  - Which layer of the model do you want to generate GradCAM for?
    - A network has multiple layers and it is sequentially shown as a drop down. Every layer incrementally identifies bigger parts of the image. Have fun generating the visualization for different layers.
  - By what factor do you want to overlay the original image on GradCAM?
    - Smaller the factor more prominent is GradCAM Hotspot.
    - As you increase the factor the original image becomes more opaque and prominent over the heatmap
- **Diagnostics Related**
  - Do you want to show Misclassified Images and how many?
    - This comes in handy to see where the model fails to predict accurate classes
  - Do you want to see GradCAM for Misclassified Images and how many?
    - This is useful to see what parts of the image led to incorrect classification

### What is the output?

- Predictions for top number of classes chosen as well as the predicted class
- Either the original image or image + GradCAM heatmap based on input chosen
- Misclassified Images by the model
- GradCAM for Misclassified Images by the model

### How was the model built?

- Model was trained using a custom ResNet model trained for just 24 epochs with 91.4% validation accuracy
- The code can be found here
  - [Notebook](https://github.com/nviraj/era-v1/blob/main/Session%2012/Submission/ERA%20V1%20-%20Viraj%20-%20Assignment%2012.ipynb)
  - [Modules](https://github.com/nviraj/era-v1/tree/main/Session%2012/Submission/modules)
  - [Model](https://github.com/nviraj/era-v1/tree/main/Session%2012/Submission/models)

### Links

- [GradCAM?](https://arxiv.org/abs/1610.02391)
- [Pytorch](https://pytorch.org/)
- [Pytorch Lightning](https://www.pytorchlightning.ai/index.html)
- [ResNet](https://arxiv.org/pdf/1512.03385.pdf)