Skip to content

Feat: Add roi_align_rotated - #36

Merged
cregouby merged 28 commits into
mlverse:mainfrom
DerrickUnleashed:feat/roiAlignedRotate
Sep 1, 2026
Merged

cregouby merged 28 commits into
mlverse:mainfrom
DerrickUnleashed:feat/roiAlignedRotate

Conversation

@DerrickUnleashed

@DerrickUnleashed DerrickUnleashed commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Adds ops_roi_align_rotated() / nn_roi_align_rotated(), a CPU RoI align pooling op for rotated boxes, ported from mmcv (Apache-2.0). Includes dispatcher + autograd kernels, R API + docs, and tests.

Closes #32

library(torch)
library(torchvision)
library(torchvisionlib)

url <- "https://upload.wikimedia.org/wikipedia/commons/b/b6/Felis_catus-cat_on_snow.jpg"
arr <- base_loader(url)                           
input <- torch_tensor(arr)$permute(c(3, 1, 2))$unsqueeze(1)     

rois <- torch_tensor(matrix(c(
  1, 3*W/2, 3*H/2, W, H, pi,
  1, W/2,   3*H/2, W, H, pi,
  1, 3*W/2, H/2, W, H, pi,
  1, W/2,   H/2, W, H, pi
), ncol = 6, byrow = TRUE), dtype = torch_float32())

out <- ops_roi_align_rotated(input, rois, c(128, 128), spatial_scale = 1, sampling_ratio = 2)

grid <- vision_make_grid(out, num_rows = 2, padding = 6, pad_value = 1)

tensor_image_browse(grid)     
file339407cbfb

Loading
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.

implement roi_aligned_rotated

2 participants