使用本地预训练模型迁移学习

from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, Flatten, GlobalAveragePooling2D
import tensorflow as  tf
num_classes = 2
resnet_weights_path = './resnet101_weights_tf_dim_ordering_tf_kernels.h5'

my_new_model = Sequential()
my_new_model.add(tf.keras.applications.resnet.ResNet101( weights=resnet_weights_path))
my_new_model.add(Dense(num_classes, activation='softmax'))

# Say not to train first layer (ResNet) model. It is already trained


发布了60 篇原创文章 · 获赞 15 · 访问量 4047

猜你喜欢

转载自blog.csdn.net/qq_15557299/article/details/104378840