Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

use of tf.slice to crop images #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
5 changes: 1 addition & 4 deletions tf2/data_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,7 @@ def distorted_bounding_box_crop(image,
bbox_begin, bbox_size, _ = sample_distorted_bounding_box

# Crop the image to the specified bounding box.
offset_y, offset_x, _ = tf.unstack(bbox_begin)
target_height, target_width, _ = tf.unstack(bbox_size)
image = tf.image.crop_to_bounding_box(
image, offset_y, offset_x, target_height, target_width)
image = tf.slice(image, bbox_begin, bbox_begin)

return image

Expand Down