Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update test
Browse files Browse the repository at this point in the history
eugene123tw committed Apr 18, 2024
1 parent 052a582 commit 28cea6f
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions tests/unit/algo/instance_segmentation/test_mmdet_decouple.py
Original file line number Diff line number Diff line change
@@ -4,33 +4,12 @@
from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING

from otx.core.model.utils.mmdet import create_model
from otx.core.types.task import OTXTaskType
from otx.core.utils.build import build_mm_model, get_classification_layers
from otx.engine import Engine
from otx.engine.utils.auto_configurator import DEFAULT_CONFIG_PER_TASK

if TYPE_CHECKING:
from omegaconf import DictConfig
from torch import nn


def create_model(config: DictConfig, load_from: str | None) -> tuple[nn.Module, dict[str, dict[str, int]]]:
"""Create a model from mmengine Model registry.
Args:
config (DictConfig): Model configuration.
load_from (str | None): Model weight file path.
Returns:
tuple[nn.Module, dict[str, dict[str, int]]]: Model instance and classification layers.
"""
from mmengine.registry import MODELS

classification_layers = get_classification_layers(config, MODELS, "model.")
return build_mm_model(config, MODELS, load_from), classification_layers


class TestDecoupleMMDetInstanceSeg:
def test_maskrcnn(self, tmp_path: Path) -> None:

0 comments on commit 28cea6f

Please sign in to comment.