我正在尝试删除最后一层,以便我可以使用转移学习。
vgg16_model = keras.applications.vgg16.VGG16()
model = Sequential()
for layer in vgg16_model.layers:
model.add(layer)
model.layers.pop()
# Freeze the layers
for layer in model.layers:
layer.trainable = False
# Add 'softmax' instead of earlier 'prediction' layer.
model.add(Dense(2, activation='softmax'))
# Check the summary, and yes new layer has been added.
model.summary()
Run Code Online (Sandbox Code Playgroud)
但我得到的输出并不是我所期望的。仍然显示的是vgg16模型的最后一层。
这是输出
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
block1_conv1 (Conv2D) (None, 224, 224, 64) 1792
_________________________________________________________________
block1_conv2 (Conv2D) (None, 224, 224, 64) 36928
**THE HIDDEN LAYERS**
_________________________________________________________________
fc1 (Dense) (None, 4096) 102764544 …Run Code Online (Sandbox Code Playgroud) 我按照 Flask 的官方教程进行操作,并在“使项目可安装”步骤中出现错误。当我运行时pip install -e,出现以下错误:
Usage:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [options] -r <requirements file> [package-index-options] ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
-e option requires 1 argument
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Google colab 上实施此存储库。它需要安装搅拌机并将其链接到/usr/local/bin/blender.
他们的自述文件说明- (请安装 Blender 2.79。无需从源代码构建,您只需下载预构建的二进制文件并将其链接到/usr/local/bin/blender。)
但我不知道如何在 Google colab 上执行此操作。任何帮助,将不胜感激。
python ×2
blender ×1
flask ×1
keras ×1
keras-layer ×1
linux ×1
pip ×1
python-3.x ×1
tf.keras ×1