Python 当用于从高分辨率图像中提取特征时,自动编码器的编码器输出中的大多数条目为零

Python 当用于从高分辨率图像中提取特征时,自动编码器的编码器输出中的大多数条目为零,python,tensorflow,keras,feature-extraction,autoencoder,Python,Tensorflow,Keras,Feature Extraction,Autoencoder,我使用一个简单的自动编码器从高分辨率图像(2K)中提取有意义的特征 我的简单自动编码器如下所示: encoding_dim = 20 encoded = tf.keras.layers.Dense(encode_dim, activation='relu')(input) decoded = tf.keras.layers.Dense(shape_img_flattened[0], activation='sigmoid')(encoded) 型号: autoencoder = tf.kera

我使用一个简单的自动编码器从高分辨率图像(2K)中提取有意义的特征

我的简单自动编码器如下所示:

encoding_dim = 20
encoded = tf.keras.layers.Dense(encode_dim, activation='relu')(input)
decoded = tf.keras.layers.Dense(shape_img_flattened[0], activation='sigmoid')(encoded)
型号:

autoencoder = tf.keras.Model(input, decoded)
encoder = tf.keras.Model(input, encoded)
适合端2端自动编码器型号:

autoencoder.fit(X_train, X_train,epochs = n_epochs,batch_size = batch_size,shuffle = True)
使用此编码_维度或中间隐藏大小,中间表示或编码器输出中的大多数条目为零

(encoder_output = encoder.predict(X_test))

有人能告诉我为什么编码器输出或预测中的大多数条目为零(即不提供任何有意义的功能)?

是的,这是因为您使用Relu作为激活功能。将其更改为LeakyRelu或sigmoid,则它将正常工作。

是的,这是因为您将Relu用作激活功能。将其更改为LeakyRelu或sigmoid,则会正常工作