- 
                Notifications
    
You must be signed in to change notification settings  - Fork 7.2k
 
Disable integer dtype for rotated bounding boxes #9133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e417da1
              1e4d8ae
              ed95753
              49962b5
              69f1eef
              a4b2534
              2e6a52b
              d94e031
              15b0d78
              468f55b
              a7e8b79
              4416135
              8a26141
              6fd0d51
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -99,6 +99,11 @@ def _wrap(cls, tensor: torch.Tensor, *, format: BoundingBoxFormat | str, canvas_ | |
| bounding_boxes.clamping_mode = clamping_mode | ||
| return bounding_boxes | ||
| 
     | 
||
| @staticmethod | ||
| def _check_format(tensor: torch.Tensor, format: BoundingBoxFormat) -> None: | ||
| if not torch.is_floating_point(tensor) and is_rotated_bounding_format(format): | ||
| raise ValueError("Rotated bounding boxes should be floating point tensors") | ||
| 
     | 
||
| def __new__( | ||
| cls, | ||
| data: Any, | ||
| 
        
          
        
         | 
    @@ -111,6 +116,7 @@ def __new__( | |
| requires_grad: bool | None = None, | ||
| ) -> BoundingBoxes: | ||
| tensor = cls._to_tensor(data, dtype=dtype, device=device, requires_grad=requires_grad) | ||
| cls._check_format(tensor, format=format) | ||
                
       | 
||
| return cls._wrap(tensor, format=format, canvas_size=canvas_size, clamping_mode=clamping_mode) | ||
| 
     | 
||
| @classmethod | ||
| 
          
            
          
           | 
    ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not immediately obvious that this relates to dtypes, so just flagging to make sure this change is intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NicolasHug good catch. Yeah this was related to
dtypeand introduction of epsilon. I have remove it in a later commit attached to this PR.