我正在为输出长度为9的3D旋转估计任务尝试微调VGG-16 CNN,但是每次我重新训练网络时,输出的不同元素都将预测为0。
为了解决这个问题,我已经在带有单个标签的单个图像上训练了网络,但无济于事;每次尝试重新训练时,只能准确预测4至7个随机元素。
这是模型架构
void*
和我的训练设置
enum class
所以,如果我尝试使用虚拟标签
base_model = VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
x = MaxPooling2D()((base_model.layers[-1].output))
x = Flatten()(x)
x = Dense(4096, activation='relu')(x)
x = Dense(9, activation='relu')(x)
self.rotation_model = keras.Model(base_model.input, self.rotation_model.compile
(optimizer=keras.optimizers.adam(lr=1e-5), loss='mse')
我得到这些结果,每一行都经过重新拟合后得到结果。
self.rotation_model.fit(x = images, y = image_labels,
shuffle = True, batch_size = 16, validation_split=0.2, epochs = 1)
我假设随机行为是由Dense层的随机初始化权重引起的,但是如何防止这种情况发生?