使用ResNet50预训练的权重我正在尝试构建一个分类器.代码库完全在Keras高级Tensorflow API中实现.完整的代码发布在下面的 GitHub链接中.
源代码:Classification Using RestNet50 Architecture
预训练模型的文件大小为94.7mb.
我加载了预先训练好的文件
new_model = Sequential()
new_model.add(ResNet50(include_top=False,
pooling='avg',
weights=resnet_weight_paths))
并适合模型
train_generator = data_generator.flow_from_directory(
'path_to_the_training_set',
target_size = (IMG_SIZE,IMG_SIZE),
batch_size = 12,
class_mode = 'categorical'
)
validation_generator = data_generator.flow_from_directory(
'path_to_the_validation_set',
target_size = (IMG_SIZE,IMG_SIZE),
class_mode = 'categorical'
)
#compile the model
new_model.fit_generator(
train_generator,
steps_per