regnet
model.backbone.torchvision.regnet
__all__
module-attribute
__all__ = ['RegNet', 'regnet_y_400mf', 'regnet_y_800mf', 'regnet_y_1_6gf', 'regnet_y_3_2gf', 'regnet_y_8gf', 'regnet_y_16gf', 'regnet_y_32gf', 'regnet_y_128gf', 'regnet_x_400mf', 'regnet_x_800mf', 'regnet_x_1_6gf', 'regnet_x_3_2gf', 'regnet_x_8gf', 'regnet_x_16gf', 'regnet_x_32gf']
SimpleStemIN
SimpleStemIN(width_in: int, width_out: int, norm_layer: Callable[..., Module], activation_layer: Callable[..., Module])
Bases: Conv2dNormActivation
Simple stem for ImageNet: 3x3, BN, ReLU.
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
BottleneckTransform
BottleneckTransform(width_in: int, width_out: int, stride: int, norm_layer: Callable[..., Module], activation_layer: Callable[..., Module], group_width: int, bottleneck_multiplier: float, se_ratio: Optional[float])
Bases: Sequential
Bottleneck transformation: 1x1, 3x3 [+SE], 1x1.
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
ResBottleneckBlock
ResBottleneckBlock(width_in: int, width_out: int, stride: int, norm_layer: Callable[..., Module], activation_layer: Callable[..., Module], group_width: int = 1, bottleneck_multiplier: float = 1.0, se_ratio: Optional[float] = None)
Bases: Module
Residual bottleneck block: x + F(x), F = bottleneck transform.
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
f
instance-attribute
f = BottleneckTransform(width_in, width_out, stride, norm_layer, activation_layer, group_width, bottleneck_multiplier, se_ratio)
AnyStage
AnyStage(width_in: int, width_out: int, stride: int, depth: int, block_constructor: Callable[..., Module], norm_layer: Callable[..., Module], activation_layer: Callable[..., Module], group_width: int, bottleneck_multiplier: float, se_ratio: Optional[float] = None, stage_index: int = 0)
Bases: Sequential
AnyNet stage (sequence of blocks w/ the same output shape).
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
BlockParams
BlockParams(depths: List[int], widths: List[int], group_widths: List[int], bottleneck_multipliers: List[float], strides: List[int], se_ratio: Optional[float] = None)
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
from_init_params
classmethod
from_init_params(depth: int, w_0: int, w_a: float, w_m: float, group_width: int, bottleneck_multiplier: float = 1.0, se_ratio: Optional[float] = None, **kwargs: Any) -> BlockParams
Programmatically compute all the per-block settings,
given the RegNet parameters.
The first step is to compute the quantized linear block parameters,
in log space. Key parameters are:
- w_a is the width progression slope
- w_0 is the initial width
- w_m is the width stepping in the log space
In other terms
log(block_width) = log(w_0) + w_m * block_capacity,
with bock_capacity ramping up following the w_0 and w_a params.
This block width is finally quantized to multiples of 8.
The second step is to compute the parameters per stage,
taking into account the skip connection and the final 1x1 convolutions.
We use the fact that the output width is constant within a stage.
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
_get_expanded_params
_adjust_widths_groups_compatibilty
staticmethod
_adjust_widths_groups_compatibilty(stage_widths: List[int], bottleneck_ratios: List[float], group_widths: List[int]) -> Tuple[List[int], List[int]]
Adjusts the compatibility of widths and groups, depending on the bottleneck ratio.
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
RegNet
RegNet(block_params: BlockParams, num_classes: int = 1000, stem_width: int = 32, stem_type: Optional[Callable[..., Module]] = None, block_type: Optional[Callable[..., Module]] = None, norm_layer: Optional[Callable[..., Module]] = None, activation: Optional[Callable[..., Module]] = None, in_channels: int = 3)
Bases: Module
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
forward
load_state_dict
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
extend_state_dict_input_channel
extend_state_dict_input_channel(state_dict: Mapping[str, Any], input_weight_key: str, input_conv_layer: Conv2d) -> None
(Multipage) 3채널 이상인 이미지를 사용하기 위해 필요한 기능이며, state_dict의 input conv 채널이 네트워크의 input conv 채널보다 작은 경우 해당 weight의 채널을 늘려줍니다. 현재 네트워크가 가진 input conv 웨이트에서 앞 3 채널을 state_dict의 input conv 웨이트로 치환하는 방식을 사용합니다.
Parameters:
-
state_dict(Mapping[str, Any]) –로드하려는 weight
-
input_weight_key(str) –input conv weight의 이름
-
input_conv_layer(Conv2d) –input conv layer
Source code in SaigeToolkit/model/util.py
_regnet
_regnet(block_params: BlockParams, weights: Optional[WeightsEnum], progress: bool, **kwargs: Any) -> RegNet
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_400mf
regnet_y_400mf(*, weights: Optional[RegNet_Y_400MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_400MF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_400MF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_400MF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_400MF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_800mf
regnet_y_800mf(*, weights: Optional[RegNet_Y_800MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_800MF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_800MF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_800MF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_800MF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_1_6gf
regnet_y_1_6gf(*, weights: Optional[RegNet_Y_1_6GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_1.6GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_1_6GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_1_6GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_1_6GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_3_2gf
regnet_y_3_2gf(*, weights: Optional[RegNet_Y_3_2GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_3.2GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_3_2GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_3_2GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_3_2GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_8gf
regnet_y_8gf(*, weights: Optional[RegNet_Y_8GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_8GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_8GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_8GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_8GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_16gf
regnet_y_16gf(*, weights: Optional[RegNet_Y_16GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_16GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_16GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_16GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_16GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_32gf
regnet_y_32gf(*, weights: Optional[RegNet_Y_32GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_32GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_32GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_32GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_32GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_y_128gf
regnet_y_128gf(*, weights: Optional[RegNet_Y_128GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetY_128GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_Y_128GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_Y_128GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_Y_128GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_400mf
regnet_x_400mf(*, weights: Optional[RegNet_X_400MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_400MF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_400MF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_400MF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_400MF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_800mf
regnet_x_800mf(*, weights: Optional[RegNet_X_800MF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_800MF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_800MF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_800MF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_800MF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_1_6gf
regnet_x_1_6gf(*, weights: Optional[RegNet_X_1_6GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_1.6GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_1_6GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_1_6GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_1_6GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_3_2gf
regnet_x_3_2gf(*, weights: Optional[RegNet_X_3_2GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_3.2GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_3_2GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_3_2GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_3_2GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_8gf
regnet_x_8gf(*, weights: Optional[RegNet_X_8GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_8GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_8GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_8GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_8GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_16gf
regnet_x_16gf(*, weights: Optional[RegNet_X_16GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_16GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_16GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_16GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_16GF_Weights
:members:
Source code in SaigeToolkit/model/backbone/torchvision/regnet.py
regnet_x_32gf
regnet_x_32gf(*, weights: Optional[RegNet_X_32GF_Weights] = None, progress: bool = True, **kwargs: Any) -> RegNet
Constructs a RegNetX_32GF architecture from
Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>.
Args:
weights (:class:~torchvision.models.RegNet_X_32GF_Weights, optional): The pretrained weights to use.
See :class:~torchvision.models.RegNet_X_32GF_Weights below for more details and possible values.
By default, no pretrained weights are used.
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
**kwargs: parameters passed to either torchvision.models.regnet.RegNet or
torchvision.models.regnet.BlockParams class. Please refer to the source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>
for more detail about the classes.
.. autoclass:: torchvision.models.RegNet_X_32GF_Weights
:members: