Table of Contents
Shortcuts

# clip_boxes_to_image

torchvision.ops.clip_boxes_to_image(boxes: Tensor, size: Tuple[int, int]) → Tensor

  Clip boxes so that they lie inside an image of size size.

  Parameters:

    - boxes (Tensor[N, 4]) – boxes in `(x1, y1, x2, y2)` format with `0 <= x1 < x2` and `0 <= y1 < y2`.

    - size (Tuple[height, width]) – size of the image

  Returns:

    clipped boxes

  Return type:

    Tensor[N, 4]

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.