@@ -326,9 +326,10 @@ def make_blocks(
326326 down_kernel_size : int = 1 ,
327327 avg_down : bool = False ,
328328 drop_block_rate : float = 0. ,
329- drop_path_rate : float = 0. ,
330- drop_block_batchwise : bool = False ,
329+ drop_block_batchwise : bool = True ,
330+ drop_block_couple_channels : bool = False ,
331331 drop_block_partial_edge_blocks : bool = True ,
332+ drop_path_rate : float = 0. ,
332333 ** kwargs ,
333334) -> Tuple [List [Tuple [str , nn .Module ]], List [Dict [str , Any ]]]:
334335 """Create ResNet stages with specified block configurations.
@@ -343,8 +344,10 @@ def make_blocks(
343344 down_kernel_size: Kernel size for downsample layers.
344345 avg_down: Use average pooling for downsample.
345346 drop_block_rate: DropBlock drop rate.
346- drop_block_batchwise: Batchwise block dropping, faster.
347- drop_block_partial_edge_blocks: dropping produces partial blocks on the edge, faster.
347+ drop_block_batchwise: Batchwise block dropping, much faster.
348+ drop_block_couple_channels: Couple channel drops.
349+ drop_block_partial_edge_blocks: Permit partial drop blocks on the edge,
350+ slightly faster.
348351 drop_path_rate: Drop path rate for stochastic depth.
349352 **kwargs: Additional arguments passed to block constructors.
350353
@@ -364,6 +367,7 @@ def make_blocks(
364367 drop_blocks (
365368 drop_prob = drop_block_rate ,
366369 batchwise = drop_block_batchwise ,
370+ couple_channels = drop_block_couple_channels ,
367371 partial_edge_blocks = drop_block_partial_edge_blocks ,
368372 ))):
369373 stage_name = f'layer{ stage_idx + 1 } ' # never liked this name, but weight compat requires it
@@ -465,10 +469,11 @@ def __init__(
465469 norm_layer : LayerType = nn .BatchNorm2d ,
466470 aa_layer : Optional [Type [nn .Module ]] = None ,
467471 drop_rate : float = 0.0 ,
468- drop_path_rate : float = 0. ,
469472 drop_block_rate : float = 0. ,
470473 drop_block_batchwise : bool = True ,
474+ drop_block_couple_channels : bool = False ,
471475 drop_block_partial_edge_blocks : bool = True ,
476+ drop_path_rate : float = 0. ,
472477 zero_init_last : bool = True ,
473478 block_args : Optional [Dict [str , Any ]] = None ,
474479 ):
@@ -497,10 +502,11 @@ def __init__(
497502 norm_layer (str, nn.Module): normalization layer
498503 aa_layer (nn.Module): anti-aliasing layer
499504 drop_rate (float): Dropout probability before classifier, for training (default 0.)
500- drop_path_rate (float): Stochastic depth drop-path rate (default 0.)
501505 drop_block_rate (float): Drop block rate (default 0.)
502- drop_block_batchwise (bool): Sample blocks batchwise, faster.
506+ drop_block_batchwise (bool): Sample blocks batchwise, significantly faster.
507+ drop_block_couple_channels (bool): couple channels when dropping blocks.
503508 drop_block_partial_edge_blocks (bool): Partial block dropping at the edges, faster.
509+ drop_path_rate (float): Stochastic depth drop-path rate (default 0.)
504510 zero_init_last (bool): zero-init the last weight in residual path (usually last BN affine weight)
505511 block_args (dict): Extra kwargs to pass through to block module
506512 """
@@ -572,6 +578,7 @@ def __init__(
572578 aa_layer = aa_layer ,
573579 drop_block_rate = drop_block_rate ,
574580 drop_block_batchwise = drop_block_batchwise ,
581+ drop_block_couple_channels = drop_block_couple_channels ,
575582 drop_block_partial_edge_blocks = drop_block_partial_edge_blocks ,
576583 drop_path_rate = drop_path_rate ,
577584 ** block_args ,
@@ -1459,8 +1466,8 @@ def resnet10t(pretrained: bool = False, **kwargs) -> ResNet:
14591466 return _create_resnet ('resnet10t' , pretrained , ** dict (model_args , ** kwargs ))
14601467
14611468@register_model
1462- def resnet10t_dropblock_correct (pretrained : bool = False , ** kwargs ) -> ResNet :
1463- """Constructs a ResNet-10-T model with drop_block_rate=0.05, using the most accurate DropBlock2d features.
1469+ def resnet10t_dropblock_slow (pretrained : bool = False , ** kwargs ) -> ResNet :
1470+ """Constructs a ResNet-10-T model with drop_block_rate=0.05, using the slowest DropBlock2d features.
14641471 """
14651472 model_args = dict (
14661473 block = BasicBlock ,
@@ -1469,7 +1476,8 @@ def resnet10t_dropblock_correct(pretrained: bool = False, **kwargs) -> ResNet:
14691476 stem_type = 'deep_tiered' ,
14701477 avg_down = True ,
14711478 drop_block_rate = 0.05 ,
1472- drop_block_batchwise = True ,
1479+ drop_block_batchwise = False ,
1480+ drop_block_couple_channels = False ,
14731481 drop_block_partial_edge_blocks = True ,
14741482 )
14751483 return _create_resnet ('resnet10t' , pretrained , ** dict (model_args , ** kwargs ))
@@ -1485,7 +1493,8 @@ def resnet10t_dropblock_fast(pretrained: bool = False, **kwargs) -> ResNet:
14851493 stem_type = 'deep_tiered' ,
14861494 avg_down = True ,
14871495 drop_block_rate = 0.05 ,
1488- drop_block_batchwise = False ,
1496+ drop_block_batchwise = True ,
1497+ drop_block_couple_channels = True ,
14891498 drop_block_partial_edge_blocks = False ,
14901499 )
14911500 return _create_resnet ('resnet10t' , pretrained , ** dict (model_args , ** kwargs ))
0 commit comments