Skip to content

Commit

Permalink
fix xai test and remove InstanceData
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene123tw committed May 10, 2024
1 parent 0fc7de9 commit 1826882
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/otx/algo/detection/heads/dynamic_soft_label_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
GPU_MEM_LIMIT = 1024**3 # 1 GB memory limit

if TYPE_CHECKING:
from mmengine.structures import InstanceData
from otx.algo.utils.mmengine_utils import InstanceData


def center_of_mass(masks: Tensor, eps: float = 1e-7) -> Tensor:
Expand Down Expand Up @@ -113,13 +113,13 @@ def assign(
Returns:
obj:`AssignResult`: The assigned result.
"""
gt_bboxes = gt_instances.bboxes
gt_labels = gt_instances.labels
gt_bboxes = gt_instances.bboxes # type: ignore[attr-defined]
gt_labels = gt_instances.labels # type: ignore[attr-defined]
num_gt = gt_bboxes.size(0)

decoded_bboxes = pred_instances.bboxes
pred_scores = pred_instances.scores
priors = pred_instances.priors
decoded_bboxes = pred_instances.bboxes # type: ignore[attr-defined]
pred_scores = pred_instances.scores # type: ignore[attr-defined]
priors = pred_instances.priors # type: ignore[attr-defined]
num_bboxes = decoded_bboxes.size(0)

# assign 0 by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import torch
import torch.nn.functional
from datumaro import Polygon
from mmengine.structures import InstanceData
from torch import Tensor, nn

from otx.algo.detection.ops.nms import batched_nms, multiclass_nms
Expand All @@ -30,6 +29,7 @@
from otx.algo.modules.base_module import BaseModule
from otx.algo.modules.conv_module import ConvModule
from otx.algo.modules.norm import is_norm
from otx.algo.utils.mmengine_utils import InstanceData
from otx.algo.utils.weight_init import bias_init_with_prob, constant_init, normal_init
from otx.core.data.entity.instance_segmentation import InstanceSegBatchDataEntity
from otx.core.utils.mask_util import polygon_to_bitmap
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import torch
from datumaro import Polygon
from mmdet.structures import DetDataSample
from mmengine.structures import InstanceData
from otx.algo.utils.mmengine_utils import InstanceData
from otx.core.data.entity.base import ImageInfo
from otx.core.data.entity.classification import (
HlabelClsBatchDataEntity,
Expand Down
5 changes: 0 additions & 5 deletions tests/integration/api/test_xai.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ def test_forward_explain(
if "dino" in model_name:
pytest.skip("DINO is not supported.")

# TODO(someone): fix xai for RTMDet
# https://github.com/openvinotoolkit/training_extensions/pull/3433
if "rtmdet_inst_tiny" in model_name:
pytest.skip("DINO is not supported.")

engine = Engine.from_config(
config_path=recipe,
data_root=fxt_target_dataset_per_task[task],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/algo/detection/heads/test_sim_ota_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"""

import torch
from mmengine.structures import InstanceData # TODO (sungchul): remove
from otx.algo.detection.heads.sim_ota_assigner import SimOTAAssigner
from otx.algo.utils.mmengine_utils import InstanceData


class TestSimOTAAssigner:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/algo/detection/heads/test_yolox_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import torch
from mmengine.config import Config
from mmengine.structures import InstanceData
from otx.algo.detection.heads.yolox_head import YOLOXHead
from otx.algo.modules.conv_module import ConvModule
from otx.algo.modules.depthwise_separable_conv_module import DepthwiseSeparableConvModule # TODO (sungchul): remove
from otx.algo.modules.depthwise_separable_conv_module import DepthwiseSeparableConvModule
from otx.algo.utils.mmengine_utils import InstanceData


class TestYOLOXHead:
Expand Down

0 comments on commit 1826882

Please sign in to comment.