Divyasreepat
commited on
Commit
•
2aa80e2
1
Parent(s):
78ecd1c
Update README.md with new model card content
Browse files
README.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
---
|
2 |
library_name: keras-hub
|
3 |
---
|
4 |
-
|
5 |
-
This model is related to an `ImageClassifier` task.
|
6 |
-
|
7 |
DenseNet is a convolution network which densely connects each layer to every other layer in a feed-forward fashion. The model was originally evaluated on four object recognition benchmark tasks (CIFAR-10, CIFAR-100, SVHN, and ImageNet). See the model card below for benchmarks, data sources, and intended use cases. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub.
|
8 |
|
9 |
-
Weights are released under the [3-Clause BSD License](https://github.com/liuzhuang13/DenseNet/blob/master/LICENSE). Keras model code is released under the [Apache 2 License](https://github.com/keras-team/keras-
|
10 |
|
11 |
## Links
|
12 |
|
@@ -20,7 +18,7 @@ Keras and KerasHub can be installed with:
|
|
20 |
|
21 |
```
|
22 |
pip install -U -q keras-hub
|
23 |
-
pip install -U -q keras
|
24 |
```
|
25 |
|
26 |
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.
|
@@ -31,17 +29,39 @@ The following model checkpoints are provided by the Keras team. Weights have bee
|
|
31 |
|
32 |
| Preset name | Parameters | Description |
|
33 |
|-----------------------|------------|---------------|
|
|
|
34 |
| `densenet_121_imagenet` | 7037504 | DenseNet model with 121 layers. Trained on Imagenet 2012 classification task. |
|
35 |
| `densenet_169_imagenet` | 12642880 | DenseNet model with 169 layers. Trained on Imagenet 2012 classification task. |
|
36 |
| `densenet_201_imagenet` | 18321984 | DenseNet model with 201 layers. Trained on Imagenet 2012 classification task. |
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
```python
|
41 |
-
|
42 |
|
43 |
# Pretrained backbone
|
44 |
-
model = keras_hub.models.DenseNetBackbone.from_preset("
|
45 |
model(input_data)
|
46 |
|
47 |
# Randomly initialized backbone with a custom config
|
@@ -51,8 +71,8 @@ model = keras_hub.models.DenseNetBackbone(
|
|
51 |
model(input_data)
|
52 |
|
53 |
# Use densenet for image classification task
|
54 |
-
model = keras_hub.models.ImageClassifier.from_preset("
|
55 |
|
56 |
# User Timm presets directly from HuggingFace
|
57 |
-
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/
|
58 |
```
|
|
|
1 |
---
|
2 |
library_name: keras-hub
|
3 |
---
|
4 |
+
### Model Overview
|
|
|
|
|
5 |
DenseNet is a convolution network which densely connects each layer to every other layer in a feed-forward fashion. The model was originally evaluated on four object recognition benchmark tasks (CIFAR-10, CIFAR-100, SVHN, and ImageNet). See the model card below for benchmarks, data sources, and intended use cases. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub.
|
6 |
|
7 |
+
Weights are released under the [3-Clause BSD License](https://github.com/liuzhuang13/DenseNet/blob/master/LICENSE). Keras model code is released under the [Apache 2 License](https://github.com/keras-team/keras-hub/blob/master/LICENSE).
|
8 |
|
9 |
## Links
|
10 |
|
|
|
18 |
|
19 |
```
|
20 |
pip install -U -q keras-hub
|
21 |
+
pip install -U -q keras>=3
|
22 |
```
|
23 |
|
24 |
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.
|
|
|
29 |
|
30 |
| Preset name | Parameters | Description |
|
31 |
|-----------------------|------------|---------------|
|
32 |
+
|
|
33 |
| `densenet_121_imagenet` | 7037504 | DenseNet model with 121 layers. Trained on Imagenet 2012 classification task. |
|
34 |
| `densenet_169_imagenet` | 12642880 | DenseNet model with 169 layers. Trained on Imagenet 2012 classification task. |
|
35 |
| `densenet_201_imagenet` | 18321984 | DenseNet model with 201 layers. Trained on Imagenet 2012 classification task. |
|
36 |
|
37 |
+
### Example Usage
|
38 |
+
```python
|
39 |
+
input_data = np.ones(shape=(8, 224, 224, 3))
|
40 |
+
|
41 |
+
# Pretrained backbone
|
42 |
+
model = keras_hub.models.DenseNetBackbone.from_preset("densenet_121_imagenet")
|
43 |
+
model(input_data)
|
44 |
+
|
45 |
+
# Randomly initialized backbone with a custom config
|
46 |
+
model = keras_hub.models.DenseNetBackbone(
|
47 |
+
stackwise_num_repeats=[6, 12, 24, 16],
|
48 |
+
)
|
49 |
+
model(input_data)
|
50 |
+
|
51 |
+
# Use densenet for image classification task
|
52 |
+
model = keras_hub.models.ImageClassifier.from_preset("densenet_121_imagenet")
|
53 |
+
|
54 |
+
# User Timm presets directly from HuggingFace
|
55 |
+
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/densenet121.tv_in1k')
|
56 |
+
```
|
57 |
+
|
58 |
+
## Example Usage with Hugging Face URI
|
59 |
|
60 |
```python
|
61 |
+
input_data = np.ones(shape=(8, 224, 224, 3))
|
62 |
|
63 |
# Pretrained backbone
|
64 |
+
model = keras_hub.models.DenseNetBackbone.from_preset("densenet_121_imagenet")
|
65 |
model(input_data)
|
66 |
|
67 |
# Randomly initialized backbone with a custom config
|
|
|
71 |
model(input_data)
|
72 |
|
73 |
# Use densenet for image classification task
|
74 |
+
model = keras_hub.models.ImageClassifier.from_preset("densenet_121_imagenet")
|
75 |
|
76 |
# User Timm presets directly from HuggingFace
|
77 |
+
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/densenet121.tv_in1k')
|
78 |
```
|