Update README.md with new model card content
Browse files
README.md
CHANGED
@@ -7,5 +7,99 @@ tags:
|
|
7 |
pipeline_tag: image-classification
|
8 |
---
|
9 |
### Model Overview
|
|
|
10 |
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
pipeline_tag: image-classification
|
8 |
---
|
9 |
### Model Overview
|
10 |
+
# Model Summary
|
11 |
|
12 |
+
Instantiates the ResNet architecture amended by “bag of tricks” modifications.
|
13 |
+
## Reference
|
14 |
+
[Bag of Tricks for Image Classification with Convolutional Neural Networks](https://arxiv.org/abs/1812.01187)
|
15 |
|
16 |
+
ResNetVd introduces two key modifications to the standard ResNet. First, the initial convolutional layer is replaced by a series of three successive convolutional layers. Second, shortcut connections use an additional pooling operation rather than performing downsampling within the convolutional layers themselves.
|
17 |
+
## Links
|
18 |
+
|
19 |
+
* [ResNetVD Quickstart Notebook](https://www.kaggle.com/code/laxmareddypatlolla/resnetvd-quickstart-notebook)
|
20 |
+
* [ResNet and ResNetVD series Doc](https://paddleclas.readthedocs.io/en/latest/models/ResNet_and_vd_en.html)
|
21 |
+
* [ResNetVD Model Card](https://arxiv.org/abs/1812.01187)
|
22 |
+
* [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/)
|
23 |
+
* [KerasHub Model Publishing Guide](https://keras.io/guides/keras_hub/upload/)
|
24 |
+
|
25 |
+
## Installation
|
26 |
+
|
27 |
+
Keras and KerasHub can be installed with:
|
28 |
+
|
29 |
+
```
|
30 |
+
pip install -U -q keras-hub
|
31 |
+
pip install -U -q keras
|
32 |
+
```
|
33 |
+
|
34 |
+
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the [Keras Getting Started](https://keras.io/getting_started/) page.
|
35 |
+
|
36 |
+
## Presets
|
37 |
+
|
38 |
+
The following model checkpoints are provided by the Keras team.Weights have been ported from: [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR). Full code examples for each are available below.
|
39 |
+
|
40 |
+
|
41 |
+
| Preset name | Parameters | Description |
|
42 |
+
|------------------------|------------|-------------------------------------------------------------------------------------------------|
|
43 |
+
| `resnet_vd_18_imagenet` | 11.72M | 18-layer ResNetVD model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.|
|
44 |
+
| `resnet_vd_34_imagenet` | 21.84M | 34-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
|
45 |
+
| `resnet_vd_50_imagenet` | 25.63M | 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
|
46 |
+
| `resnet_vd_50_ssld_imagenet` | 25.63M | 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation. |
|
47 |
+
| `resnet_vd_50_ssld_v2_imagenet` | 25.63M | 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation and AutoAugment. |
|
48 |
+
| `resnet_vd_50_ssld_v2_fix_imagenet` | 25.63M | 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation, AutoAugment and additional fine-tuning of the classification head. |
|
49 |
+
| `resnet_vd_101_imagenet` | 44.67M | 101-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
|
50 |
+
| `resnet_vd_101_ssld_imagenet` | 44.67M | 101-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation. |
|
51 |
+
| `resnet_vd_152_imagenet` | 60.36M | 152-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
|
52 |
+
| `resnet_vd_200_imagenet` | 74.93M | 200-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
|
53 |
+
|
54 |
+
## Example Usage
|
55 |
+
```python
|
56 |
+
|
57 |
+
from keras_hub.models import ResNetBackbone
|
58 |
+
import keras
|
59 |
+
import numpy as np
|
60 |
+
|
61 |
+
input_data = np.ones(shape=(8, 224, 224, 3))
|
62 |
+
|
63 |
+
# Pretrained backbone
|
64 |
+
model = ResNetBackbone.from_preset("resnet_vd_50_ssld_v2_imagenet")
|
65 |
+
output = model(input_data)
|
66 |
+
|
67 |
+
# Randomly initialized backbone with a custom config
|
68 |
+
model = ResNetBackbone(
|
69 |
+
input_conv_filters=[32, 32, 64],
|
70 |
+
input_conv_kernel_sizes=[3, 3, 3],
|
71 |
+
stackwise_num_filters=[64, 128, 256, 512],
|
72 |
+
stackwise_num_blocks=[3, 4, 5, 6],
|
73 |
+
stackwise_num_strides=[1, 2, 2, 2],
|
74 |
+
block_type="bottleneck_block_vd",
|
75 |
+
)
|
76 |
+
output = model(input_data)
|
77 |
+
|
78 |
+
```
|
79 |
+
|
80 |
+
## Example Usage with Hugging Face URI
|
81 |
+
|
82 |
+
```python
|
83 |
+
|
84 |
+
from keras_hub.models import ResNetBackbone
|
85 |
+
import keras
|
86 |
+
import numpy as np
|
87 |
+
|
88 |
+
input_data = np.ones(shape=(8, 224, 224, 3))
|
89 |
+
|
90 |
+
# Pretrained backbone
|
91 |
+
model = ResNetBackbone.from_preset("hf://keras/resnet_vd_50_ssld_v2_imagenet")
|
92 |
+
output = model(input_data)
|
93 |
+
|
94 |
+
# Randomly initialized backbone with a custom config
|
95 |
+
model = ResNetBackbone(
|
96 |
+
input_conv_filters=[32, 32, 64],
|
97 |
+
input_conv_kernel_sizes=[3, 3, 3],
|
98 |
+
stackwise_num_filters=[64, 128, 256, 512],
|
99 |
+
stackwise_num_blocks=[3, 4, 5, 6],
|
100 |
+
stackwise_num_strides=[1, 2, 2, 2],
|
101 |
+
block_type="bottleneck_block_vd",
|
102 |
+
)
|
103 |
+
output = model(input_data)
|
104 |
+
|
105 |
+
```
|