不同我层 ResNet50 和原始 ResNet50 的名称

Posted

技术标签:

【中文标题】不同我层 ResNet50 和原始 ResNet50 的名称【英文标题】:Different my name of layer ResNet50 and original ResNet50 【发布时间】:2021-08-29 10:39:11 【问题描述】:

我运行此代码以将预训练的 ResNet50 与 ImageNet 一起使用:

from keras.applications import ResNet50
conv_base = ResNet50()
print(conv_base.summary())

但是,每一层的名称与原来的ResNet50(互联网访问)不同。


例如:


我的结果:(不正确)

activation_95 (Activation)      (None, None, None, 5 0           bn5c_branch2a[0][0]              
__________________________________________________________________________________________________
res5c_branch2b (Conv2D)         (None, None, None, 5 2359808     activation_95[0][0]              
__________________________________________________________________________________________________
bn5c_branch2b (BatchNormalizati (None, None, None, 5 2048        res5c_branch2b[0][0]             
__________________________________________________________________________________________________
activation_96 (Activation)      (None, None, None, 5 0           bn5c_branch2b[0][0]              
__________________________________________________________________________________________________
res5c_branch2c (Conv2D)         (None, None, None, 2 1050624     activation_96[0][0]              
__________________________________________________________________________________________________
bn5c_branch2c (BatchNormalizati (None, None, None, 2 8192        res5c_branch2c[0][0] 

原始结果:(正确)

conv5_block3_1_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block3_1_conv[0][0]        
__________________________________________________________________________________________________
conv5_block3_1_relu (Activation (None, 7, 7, 512)    0           conv5_block3_1_bn[0][0]          
__________________________________________________________________________________________________
conv5_block3_2_conv (Conv2D)    (None, 7, 7, 512)    2359808     conv5_block3_1_relu[0][0]        
__________________________________________________________________________________________________
conv5_block3_2_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block3_2_conv[0][0]        
__________________________________________________________________________________________________
conv5_block3_2_relu (Activation (None, 7, 7, 512)    0           conv5_block3_2_bn[0][0]          
__________________________________________________________________________________________________
conv5_block3_3_conv (Conv2D)    (None, 7, 7, 2048)   1050624     conv5_block3_2_relu[0][0]        
__________________________________________________________________________________________________
conv5_block3_3_bn (BatchNormali (None, 7, 7, 2048)   8192        conv5_block3_3_conv[0][0]        
__________________________________________________________________________________________________
conv5_block3_add (Add)          (None, 7, 7, 2048)   0           conv5_block2_out[0][0]           
                                                                 conv5_block3_3_bn[0][0]          
__________________________________________________________________________________________________
conv5_block3_out (Activation)   (None, 7, 7, 2048)   0           conv5_block3_add[0][0]    

安装不同版本的python但不正确!

请帮帮我。

【问题讨论】:

您的导入应该会导致错误。因为 keras.apllications 模块上不存在 ResNet50 类。!!无论如何尝试from tensorflow.keras.applications import ResNet50 【参考方案1】:

我做了这一步,它更正了:

    卸载 anacoda-navigator。 卸载所有版本的python。 从 python 网站下载并安装 python 3.7.0。 使用 Pip 安装包。 安装 Cudatoolkit 和 Cudnn (Help) 将路径添加到环境变量(Help)

非常感谢。

【讨论】:

以上是关于不同我层 ResNet50 和原始 ResNet50 的名称的主要内容,如果未能解决你的问题,请参考以下文章

resnet18和resnet101的区别

当使用 OpenCV 完成图像加载和调整大小时,Resnet50 会产生不同的预测

Pytorch构建ResNet-50V2

使用 Resnet 的图像生成器

ResNet50 模型总是预测 1 类

LeNet5、AlexNet、VGG-16、GoogLeNet、ResNet50原理及其结构