From 20a6625b339c7787aac6c5536e0e613170226483 Mon Sep 17 00:00:00 2001 From: Leon Dong Date: Wed, 9 Oct 2024 20:30:41 -0700 Subject: [PATCH 1/2] Fix detector build issues Summary: Made changes to make some previous components compatible with vizard. - Modified rotated box to accept additional arguments to support forward compatibility with vizard (arguments are unused) - Created new config file for testing, don't need to change and revert changes golden config file anymore during devloop - Added registering my test train datasets to setup function - Added imports to load components into registries - **[IMPORTANT TO REVIEW] Modified serializer class for datasets (no longer uses SharedList, read more on what SharedList does here: https://fburl.com/code/23u0ci1z)** Reviewed By: srihari2761 Differential Revision: D64119684 fbshipit-source-id: 662cf1a271cd5db6686c03d6ed93dd85e5287f9a --- detectron2/structures/rotated_boxes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detectron2/structures/rotated_boxes.py b/detectron2/structures/rotated_boxes.py index c842b999db..01a363fd5b 100644 --- a/detectron2/structures/rotated_boxes.py +++ b/detectron2/structures/rotated_boxes.py @@ -1,6 +1,6 @@ # Copyright (c) Facebook, Inc. and its affiliates. import math -from typing import List, Tuple +from typing import Any, List, Tuple import torch from detectron2.layers.rotated_boxes import pairwise_iou_rotated @@ -229,7 +229,7 @@ def clone(self) -> "RotatedBoxes": """ return RotatedBoxes(self.tensor.clone()) - def to(self, device: torch.device): + def to(self, device: torch.device, *args: Any, **kwargs: Any): # Boxes are assumed float32 and does not support to(dtype) return RotatedBoxes(self.tensor.to(device=device)) From 28fd05eeb68114aa8a8d915168bdf6e7f7b5c2a6 Mon Sep 17 00:00:00 2001 From: Leon Dong Date: Thu, 10 Oct 2024 17:47:26 -0700 Subject: [PATCH 2/2] Revert rotated boxes change Summary: Previous change (D64119684) broke a test T204260403. This diff reverts the change and ensures that the detector model still works. Reviewed By: srihari2761 Differential Revision: D64198984 fbshipit-source-id: eb4e509fd74dabe2bbb2bb39e3a45f06b9cfb71c --- detectron2/structures/rotated_boxes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detectron2/structures/rotated_boxes.py b/detectron2/structures/rotated_boxes.py index 01a363fd5b..cb65e22036 100644 --- a/detectron2/structures/rotated_boxes.py +++ b/detectron2/structures/rotated_boxes.py @@ -1,6 +1,6 @@ # Copyright (c) Facebook, Inc. and its affiliates. import math -from typing import Any, List, Tuple +from typing import List, Tuple import torch from detectron2.layers.rotated_boxes import pairwise_iou_rotated @@ -229,9 +229,9 @@ def clone(self) -> "RotatedBoxes": """ return RotatedBoxes(self.tensor.clone()) - def to(self, device: torch.device, *args: Any, **kwargs: Any): + def to(self, device: torch.device, non_blocking: bool = False): # Boxes are assumed float32 and does not support to(dtype) - return RotatedBoxes(self.tensor.to(device=device)) + return RotatedBoxes(self.tensor.to(device=device, non_blocking=non_blocking)) def area(self) -> torch.Tensor: """