update PP-HGNetV2 (#2993)

pull/2952/merge
cuicheng01 2023-10-07 16:45:16 +08:00 committed by GitHub
parent 203eba4d6d
commit e9a59678f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 33 deletions

View File

@ -41,7 +41,7 @@ PP-HGNetV2 在 PP-HGNet 上的具体改进点如下:
- 改进了 PPHGNet 网络 stem 部分,堆叠更多的 2x2 卷积核以学习更丰富的局部特征,使用更小的通道数以提升大分辨率任务如目标检测、语义分割等的推理速度;
- 替换了 PP-HGNet 中靠后 stage 的较冗余的标准卷积层为 PW + DW5x5 组合,在获得更大感受野的同时网络的参数量更少,且精度可以进一步提升;
- 增加了 LearnableAffineBlock 模块,其可以在增加极少参数量的同时大幅提升较小模型的精度,且对推理时间无损;
- 重构了 PP-HGNet 网络的 stage 分布,使其涵盖了从 B0-B7 不同量级的模型,从而满足不同任务的需求。
- 重构了 PP-HGNet 网络的 stage 分布,使其涵盖了从 B0-B6 不同量级的模型,从而满足不同任务的需求。
除以上改进点之外,相比 PaddleClas 提供的其他模型PP-HGNetV2 默认提供了精度更高、泛化能力更强的 [SSLD](https://arxiv.org/abs/2103.05959) 预训练权重,其在下游任务中表现更佳。
@ -60,8 +60,6 @@ PP-HGNetV2 的精度、速度指标、预训练权重、推理模型权重链接
| PPHGNetV2_B4 | 83.57 | 96.72 | 1.46 |[下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B4_ssld_stage1_pretrained.pdparams)| [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B4_ssld_pretrained.pdparams) | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPHGNetV2_B4_ssld_infer.tar) |
| PPHGNetV2_B5 | 84.75 | 97.32 | 2.84 |[下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B5_ssld_stage1_pretrained.pdparams)| [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B5_ssld_pretrained.pdparams) | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPHGNetV2_B5_ssld_infer.tar) |
| PPHGNetV2_B6 | 86.30 | 97.84 | 5.29 |[下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B6_ssld_stage1_pretrained.pdparams)| [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B6_ssld_pretrained.pdparams) | [下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPHGNetV2_B6_ssld_infer.tar) |
| PPHGNetV2_B7 | comming soon | comming soon | 11.06 |comming soon| comming soon | comming soon |
**备注:**

View File

@ -25,7 +25,7 @@ from .legendary_models.pp_lcnet import PPLCNet_x0_25, PPLCNet_x0_35, PPLCNet_x0_
from .legendary_models.pp_lcnet_v2 import PPLCNetV2_small, PPLCNetV2_base, PPLCNetV2_large
from .legendary_models.esnet import ESNet_x0_25, ESNet_x0_5, ESNet_x0_75, ESNet_x1_0
from .legendary_models.pp_hgnet import PPHGNet_tiny, PPHGNet_small, PPHGNet_base
from .legendary_models.pp_hgnet_v2 import PPHGNetV2_B0, PPHGNetV2_B1, PPHGNetV2_B2, PPHGNetV2_B3, PPHGNetV2_B4, PPHGNetV2_B5, PPHGNetV2_B6, PPHGNetV2_B7
from .legendary_models.pp_hgnet_v2 import PPHGNetV2_B0, PPHGNetV2_B1, PPHGNetV2_B2, PPHGNetV2_B3, PPHGNetV2_B4, PPHGNetV2_B5, PPHGNetV2_B6
from .model_zoo.resnet_vc import ResNet50_vc
from .model_zoo.resnext import ResNeXt50_32x4d, ResNeXt50_64x4d, ResNeXt101_32x4d, ResNeXt101_64x4d, ResNeXt152_32x4d, ResNeXt152_64x4d

View File

@ -38,8 +38,6 @@ MODEL_URLS = {
"https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B5_ssld_pretrained.pdparams",
"PPHGNetV2_B6":
"https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B6_ssld_pretrained.pdparams",
"PPHGNetV2_B7":
"https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/legendary_models/PPHGNetV2_B7_ssld_pretrained.pdparams",
}
__all__ = list(MODEL_URLS.keys())
@ -702,30 +700,3 @@ def PPHGNetV2_B6(pretrained=False, use_ssld=False, **kwargs):
**kwargs)
_load_pretrained(pretrained, model, MODEL_URLS["PPHGNetV2_B6"], use_ssld)
return model
def PPHGNetV2_B7(pretrained=False, use_ssld=False, **kwargs):
"""
PPHGNetV2_B7
Args:
pretrained (bool/str): If `True` load pretrained parameters, `False` otherwise.
If str, means the path of the pretrained model.
use_ssld (bool) Whether using ssld pretrained model when pretrained is True.
Returns:
model: nn.Layer. Specific `PPHGNetV2_B7` model depends on args.
"""
stage_config = {
# in_channels, mid_channels, out_channels, num_blocks, is_downsample, light_block, kernel_size, layer_num
"stage1": [128, 128, 256, 2, False, False, 3, 7],
"stage2": [256, 256, 512, 4, True, False, 3, 7],
"stage3": [512, 512, 1024, 12, True, True, 5, 7],
"stage4": [1024, 1024, 2048, 4, True, True, 5, 7],
}
model = PPHGNetV2(
stem_channels=[3, 64, 128],
stage_config=stage_config,
use_lab=False,
**kwargs)
_load_pretrained(pretrained, model, MODEL_URLS["PPHGNetV2_B7"], use_ssld)
return model