我有像素数据和标签数据。
np.array([[0, nan, nan],
[1, 2, 1],
[1, 3, 2]])
第一列的意思是:有没有结构?1或0
第二:结构是什么类型的?类型:1,2,3
第三:有多少个结构?
当我们没有一个结构时,所有其他的值都是nan。
因此,对于上面的例子,我们有:
第二行:我们有一个类型2的结构,它是一个
imagenet_weights = './vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5'
base_vgg16 = VGG16(include_top=False, weights=imagenet_weights, input_shape=input_shape)
last_layer = base_vgg16.output
x = Flatten()(last_layer)
x = Dense(512, activation='relu')(x)
x = Dropout(0.3)(x)
preds = Dense(1, activation='sigmoid')(x)
base_vgg16.trainable = False
model_vgg16 = Model(base_vgg16.input, preds)
为了训练我使用了3倍和数据增强。
现在,我想做一个分类,以便找出类型,基于二进制分类结果。
所以,我有:
pred_val = model.predict(X_val)
要用作分类器输入的内容。
X_train = X_train[np.where(pred_val >= 0.5), :]
pred_train = model.predict(X_train)
X_train = X_train[np.where(pred_train.squeeze() >= 0.5), :]
(我不确定预测列车数据是否有意义)
现在,不管我运行第二个网络,我总是收到糟糕的结果。
Val_loss is almost steady around (10-11)
Train_loss is around 10-12
Val_acc is almost steady around (0.25-0.35)
Train_acc is 0.28-0.38
inputs = Input(shape=input_shape)
x = Flatten()(inputs)
x = Dense(512, activation='relu')(x)
x = Dense(256, activation='relu')(x)
preds = Dense(5, activation='softmax')(x)
model = Model(inputs, preds)
无论我尝试了什么组合,或多或少都是单位(我只尝试了一些,比如:
x = Dense(8, activation='relu')(x)
)
或者无论批量大小、优化器和学习率如何,结果都是一样的。