Skip to content

Commit

Permalink
Implement the new bounding box API (#441)
Browse files Browse the repository at this point in the history
* Begin updating bounding box format

* Update to fix unit tests

* Fix fill utils

* reformat

* Update to pass lint

* Reformat

* Update per comments

* fix lint errors

* Update bounding box tool

* Reformat string names

* add rel_xyxy format

* add dtype to MaP and Recall

* Rename to convert_format

* Address comments

* Fix lint error

* Fix realization test

* fix broken test
  • Loading branch information
LukeWood authored Jun 9, 2022
1 parent d69c617 commit af99850
Show file tree
Hide file tree
Showing 21 changed files with 556 additions and 311 deletions.
5 changes: 5 additions & 0 deletions examples/layers/preprocessing/cut_mix_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def resize(image, label, num_classes=10):
return image, label


def to_dict(images, labels):
return {"images": images, "labels": labels}


def main():
data, ds_info = tfds.load("oxford_flowers102", with_info=True, as_supervised=True)
train_ds = data["train"]
Expand All @@ -43,6 +47,7 @@ def main():
train_ds.map(lambda x, y: resize(x, y, num_classes=num_classes))
.shuffle(10 * BATCH_SIZE)
.batch(BATCH_SIZE)
.map(to_dict)
)
cutmix = preprocessing.CutMix()
train_ds = train_ds.map(
Expand Down
14 changes: 4 additions & 10 deletions keras_cv/bounding_box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from keras_cv.bounding_box.convert_to_corners import convert_to_corners
from keras_cv.bounding_box.converters import convert_format
from keras_cv.bounding_box.formats import CENTER_XYWH
from keras_cv.bounding_box.formats import XYWH
from keras_cv.bounding_box.formats import XYXY
from keras_cv.bounding_box.pad_batch_to_shape import pad_batch_to_shape

# These are the indexes used in Tensors to represent each corresponding side.
LEFT, TOP, RIGHT, BOTTOM = 0, 1, 2, 3

# Regardless of format these constants are consistent.
# Class is held in the 5th index
CLASS = 4
# Confidence exists only on y_pred, and is in the 6th index.
CONFIDENCE = 5
117 changes: 0 additions & 117 deletions keras_cv/bounding_box/bounding_box_test.py

This file was deleted.

75 changes: 0 additions & 75 deletions keras_cv/bounding_box/convert_to_corners.py

This file was deleted.

Loading

0 comments on commit af99850

Please sign in to comment.