Skip to content

Commit

Permalink
Export task models as both models.task.Model and models.Model (#2093)
Browse files Browse the repository at this point in the history
* Export task models as both models.task.Model and models.Model

* Same for ImageClassifier
  • Loading branch information
ianstenbit authored Oct 2, 2023
1 parent f2721af commit 69de849
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
7 changes: 6 additions & 1 deletion keras_cv/models/classification/image_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
from keras_cv.utils.python_utils import classproperty


@keras_cv_export("keras_cv.models.ImageClassifier")
@keras_cv_export(
[
"keras_cv.models.ImageClassifier",
"keras_cv.models.classification.ImageClassifier",
]
)
class ImageClassifier(Task):
"""Image classifier with pooling and dense layer prediction head.
Expand Down
4 changes: 3 additions & 1 deletion keras_cv/models/object_detection/retinanet/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
BOX_VARIANCE = [0.1, 0.1, 0.2, 0.2]


@keras_cv_export("keras_cv.models.RetinaNet")
@keras_cv_export(
["keras_cv.models.RetinaNet", "keras_cv.models.object_detection.RetinaNet"]
)
class RetinaNet(Task):
"""A Keras model implementing the RetinaNet meta-architecture.
Expand Down
7 changes: 6 additions & 1 deletion keras_cv/models/object_detection/yolo_v8/yolo_v8_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,12 @@ def dist2bbox(distance, anchor_points):
return ops.concatenate((x1y1, x2y2), axis=-1) # xyxy bbox


@keras_cv_export("keras_cv.models.YOLOV8Detector")
@keras_cv_export(
[
"keras_cv.models.YOLOV8Detector",
"keras_cv.models.object_detection.YOLOV8Detector",
]
)
class YOLOV8Detector(Task):
"""Implements the YOLOV8 architecture for object detection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
from keras_cv.utils.train import get_feature_extractor


@keras_cv_export("keras_cv.models.DeepLabV3Plus")
@keras_cv_export(
[
"keras_cv.models.DeepLabV3Plus",
"keras_cv.models.segmentation.DeepLabV3Plus",
]
)
class DeepLabV3Plus(Task):
"""A Keras model implementing the DeepLabV3+ architecture for semantic
segmentation.
Expand Down
4 changes: 3 additions & 1 deletion keras_cv/models/segmentation/segformer/segformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
from keras_cv.utils.train import get_feature_extractor


@keras_cv_export("keras_cv.models.segmentation.SegFormer")
@keras_cv_export(
["keras_cv.models.SegFormer", "keras_cv.models.segmentation.SegFormer"]
)
class SegFormer(Task):
"""A Keras model implementing the SegFormer architecture for semantic
segmentation.
Expand Down
6 changes: 5 additions & 1 deletion keras_cv/models/segmentation/segment_anything/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@


@keras_cv_export(
"keras_cv.models.SegmentAnythingModel", package="keras_cv.models"
[
"keras_cv.models.SegmentAnythingModel",
"keras_cv.models.segmentation.SegmentAnythingModel",
],
package="keras_cv.models",
)
class SegmentAnythingModel(Task):
"""
Expand Down

0 comments on commit 69de849

Please sign in to comment.