Divyasreepat commited on
Commit
81b8f24
·
verified ·
1 Parent(s): 2f0c1c8

Update README.md with new model card content

Browse files
Files changed (1) hide show
  1. README.md +95 -29
README.md CHANGED
@@ -1,32 +1,98 @@
1
  ---
2
  library_name: keras-hub
3
  ---
4
- This is a [`CSPNet` model](https://keras.io/api/keras_hub/models/csp_net) uploaded using the KerasHub library and can be used with JAX, TensorFlow, and PyTorch backends.
5
- This model is related to a `ImageClassifier` task.
6
-
7
- Model config:
8
- * **name:** csp_net_backbone
9
- * **trainable:** True
10
- * **stem_filters:** 64
11
- * **stem_kernel_size:** 7
12
- * **stem_strides:** 4
13
- * **stackwise_depth:** [3, 3, 5, 2]
14
- * **stackwise_strides:** [1, 2, 2, 2]
15
- * **stackwise_num_filters:** [256, 512, 1024, 2048]
16
- * **stage_type:** csp
17
- * **block_type:** bottleneck_block
18
- * **output_strides:** 32
19
- * **groups:** 32
20
- * **activation:** leaky_relu
21
- * **bottle_ratio:** 1.0
22
- * **block_ratio:** 0.5
23
- * **expand_ratio:** 1.0
24
- * **stem_padding:** valid
25
- * **stem_pooling:** max
26
- * **avg_down:** False
27
- * **down_growth:** False
28
- * **cross_linear:** True
29
- * **image_shape:** [None, None, 3]
30
- * **data_format:** channels_last
31
-
32
- This model card has been generated automatically and should be completed by the model author. See [Model Cards documentation](https://huggingface.co/docs/hub/model-cards) for more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  library_name: keras-hub
3
  ---
4
+ ### Model Overview
5
+ This class represents the CSPDarkNet architecture.
6
+
7
+ **Reference**
8
+
9
+ - [CSPNet Paper](https://arxiv.org/abs/1911.11929)
10
+
11
+ For transfer learning use cases, make sure to read the
12
+ [guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).
13
+
14
+ ## Links
15
+ * [CSPNet Quickstart Notebook](https://www.kaggle.com/code/prasadsachin/cspnet-quickstart-kerashub)
16
+ * [CSPDarkNet API Documentation](https://keras.io/keras_hub/api/models/cspnet/)
17
+ * [CSPDarkNet Model Card](https://huggingface.co/timm/cspdarknet53.ra_in1k)
18
+ * [KerasHub Beginner Guide](https://keras.io/guides/keras_hub/getting_started/)
19
+ * [KerasHub Model Publishing Guide](https://keras.io/guides/keras_hub/upload/)
20
+
21
+ ## Installation
22
+
23
+ Keras and KerasHub can be installed with:
24
+
25
+ ```
26
+ pip install -U -q keras-hub
27
+ pip install -U -q keras
28
+ ```
29
+
30
+ 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
+
32
+ ## Presets
33
+
34
+ The following model checkpoints are provided by the Keras team. Weights have been ported from: https://huggingface.co/timm. Full code examples for each are available below.
35
+
36
+ | Preset name | Parameters | Description |
37
+ |-----------------------|------------|---------------|
38
+ | `csp_darknet_53_ra_imagenet` | 27642184 | A CSP-DarkNet (Cross-Stage-Partial) image classification model pre-trained on the Randomly Augmented ImageNet 1k dataset at a 256x256 resolution.|
39
+ | `csp_resnext_50_ra_imagenet` | 20569896 | A CSP-ResNeXt (Cross-Stage-Partial) image classification model pre-trained on the Randomly Augmented ImageNet 1k dataset at a 256x256 resolution.|
40
+ | `csp_resnet_50_ra_imagenet` | 21616168 | A CSP-ResNet (Cross-Stage-Partial) image classification model pre-trained on the Randomly Augmented ImageNet 1k dataset at a 256x256 resolution.|
41
+ | `darknet_53_imagenet` | 41609928 | A DarkNet image classification model pre-trained on the Randomly Augmented ImageNet 1k dataset at a 256x256 resolution.|
42
+
43
+ ## Example Usage
44
+ ```python
45
+ input_data = np.ones(shape=(8, 224, 224, 3))
46
+
47
+ # Pretrained backbone
48
+ model = keras_hub.models.CSPNetBackbone.from_preset("csp_resnext_50_ra_imagenet")
49
+ model(input_data)
50
+
51
+ # Randomly initialized backbone with a custom config
52
+ model = keras_hub.models.CSPNetBackbone(
53
+ stem_filters=32,
54
+ stem_kernel_size=3,
55
+ stem_strides=1,
56
+ stackwise_depth=[1, 2, 4],
57
+ stackwise_strides=[1, 2, 2],
58
+ stackwise_num_filters=[32, 64, 128],
59
+ block_type="dark",
60
+ )
61
+
62
+ model(input_data)
63
+
64
+ #Use cspnet for image classification task
65
+ model = keras_hub.models.ImageClassifier.from_preset("csp_resnext_50_ra_imagenet")
66
+
67
+ #Use Timm presets directly from HuggingFace
68
+ model = keras_hub.models.ImageClassifier.from_preset('hf://timm/cspdarknet53.ra_in1k')
69
+ ```
70
+
71
+ ## Example Usage with Hugging Face URI
72
+
73
+ ```python
74
+ input_data = np.ones(shape=(8, 224, 224, 3))
75
+
76
+ # Pretrained backbone
77
+ model = keras_hub.models.CSPNetBackbone.from_preset("hf://keras/csp_resnext_50_ra_imagenet")
78
+ model(input_data)
79
+
80
+ # Randomly initialized backbone with a custom config
81
+ model = keras_hub.models.CSPNetBackbone(
82
+ stem_filters=32,
83
+ stem_kernel_size=3,
84
+ stem_strides=1,
85
+ stackwise_depth=[1, 2, 4],
86
+ stackwise_strides=[1, 2, 2],
87
+ stackwise_num_filters=[32, 64, 128],
88
+ block_type="dark",
89
+ )
90
+
91
+ model(input_data)
92
+
93
+ #Use cspnet for image classification task
94
+ model = keras_hub.models.ImageClassifier.from_preset("hf://keras/csp_resnext_50_ra_imagenet")
95
+
96
+ #Use Timm presets directly from HuggingFace
97
+ model = keras_hub.models.ImageClassifier.from_preset('hf://timm/cspdarknet53.ra_in1k')
98
+ ```