bitorch.models.densenet.basedensenet_constructor¶
- bitorch.models.densenet.basedensenet_constructor(spec: dict, model: Type[BaseNetDense], num_layers: Optional[Union[int, str]], num_init_features: int, growth_rate: int, bn_size: int, dropout: float, dilated: bool, flex_block_config: Optional[List[int]], classes: int = 1000, image_resolution: Optional[List[int]] = None, image_channels: int = 3) Module [source]¶
Creates a densenet of the given model type with given layer numbers.
- Parameters:
spec (dict) – specification that holds block config, reduction factors and downsample layer names
model (Type[BaseNetDense]) – the model to instantiate.
num_layers (int) – number of layers to be build.
num_init_features (int, optional) – number of initial features.
growth_rate (int, optional) – growth rate of the channels.
bn_size (int, optional) – size of the bottleneck.
dropout (float, optional) – dropout percentage in dense layers.
dilated (bool, optional) – whether to use dilation in convolutions.
flex_block_config (List[int], optional) –
classes (int, optional) – number of output classes. Defaults to 1000.
image_resolution (List[int], optional) – determines set of initial layers to be used. Defaults to None.
image_channels (int, optional) – number of channels of input images. Defaults to 3.
- Raises:
ValueError – raised if no specification for given num_layers is listed in the given spec dict, block config is not given as a list of ints, number of reductions is incorrect
- Returns:
instance of model
- Return type:
Module