2021-09-09 12:13:53 +08:00
|
|
|
# Copyright (c) OpenMMLab. All rights reserved.
|
|
|
|
import torch
|
|
|
|
|
|
|
|
from mmseg.models.decode_heads import ISAHead
|
|
|
|
from .utils import to_cuda
|
|
|
|
|
|
|
|
|
|
|
|
def test_isa_head():
|
|
|
|
|
2021-11-01 22:47:43 +08:00
|
|
|
inputs = [torch.randn(1, 8, 23, 23)]
|
2021-09-09 12:13:53 +08:00
|
|
|
isa_head = ISAHead(
|
2021-11-01 22:47:43 +08:00
|
|
|
in_channels=8,
|
|
|
|
channels=4,
|
2021-09-09 12:13:53 +08:00
|
|
|
num_classes=19,
|
2021-11-01 22:47:43 +08:00
|
|
|
isa_channels=4,
|
2021-09-09 12:13:53 +08:00
|
|
|
down_factor=(8, 8))
|
|
|
|
if torch.cuda.is_available():
|
|
|
|
isa_head, inputs = to_cuda(isa_head, inputs)
|
|
|
|
output = isa_head(inputs)
|
2021-11-01 22:47:43 +08:00
|
|
|
assert output.shape == (1, isa_head.num_classes, 23, 23)
|