我有这样的模型:
input_img = Input(shape=_shape)
x = Conv2D(num_l, (3, 3), padding='same')(input_img)
x = LeakyReLU(0.1)(x)
x = Conv2D(2 * num_l , (3, 3), padding='same')(x)
x = LeakyReLU(0.1)(x)
x = MaxPooling2D((2, 2))(x)
x = Dropout(0.25)(x)
x = Conv2D(2 * num_l , (3, 3), padding='same')(x)
x = LeakyReLU(0.1)(x)
x = Conv2D(3 * num_l , (3, 3), padding='same')(x)
x = LeakyReLU(0.1)(x)
x = MaxPooling2D((2, 2))(x)
x = Dropout(0.25)(x)
x = Flatten()(x)
x = Dense(num_n)(x)
x = LeakyReLU(0.1)(x)
x = Dropout(0.5)(x)
x = Dense(num_n)(x)
x = LeakyReLU(0.1)(x)
x = Dropout(0.5)(x)
out = Dense(2, activation='softmax', name='table')(x)
model = Model(input_img, out)
model.compile(optimizer='adam', loss= 'categorical_crossentropy')
所以输入在图像上,输出在矢量[0,1]或[1,0]
每批次(32)中,有y([0,1])个样本的一半(16)和y = [1,0]的一半(16)
当我训练模型时,对于第一个epoc来说接缝好,但是在第二个epoc之后,损失变为8.05904769897461并保持不变,...
谁能指出我的错误寻找方向,...
日志
Epoc: 0 -> After 16 images : loss --> 0.7393792271614075
Epoc: 0 -> After 32 images : loss --> 2.964280605316162
Epoc: 0 -> After 48 images : loss --> 3.9417781829833984
....
Epoc: 1 -> After 3520 images : loss --> 0.021433435380458832
Epoc: 1 -> After 3536 images : loss --> 0.0002159792056772858
Epoc: 1 -> After 3552 images : loss --> 1.620501564048027e-07
Epoc: 1 -> After 3568 images : loss --> 0.00011362092482158914
Epoc: 1 -> After 3584 images : loss --> 6.912153912708163e-05
Epoc: 1 -> After 3600 images : loss --> 2.8850188755313866e-05
Epoc: 1 -> After 3616 images : loss --> 1.978150521608768e-06
Epoc: 1 -> After 3632 images : loss --> 0.0013761096633970737
Epoc: 1 -> After 3648 images : loss --> 2.462566590111237e-05
Epoc: 1 -> After 3664 images : loss --> 9.631225111661479e-06
Epoc: 1 -> After 3680 images : loss --> 3.5186160403100075e-06
Epoc: 1 -> After 3696 images : loss --> 1.7695134602035978e-07
Epoc: 1 -> After 3712 images : loss --> 3.3249550597247435e-06
Epoc: 1 -> After 3728 images : loss --> 1.4156105976326216e-07
Epoc: 1 -> After 3744 images : loss --> 2.0861639882241434e-07
Epoc: 1 -> After 3760 images : loss --> 1.4156105976326216e-07
Epoc: 1 -> After 3776 images : loss --> 0.5784698724746704
Epoc: 1 -> After 3792 images : loss --> 4.078485488891602
Epoc: 1 -> After 3808 images : loss --> 0.07696576416492462
Epoc: 1 -> After 3824 images : loss --> 8.05904769897461
Epoc: 1 -> After 3840 images : loss --> 8.05904769897461
Epoc: 1 -> After 3856 images : loss --> 8.05904769897461
Epoc: 1 -> After 3872 images : loss --> 8.05904769897461
Epoc: 1 -> After 3888 images : loss --> 8.05904769897461
Epoc: 1 -> After 3904 images : loss --> 8.05904769897461
...
Epoc: 4 -> After 4032 images : loss --> 8.05904769897461
Epoc: 4 -> After 4048 images : loss --> 8.05904769897461
Epoc: 4 -> After 4064 images : loss --> 8.05904769897461
Epoc: 4 -> After 4080 images : loss --> 8.05904769897461
Epoc: 4 -> After 4096 images : loss --> 8.05904769897461
Epoc: 4 -> After 4112 images : loss --> 8.05904769897461
Epoc: 4 -> After 4128 images : loss --> 8.05904769897461
Epoc: 4 -> After 4144 images : loss --> 8.05904769897461
Epoc: 4 -> After 4160 images : loss --> 8.05904769897461
Epoc: 4 -> After 4176 images : loss --> 8.05904769897461
Epoc: 4 -> After 4192 images : loss --> 8.05904769897461
...
编辑:
我对此的猜测是: 由于某种原因,模型仅产生一个结果[1,0]。这意味着,在32个批次中,其中16个始终都是错误的,这就是为什么相同的数字,但是是什么原因导致此“过拟合”,... 我有相同数量的1和2类,...为什么模型决定只返回一个,...