Run this model with HF Jobs

Run keras/densenet_169_imagenet on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/keras/densenet_169_imagenet. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/keras/densenet_169_imagenet on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Model Overview

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.

Weights are released under the 3-Clause BSD License. Keras model code is released under the Apache 2 License.

Links

Installation

Keras and KerasHub can be installed with:

pip install -U -q keras-hub
pip install -U -q keras

Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the Keras Getting Started page.

Presets

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.

Preset name Parameters Description
densenet_121_imagenet 7037504 DenseNet model with 121 layers. Trained on Imagenet 2012 classification task.
densenet_169_imagenet 12642880 DenseNet model with 169 layers. Trained on Imagenet 2012 classification task.
densenet_201_imagenet 18321984 DenseNet model with 201 layers. Trained on Imagenet 2012 classification task.

Example Usage

input_data = np.ones(shape=(8, 224, 224, 3))

# Pretrained backbone
model = keras_hub.models.DenseNetBackbone.from_preset("densenet_169_imagenet")
model(input_data)

# Randomly initialized backbone with a custom config
model = keras_hub.models.DenseNetBackbone(
    stackwise_num_repeats=[6, 12, 24, 16],
)
model(input_data)

# Use densenet for image classification task
model = keras_hub.models.ImageClassifier.from_preset("densenet_169_imagenet")

# Use Timm presets directly from HuggingFace
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/densenet121.tv_in1k')

Example Usage with Hugging Face URI

input_data = np.ones(shape=(8, 224, 224, 3))

# Pretrained backbone
model = keras_hub.models.DenseNetBackbone.from_preset("hf://keras/densenet_169_imagenet")
model(input_data)

# Randomly initialized backbone with a custom config
model = keras_hub.models.DenseNetBackbone(
    stackwise_num_repeats=[6, 12, 24, 16],
)
model(input_data)

# Use densenet for image classification task
model = keras_hub.models.ImageClassifier.from_preset("hf://keras/densenet_169_imagenet")

# Use Timm presets directly from HuggingFace
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/densenet121.tv_in1k')
Downloads last month
11
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Collection including keras/densenet_169_imagenet