Views
No views yet
pip install -U -q keras-hub
pip install -U -q keras| Preset name | Parameters | Description |
|---|---|---|
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. |
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. |
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. |
darknet_53_imagenet | 41609928 | A DarkNet image classification model pre-trained on the Randomly Augmented ImageNet 1k dataset at a 256x256 resolution. |
1input_data = np.ones(shape=(8, 224, 224, 3))
2
3# Pretrained backbone
4model = keras_hub.models.CSPNetBackbone.from_preset("darknet_53_imagenet")
5model(input_data)
6
7# Randomly initialized backbone with a custom config
8 model = keras_hub.models.CSPNetBackbone(
9 stem_filters=32,
10 stem_kernel_size=3,
11 stem_strides=1,
12 stackwise_depth=[1, 2, 4],
13 stackwise_strides=[1, 2, 2],
14 stackwise_num_filters=[32, 64, 128],
15 block_type="dark",
16)
17
18model(input_data)
19
20#Use cspnet for image classification task
21model = keras_hub.models.ImageClassifier.from_preset("darknet_53_imagenet")
22
23#Use Timm presets directly from HuggingFace
24model = keras_hub.models.ImageClassifier.from_preset('hf://timm/cspdarknet53.ra_in1k')1input_data = np.ones(shape=(8, 224, 224, 3))
2
3# Pretrained backbone
4model = keras_hub.models.CSPNetBackbone.from_preset("hf://keras/darknet_53_imagenet")
5model(input_data)
6
7# Randomly initialized backbone with a custom config
8 model = keras_hub.models.CSPNetBackbone(
9 stem_filters=32,
10 stem_kernel_size=3,
11 stem_strides=1,
12 stackwise_depth=[1, 2, 4],
13 stackwise_strides=[1, 2, 2],
14 stackwise_num_filters=[32, 64, 128],
15 block_type="dark",
16)
17
18model(input_data)
19
20#Use cspnet for image classification task
21model = keras_hub.models.ImageClassifier.from_preset("hf://keras/darknet_53_imagenet")
22
23#Use Timm presets directly from HuggingFace
24model = keras_hub.models.ImageClassifier.from_preset('hf://timm/cspdarknet53.ra_in1k')