CNN回归预测每个测试图像的值相同。

时间:2017-11-23 00:36:01

标签: deep-learning keras conv-neural-network convolution

所以我只想解决一下我要解决的问题。我有大约200k 64x64x3 RGB图像的机器人开过来的地形补丁。每个补丁都有一个相应的标签,表示该图像补丁的粗糙度。粗糙度值范围为0-160。在机器人以不同的速度驱动时收集数据,因此粗糙度值的范围。我的目标是能够预测贴片的粗糙度。我正在使用VGG-16网络,最后一层被修改为进行回归。我的批量大小是1024,损失是平均sqaured错误,优化是rmsprop。网络如下所示。我的问题是,在训练之后,网络预测每个测试图像的完全相同的值。另一点需要注意的是,训练损失总是高于奇数的验证损失。最后,我尝试了其他优化器,如SGD和Adam,以及不同的批量大小。现在我正在尝试从头开始训练网络,但这似乎不太有希望。我不确定这里出了什么问题,我真的很感激我能得到的任何帮助。感谢

 if input_tensor is None:
    img_input = Input(shape=input_shape)
else:
    if not K.is_keras_tensor(input_tensor):
        img_input = Input(tensor=input_tensor, shape=input_shape)
    else:
        img_input = input_tensor
# Block 1
x = Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv1')(img_input)
x = Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv2')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='block1_pool')(x)

# Block 2
x = Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv1')(x)
x = Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv2')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='block2_pool')(x)

# Block 3
x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv1')(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv2')(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='block3_pool')(x)

# Block 4
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv1')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv2')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool')(x)

# Block 5
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv1')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv2')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2), name='block5_pool')(x)

x = Flatten(name='flatten')(x)
x = Dense(4096, activation='relu', name='fc1')(x)
x = Dense(4096, activation='relu', name='fc2')(x)
x = Dense(1,name='regression_dense')(x) 

1 个答案:

答案 0 :(得分:0)

根据您的解释,您的粗糙度值范围为0到160.将这些值归一化为[-1,1]。您可以坚持最后一层的线性激活功能。 但总的来说,我认为你只需要一小部分参数就能用更浅的架构来解决这个问题。

干杯