Skip to content

Commit

Permalink
Add YOLOV8 instance segmentation model using YOLACT (#2474)
Browse files Browse the repository at this point in the history
* Add YOLOV8 instance segmentation model using YOLACT

* Add indices to output for mask post processing selection

* Add YOLOV8 instance segmentation encoder

* Add YOLOV8 backbone features for instance segmentation model

* Add Keras copyright

* Update YOLOV8 instance segmentation model and loss

* Add yolo v8 segmentation to GPU tests

* Fix overwrite of API for label encoder

* Add to API YOLOV8Segmentation model

* Fix linter E501 warnings with imports

* Remove TODO

* Move docstring to class description
  • Loading branch information
oarriaga authored Sep 17, 2024
1 parent ba2556c commit 4e0855f
Show file tree
Hide file tree
Showing 10 changed files with 1,511 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .kokoro/github/ubuntu/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ then
keras_cv/src/models/object_detection_3d \
keras_cv/src/models/segmentation \
keras_cv/src/models/feature_extractor/clip \
keras_cv/src/models/stable_diffusion
keras_cv/src/models/stable_diffusion \
keras_cv/src/models/segmentation/yolo_v8_segmentation
else
pytest --cache-clear --check_gpu --run_large --durations 0 \
keras_cv/src/bounding_box \
Expand All @@ -90,5 +91,6 @@ else
keras_cv/src/models/object_detection_3d \
keras_cv/src/models/segmentation \
keras_cv/src/models/feature_extractor/clip \
keras_cv/src/models/stable_diffusion
fi
keras_cv/src/models/stable_diffusion \
keras_cv/src/models/segmentation/yolo_v8_segmentation
fi
3 changes: 3 additions & 0 deletions keras_cv/api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
from keras_cv.src.models.segmentation.segment_anything.sam_transformer import (
TwoWayTransformer,
)
from keras_cv.src.models.segmentation.yolo_v8_segmentation.yolo_v8_segmentation import (
YOLOV8Segmentation,
)
from keras_cv.src.models.stable_diffusion.stable_diffusion import (
StableDiffusion,
)
Expand Down
3 changes: 3 additions & 0 deletions keras_cv/api/models/segmentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
from keras_cv.src.models.segmentation.segment_anything.sam import (
SegmentAnythingModel,
)
from keras_cv.src.models.segmentation.yolo_v8_segmentation.yolo_v8_segmentation import (
YOLOV8Segmentation,
)
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def call(
image_shape=image_shape,
)
bounding_boxes = {
"idx": idx,
"boxes": box_prediction,
"confidence": confidence_prediction,
"classes": ops.argmax(class_prediction, axis=-1),
Expand Down
1 change: 1 addition & 0 deletions keras_cv/src/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
from keras_cv.src.models.segmentation import SAMPromptEncoder
from keras_cv.src.models.segmentation import SegmentAnythingModel
from keras_cv.src.models.segmentation import TwoWayTransformer
from keras_cv.src.models.segmentation import YOLOV8Segmentation
from keras_cv.src.models.segmentation.segformer.segformer_aliases import (
SegFormer,
)
Expand Down
3 changes: 3 additions & 0 deletions keras_cv/src/models/segmentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
SegmentAnythingModel,
)
from keras_cv.src.models.segmentation.segment_anything import TwoWayTransformer
from keras_cv.src.models.segmentation.yolo_v8_segmentation import (
YOLOV8Segmentation,
)
14 changes: 14 additions & 0 deletions keras_cv/src/models/segmentation/yolo_v8_segmentation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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.
from .yolo_v8_segmentation import YOLOV8Segmentation
Loading

0 comments on commit 4e0855f

Please sign in to comment.