简体   繁体   中英

Load weights from layers with different names in Keras

My model consists of two different ResNets, and its layers share the same name but with a d_ prefix at the beginning in one of the branches.

Image1----conv1---conv2---(...)
                                   \
                                     Other stuff I don't need the weights
                                   /
Image2----d_conv1---d_conv2---(...)

How do I load the same weights to both ResNet if my weights.h5 file has those weights saved only with the name without prefix?

在Keras中,加载权重时设置by_name = False。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM