我使用 FDDB 人脸图片来训练 mtcnn 进行人脸检测。在 pnet 中,对于边界框回归,acc 保持在 60% 左右。有什么不对?
时期 397/400 1200/1200 [===============================] - 0s 131us/样本 - 损失:0.5068 - conv4_1_loss : 5.4316e-06 - conv4_2_loss: 0.5052 - conv4_1_accuracy: 1.0000 - conv4_2_accuracy: 0.5850 Epoch 398/400 1200/1200 [========================= =====] - 0s 131us/样本 - 损失:0.4350 - conv4_1_loss:3.8598e-06 - conv4_2_loss:0.4358 - conv4_1_accuracy:1.0000 - conv4_2_accuracy:0.5950 Epoch 399/400 1200/1200 [====== =====================] - 0s 131us/样本 - 损失:0.8905 - conv4_1_loss:5.0222e-06 - conv4_2_loss:0.8863 - conv4_1_accuracy:1.0000 - conv4_2_accuracy: 0.5817 纪元 400/400 1200/1200 [==============================] - 0s 124us/样本 - 损失:1.8505 - conv4_1_loss:3.0373e-04 - conv4_2_loss:1.8358 - conv4_1_accuracy:1.0000 - conv4_2_accuracy:0.5817
class P_Net(keras.Model):
def __init__(self):
super(P_Net, self).__init__(name="P_Net")
# Define layers here.
self.conv1 = keras.layers.Conv2D(10, (3, 3), name="conv1")
self.prelu1 = keras.layers.PReLU(tf.constant_initializer(0.25), shared_axes=[1, 2], name="prelu1")
self.pool1 = keras.layers.MaxPooling2D((2, 2), name="pool1")
self.conv2 = keras.layers.Conv2D(16, (3, 3), name="conv2")
self.prelu2 = keras.layers.PReLU(tf.constant_initializer(0.25), shared_axes=[1, 2], name="prelu2")
self.conv3 = keras.layers.Conv2D(32, (3, 3), name="conv3")
self.prelu3 = keras.layers.PReLU(tf.constant_initializer(0.25), shared_axes=[1, 2], name="prelu3")
self.cls_output = keras.layers.Conv2D(2, (1, 1), activation="softmax", name="conv4_1")
self.bbox_pred = keras.layers.Conv2D(4, (1, 1), name="conv4_2")
#self.landmark_pred = keras.layers.Conv2D(10, (1, 1), name="conv4_3")
def call(self, inputs):
# Define your forward pass here,
# using layers you previously defined (in `__init__`).
x = self.conv1(inputs)
x = self.prelu1(x)
x = self.pool1(x)
x = self.conv2(x)
x = self.prelu2(x)
x = self.conv3(x)
x = self.prelu3(x)
return [self.cls_output(x), self.bbox_pred(x)]#, self.landmark_pred(x)]
def get_summary(self, input_shape):
inputs = keras.Input(input_shape)
model = keras.Model(inputs, self.call(inputs))
return model
对于边界框 lebal,在 Positive train_set 中,我使用 FDDB 数据提供的可标记 x1,y1 x2,y2,只需根据图片的比例调整它们的大小。这是错的吗?Negative train_set,我设置 box lebal [0,0,0,0]
像这样:['./pos/20020816bigimg_932.jpg', 1, ['0.2857142857142857', '2.2857142857142856', '12.285714285714286', '14.285714285714286']]