小编Luc*_*fer的帖子

如何从预训练模型中删除最后一层。我尝试过 model.layers.pop() 但它不起作用

我正在尝试删除最后一层,以便我可以使用转移学习。

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)

python keras keras-layer tf.keras

2
推荐指数
1
解决办法
7913
查看次数

pip install -e 选项需要 1 个参数

我按照 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)

python pip flask

1
推荐指数
1
解决办法
4207
查看次数

如何在 google colab 中使用 Blender?

我正在尝试在 Google colab 上实施存储库。它需要安装搅拌机并将其链接到/usr/local/bin/blender.

他们的自述文件说明- (请安装 Blender 2.79。无需从源代码构建,您只需下载预构建的二进制文件并将其链接到/usr/local/bin/blender。)

但我不知道如何在 Google colab 上执行此操作。任何帮助,将不胜感激。

linux blender python-3.x deep-learning google-colaboratory

1
推荐指数
1
解决办法
1159
查看次数