Reference for ultralytics/models/fastsam/utils.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/fastsam/utils.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.fastsam.utils.adjust_bboxes_to_image_border
Adjust bounding boxes to stick to image border if they are within a certain threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
boxes
|
Tensor
|
Bounding boxes with shape (n, 4) in xyxy format. |
required |
image_shape
|
Tuple[int, int]
|
Image dimensions as (height, width). |
required |
threshold
|
int
|
Pixel threshold for considering a box close to the border. |
20
|
Returns:
Name | Type | Description |
---|---|---|
boxes |
Tensor
|
Adjusted bounding boxes with shape (n, 4). |
Source code in ultralytics/models/fastsam/utils.py
📅 Created 1 year ago
✏️ Updated 6 months ago