File size: 3,408 Bytes
6c4a6d3
 
 
 
 
 
 
 
 
 
 
 
1a10497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6c4a6d3
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
---
title: Custom ResNet
emoji: πŸƒ
colorFrom: indigo
colorTo: gray
sdk: gradio
sdk_version: 3.39.0
app_file: app.py
pinned: false
license: mit
---

# Custom ResNet Inference App for CIFAR10 dataset
## How to Use the App
1. The app has two tabs:
   - **Examples**: In this tab, we can upload any new test image or choose an example image provided in the list shown below to the app widget screen. We can choose the number of top classes to predict using the given slider. Then we click on submit for the inference to show the predicted classifications and the corresponding top classes along with their confidence levels. We visualize the class activation maps using GradCAM, show/hide the GradCAM overlay by controling the transparency of the overlay, select multiple target layers (from the 4 target layers of the model).
   - **Misclassified Examples**: In this tab, the app displays a gallery of mis-classified images from CIFAR10 test dataset. These mis-classified images are the ones obtained from the prior training and testing of the custom resnet model. We can control the number of examples shown, show/hide the GradCAM overlay, select a target layer, and control the transparency of the overlay. This list of mis-classified images are around 900 in number and in the app we can choose only from this list available.

2. **Examples Tab - Description of the options to choose**:
   - **Input Image**: Upload any new image to test or select one of the example images from the given list.
   - **Top Classes**: Choose the number of top predicted classes to display along with their respective confidence scores.
   - **Enable GradCAM**: Check this box to display the GradCAM overlay on the input image. Uncheck it to view only the original image.
   - **Network Layers**: Select the target layers for GradCAM visualization. The default values are -2 and -1.
   - **Transparency**: Control the transparency of the GradCAM overlay. The default value is 0.7.

3. **Misclassified Examples Tab - Description of the options to choose**:
   - **No. of Examples**: Control the number of mis-classified examples displayed in the gallery. The default value is 20.
   - **Enable GradCAM**: Check this box to display the GradCAM overlay on the mis-classified images. Uncheck it to view only the original images.
   - **Network Layer**: Adjust the target layer for GradCAM visualization. The default value is -2.
   - **Transparency**: Control the transparency of the GradCAM overlay. The default value is 0.7.

4. After adjusting the settings, click the "Submit" button to see the results.

## Source code of training the model
 The main code using which training was performed can be viewed at below location:

[https://github.com/mHemaAP/S12](https://github.com/mHemaAP/S12)

## Credits

- This app is built using the Gradio library ([https://www.gradio.app/](https://www.gradio.app/)) for interactive model interfaces.
- The PyTorch library ([https://pytorch.org/](https://pytorch.org/)) is used for the deep learning model and GradCAM visualization.
- The CIFAR-10 dataset ([https://www.cs.toronto.edu/~kriz/cifar.html](https://www.cs.toronto.edu/~kriz/cifar.html)) is used for training and evaluation.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

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