Image Classification
KerasHub
Divyasreepat commited on
Commit
3ed1d2b
1 Parent(s): 3387dff

Update README.md with new model card content

Browse files
Files changed (1) hide show
  1. README.md +72 -7
README.md CHANGED
@@ -1,12 +1,77 @@
1
  ---
2
  library_name: keras-hub
3
  ---
4
- This is a [`VGG` model](https://keras.io/api/keras_hub/models/vgg) 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
- * **stackwise_num_repeats:** [2, 2, 3, 3, 3]
9
- * **stackwise_num_filters:** [64, 128, 256, 512, 512]
10
- * **image_shape:** [None, None, 3]
11
 
12
- 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
+ The VGG model is a type of convolutional neural network (CNN) architecture designed for image recognition and classification tasks. Developed by the Visual Geometry Group at the University of Oxford, it was introduced in the paper titled "Very Deep Convolutional Networks for Large-Scale Image Recognition" by Karen Simonyan and Andrew Zisserman in 2014. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub.
6
 
 
 
 
 
7
 
8
+
9
+ ## Links
10
+ * [VGG paper](https://arxiv.org/abs/1409.1556)
11
+
12
+ ## Installation
13
+
14
+ Keras and KerasHub can be installed with:
15
+
16
+ ```
17
+ pip install -U -q keras-Hub
18
+ pip install -U -q keras>=3
19
+ ```
20
+
21
+ 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.
22
+
23
+ ## Presets
24
+
25
+ The following model checkpoints are provided by the Keras team. Weights have been ported from https://huggingface.co/timm.
26
+
27
+ | Preset Name | Parameters | Description |
28
+ |------------------|------------|----------------------------------------------------------------|
29
+ | vgg_11_imagenet | 9.22M | 11-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
30
+ | vgg_13_imagenet | 9.40M | 13-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
31
+ | vgg_16_imagenet | 14.71M | 16-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
32
+ | vgg_19_imagenet | 20.02M | 19-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
33
+
34
+ ### Example Usage
35
+ ```python
36
+ input_data = np.ones(shape=(2, 224, 224, 3))
37
+
38
+ # Pretrained backbone
39
+ model = keras_hub.models.VGGBackbone.from_preset("vgg_11_imagenet")
40
+ model(input_data)
41
+
42
+ # Randomly initialized backbone with a custom config
43
+ model = keras_hub.models.VGGBackbone(
44
+ stackwise_num_repeats=[2, 3, 3, 2],
45
+ stackwise_num_filters=[64, 128, 256, 512],
46
+ )
47
+ model(input_data)
48
+
49
+ # Use VGG for image classification task
50
+ model = keras_hub.models.ImageClassifier.from_preset("vgg_11_imagenet")
51
+
52
+ # User Timm presets directly from HuggingFace
53
+ model = keras_hub.models.ImageClassifier.from_preset('hf://timm/vgg11.tv_in1k')
54
+ ```
55
+
56
+ ## Example Usage with Hugging Face URI
57
+
58
+ ```python
59
+ input_data = np.ones(shape=(2, 224, 224, 3))
60
+
61
+ # Pretrained backbone
62
+ model = keras_hub.models.VGGBackbone.from_preset("vgg_11_imagenet")
63
+ model(input_data)
64
+
65
+ # Randomly initialized backbone with a custom config
66
+ model = keras_hub.models.VGGBackbone(
67
+ stackwise_num_repeats=[2, 3, 3, 2],
68
+ stackwise_num_filters=[64, 128, 256, 512],
69
+ )
70
+ model(input_data)
71
+
72
+ # Use VGG for image classification task
73
+ model = keras_hub.models.ImageClassifier.from_preset("vgg_11_imagenet")
74
+
75
+ # User Timm presets directly from HuggingFace
76
+ model = keras_hub.models.ImageClassifier.from_preset('hf://timm/vgg11.tv_in1k')
77
+ ```