最近我转移到 tensorflow==2.0.0-rc0,现在用于人脸检测的 mtcnn 在我的电脑上不起作用。我能找到 tensorflow==2.0.0-rc0 版本的 mtcnn 吗?mtcnn 的纯 Keras 实现也适用于这种情况。
我已经在https://github.com/nyoki-mtl/keras-facenet尝试了 facenet 的 keras 实现。它在 kears 中很好地实现了 facenet,但缺少人脸检测部分(keras 中的 mtcnn)。
我在 Pyhotn 3 和 TF 2.0 中收到以下错误。
“ValueError:您尝试在数字上调用 count_params,但未构建该层。您可以通过以下方式手动构建它:digits.build(batch_input_shape)。” 在 new_model.summary() 行。
问题是什么以及如何解决?
inputs = keras.Input(shape=(784,), name='digits')
x = layers.Dense(64, activation='relu', name='dense_1')(inputs)
x = layers.Dense(64, activation='relu', name='dense_2')(x)
outputs = layers.Dense(10, activation='softmax', name='predictions')(x)
model = keras.Model(inputs=inputs, outputs=outputs, name='3_layer_mlp')
model.summary()
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
x_train = x_train.reshape(60000, 784).astype('float32') / 255
x_test = x_test.reshape(10000, 784).astype('float32') / 255
model.compile(loss='sparse_categorical_crossentropy',
optimizer=keras.optimizers.RMSprop(),
metrics=['accuracy'])
history = model.fit(x_train, y_train,
batch_size=64,
epochs=2)
model.save('saved_model', save_format='tf')
new_model = keras.models.load_model('saved_model')
new_model.summary()
Run Code Online (Sandbox Code Playgroud) 我可以使用以下代码从我的 PC 上运行的 python 代码成功访问 google 云存储桶。
client = storage.Client()
bucket = client.get_bucket('bucket-name')
blob = bucket.get_blob('images/test.png')
Run Code Online (Sandbox Code Playgroud)
现在我不知道如何在不写入硬盘驱动器上的文件的情况下从“blob”检索和显示图像?