Skip to content

Feat: item transform random resize crop - #386

Open
srishtiii28 wants to merge 2 commits into
mlverse:mainfrom
srishtiii28:feat/item_transform_random_resize_crop
Open

Feat: item transform random resize crop#386
srishtiii28 wants to merge 2 commits into
mlverse:mainfrom
srishtiii28:feat/item_transform_random_resize_crop

Conversation

@srishtiii28

Copy link
Copy Markdown
Contributor

Closes #361

Adds item_transform_random_resize_crop(), covering object detection item, object detection dataset, semantic segmentation item and semantic segmentation dataset.

@srishtiii28

Copy link
Copy Markdown
Contributor Author

fix: keep random_resized_crop central crop inside the image is a prerequisite rather than a separate concern: the central-crop fallback in get_random_resized_crop_params() returned a zero-based corner while the sampled crops return a one-based one. transform_crop() then padded a black row and column and dropped the image's last row and column, visible through transform_random_resized_crop() too, which is why the regression test sits in test-transforms-defaults.R. Happy to split it into its own PR if needed.

@cregouby cregouby left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

praise Thanks for this contribution!

Comment on lines +218 to +219
item_transform_random_resize_crop <- function(x, size, scale = c(0.08, 1.0),
ratio = c(3. / 4., 4. / 3.),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

todo "1.0" and "3. / 4." have no sense in R. Please use "1" and "3/4"

Comment on lines +225 to +226
item_transform_random_resize_crop.dataset <- function(x, size, scale = c(0.08, 1.0),
ratio = c(3. / 4., 4. / 3.),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

todo idem

Comment on lines +308 to +314
item_transform_random_resize_crop.image_with_rotated_box <- function(x, size, scale = c(0.08, 1.0),
ratio = c(3. / 4., 4. / 3.),
interpolation = 2) {
item_transform_random_resize_crop.image_with_bounding_box(
x, size = size, scale = scale, ratio = ratio, interpolation = interpolation
)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

todo could be simplified into

Suggested change
item_transform_random_resize_crop.image_with_rotated_box <- function(x, size, scale = c(0.08, 1.0),
ratio = c(3. / 4., 4. / 3.),
interpolation = 2) {
item_transform_random_resize_crop.image_with_bounding_box(
x, size = size, scale = scale, ratio = ratio, interpolation = interpolation
)
}
item_transform_random_resize_crop.image_with_rotated_box <-item_transform_random_resize_crop.image_with_bounding_box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add item_transform_random_resize_crop

2 participants