SegResNetDS2 adds an additional decorder branch to SegResNetDS and is the image encoder of VISTA3D `_. Args: spatial_dims: spatial dimension of the input data. Defaults to 3. init_filters: number of output channels for initial convolut
| 442 | |
| 443 | |
| 444 | class SegResNetDS2(SegResNetDS): |
| 445 | """ |
| 446 | SegResNetDS2 adds an additional decorder branch to SegResNetDS and is the image encoder of VISTA3D |
| 447 | <https://arxiv.org/abs/2406.05285>`_. |
| 448 | |
| 449 | Args: |
| 450 | spatial_dims: spatial dimension of the input data. Defaults to 3. |
| 451 | init_filters: number of output channels for initial convolution layer. Defaults to 32. |
| 452 | in_channels: number of input channels for the network. Defaults to 1. |
| 453 | out_channels: number of output channels for the network. Defaults to 2. |
| 454 | act: activation type and arguments. Defaults to ``RELU``. |
| 455 | norm: feature normalization type and arguments. Defaults to ``BATCH``. |
| 456 | blocks_down: number of downsample blocks in each layer. Defaults to ``[1,2,2,4]``. |
| 457 | blocks_up: number of upsample blocks (optional). |
| 458 | dsdepth: number of levels for deep supervision. This will be the length of the list of outputs at each scale level. |
| 459 | At dsdepth==1,only a single output is returned. |
| 460 | preprocess: optional callable function to apply before the model's forward pass |
| 461 | resolution: optional input image resolution. When provided, the network will first use non-isotropic kernels to bring |
| 462 | image spacing into an approximately isotropic space. |
| 463 | Otherwise, by default, the kernel size and downsampling is always isotropic. |
| 464 | |
| 465 | """ |
| 466 | |
| 467 | def __init__( |
| 468 | self, |
| 469 | spatial_dims: int = 3, |
| 470 | init_filters: int = 32, |
| 471 | in_channels: int = 1, |
| 472 | out_channels: int = 2, |
| 473 | act: tuple | str = "relu", |
| 474 | norm: tuple | str = "batch", |
| 475 | blocks_down: tuple = (1, 2, 2, 4), |
| 476 | blocks_up: tuple | None = None, |
| 477 | dsdepth: int = 1, |
| 478 | preprocess: nn.Module | Callable | None = None, |
| 479 | upsample_mode: UpsampleMode | str = "deconv", |
| 480 | resolution: tuple | None = None, |
| 481 | ): |
| 482 | super().__init__( |
| 483 | spatial_dims=spatial_dims, |
| 484 | init_filters=init_filters, |
| 485 | in_channels=in_channels, |
| 486 | out_channels=out_channels, |
| 487 | act=act, |
| 488 | norm=norm, |
| 489 | blocks_down=blocks_down, |
| 490 | blocks_up=blocks_up, |
| 491 | dsdepth=dsdepth, |
| 492 | preprocess=preprocess, |
| 493 | upsample_mode=upsample_mode, |
| 494 | resolution=resolution, |
| 495 | ) |
| 496 | |
| 497 | self.up_layers_auto = nn.ModuleList([copy.deepcopy(layer) for layer in self.up_layers]) |
| 498 | |
| 499 | def forward( # type: ignore |
| 500 | self, x: torch.Tensor, with_point: bool = True, with_label: bool = True |
| 501 | ) -> tuple[None | torch.Tensor | list[torch.Tensor], None | torch.Tensor | list[torch.Tensor]]: |
no outgoing calls
searching dependent graphs…