Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions keras_cv/layers/vit_layers.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For get_config you can just use config.update() instead of this more verbose method.

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def call(
(
interpolated_embeddings,
class_token,
) = self.__interpolate_positional_embeddings(
) = self.interpolate_positional_embeddings(
self.position_embedding(positions),
interpolate_width,
interpolate_height,
Expand All @@ -167,7 +167,7 @@ def call(
encoded = patches_flattened + self.position_embedding(positions)
return encoded

def __interpolate_positional_embeddings(
def interpolate_positional_embeddings(
self, embedding, height, width, patch_size
):
"""
Expand Down
11 changes: 11 additions & 0 deletions keras_cv/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@
from keras_cv.models.backbones.resnet_v2.resnet_v2_backbone import (
ResNetV2Backbone,
)
from keras_cv.models.backbones.vit.vit_aliases import ViTB16Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTB32Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTH16Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTH32Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTL16Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTL32Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTS16Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTS32Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTTiny16Backbone
from keras_cv.models.backbones.vit.vit_aliases import ViTTiny32Backbone
from keras_cv.models.backbones.vit.vit_backbone import ViTBackbone
from keras_cv.models.classification.image_classifier import ImageClassifier
from keras_cv.models.object_detection.retinanet.retinanet import RetinaNet
from keras_cv.models.object_detection.yolo_v8.yolo_v8_backbone import (
Expand Down
3 changes: 3 additions & 0 deletions keras_cv/models/backbones/backbone_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from keras_cv.models.backbones.mobilenet_v3 import mobilenet_v3_backbone_presets
from keras_cv.models.backbones.resnet_v1 import resnet_v1_backbone_presets
from keras_cv.models.backbones.resnet_v2 import resnet_v2_backbone_presets
from keras_cv.models.backbones.vit import vit_backbone_presets
from keras_cv.models.object_detection.yolo_v8 import yolo_v8_backbone_presets

backbone_presets_no_weights = {
Expand All @@ -32,6 +33,7 @@
**efficientnet_v2_backbone_presets.backbone_presets_no_weights,
**densenet_backbone_presets.backbone_presets_no_weights,
**yolo_v8_backbone_presets.backbone_presets_no_weights,
**vit_backbone_presets.backbone_presets_no_weights,
}

backbone_presets_with_weights = {
Expand All @@ -42,6 +44,7 @@
**efficientnet_v2_backbone_presets.backbone_presets_with_weights,
**densenet_backbone_presets.backbone_presets_with_weights,
**yolo_v8_backbone_presets.backbone_presets_with_weights,
**vit_backbone_presets.backbone_presets_with_weights,
}

backbone_presets = {
Expand Down
13 changes: 13 additions & 0 deletions keras_cv/models/backbones/vit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading