有人可以帮助我解决多类语义分割问题。我修改了代码以接受RGB图像和RGB标签作为蒙版。我正在使用以下模型
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
img (InputLayer) (None, 128, 128, 3) 0
__________________________________________________________________________________________________
conv2d_170 (Conv2D) (None, 128, 128, 16) 448 img[0][0]
__________________________________________________________________________________________________
batch_normalization_163 (BatchN (None, 128, 128, 16) 64 conv2d_170[0][0]
__________________________________________________________________________________________________
activation_163 (Activation) (None, 128, 128, 16) 0 batch_normalization_163[0][0]
__________________________________________________________________________________________________
conv2d_171 (Conv2D) (None, 128, 128, 16) 2320 activation_163[0][0]
__________________________________________________________________________________________________
batch_normalization_164 (BatchN (None, 128, 128, 16) 64 conv2d_171[0][0]
__________________________________________________________________________________________________
activation_164 (Activation) (None, 128, 128, 16) 0 batch_normalization_164[0][0]
__________________________________________________________________________________________________
max_pooling2d_37 (MaxPooling2D) (None, 64, 64, 16) 0 activation_164[0][0]
__________________________________________________________________________________________________
dropout_73 (Dropout) (None, 64, 64, 16) 0 max_pooling2d_37[0][0]
__________________________________________________________________________________________________
conv2d_172 (Conv2D) (None, 64, 64, 32) 4640 dropout_73[0][0]
__________________________________________________________________________________________________
batch_normalization_165 (BatchN (None, 64, 64, 32) 128 conv2d_172[0][0]
__________________________________________________________________________________________________
activation_165 (Activation) (None, 64, 64, 32) 0 batch_normalization_165[0][0]
__________________________________________________________________________________________________
conv2d_173 (Conv2D) (None, 64, 64, 32) 9248 activation_165[0][0]
__________________________________________________________________________________________________
batch_normalization_166 (BatchN (None, 64, 64, 32) 128 conv2d_173[0][0]
__________________________________________________________________________________________________
activation_166 (Activation) (None, 64, 64, 32) 0 batch_normalization_166[0][0]
__________________________________________________________________________________________________
max_pooling2d_38 (MaxPooling2D) (None, 32, 32, 32) 0 activation_166[0][0]
__________________________________________________________________________________________________
dropout_74 (Dropout) (None, 32, 32, 32) 0 max_pooling2d_38[0][0]
__________________________________________________________________________________________________
conv2d_174 (Conv2D) (None, 32, 32, 64) 18496 dropout_74[0][0]
__________________________________________________________________________________________________
batch_normalization_167 (BatchN (None, 32, 32, 64) 256 conv2d_174[0][0]
__________________________________________________________________________________________________
activation_167 (Activation) (None, 32, 32, 64) 0 batch_normalization_167[0][0]
__________________________________________________________________________________________________
conv2d_175 (Conv2D) (None, 32, 32, 64) 36928 activation_167[0][0]
__________________________________________________________________________________________________
batch_normalization_168 (BatchN (None, 32, 32, 64) 256 conv2d_175[0][0]
__________________________________________________________________________________________________
activation_168 (Activation) (None, 32, 32, 64) 0 batch_normalization_168[0][0]
__________________________________________________________________________________________________
max_pooling2d_39 (MaxPooling2D) (None, 16, 16, 64) 0 activation_168[0][0]
__________________________________________________________________________________________________
dropout_75 (Dropout) (None, 16, 16, 64) 0 max_pooling2d_39[0][0]
__________________________________________________________________________________________________
conv2d_176 (Conv2D) (None, 16, 16, 128) 73856 dropout_75[0][0]
__________________________________________________________________________________________________
batch_normalization_169 (BatchN (None, 16, 16, 128) 512 conv2d_176[0][0]
__________________________________________________________________________________________________
activation_169 (Activation) (None, 16, 16, 128) 0 batch_normalization_169[0][0]
__________________________________________________________________________________________________
conv2d_177 (Conv2D) (None, 16, 16, 128) 147584 activation_169[0][0]
__________________________________________________________________________________________________
batch_normalization_170 (BatchN (None, 16, 16, 128) 512 conv2d_177[0][0]
__________________________________________________________________________________________________
activation_170 (Activation) (None, 16, 16, 128) 0 batch_normalization_170[0][0]
__________________________________________________________________________________________________
max_pooling2d_40 (MaxPooling2D) (None, 8, 8, 128) 0 activation_170[0][0]
__________________________________________________________________________________________________
dropout_76 (Dropout) (None, 8, 8, 128) 0 max_pooling2d_40[0][0]
__________________________________________________________________________________________________
conv2d_178 (Conv2D) (None, 8, 8, 256) 295168 dropout_76[0][0]
__________________________________________________________________________________________________
batch_normalization_171 (BatchN (None, 8, 8, 256) 1024 conv2d_178[0][0]
__________________________________________________________________________________________________
activation_171 (Activation) (None, 8, 8, 256) 0 batch_normalization_171[0][0]
__________________________________________________________________________________________________
conv2d_179 (Conv2D) (None, 8, 8, 256) 590080 activation_171[0][0]
__________________________________________________________________________________________________
batch_normalization_172 (BatchN (None, 8, 8, 256) 1024 conv2d_179[0][0]
__________________________________________________________________________________________________
activation_172 (Activation) (None, 8, 8, 256) 0 batch_normalization_172[0][0]
__________________________________________________________________________________________________
conv2d_transpose_37 (Conv2DTran (None, 16, 16, 128) 295040 activation_172[0][0]
__________________________________________________________________________________________________
concatenate_37 (Concatenate) (None, 16, 16, 256) 0 conv2d_transpose_37[0][0]
activation_170[0][0]
__________________________________________________________________________________________________
dropout_77 (Dropout) (None, 16, 16, 256) 0 concatenate_37[0][0]
__________________________________________________________________________________________________
conv2d_180 (Conv2D) (None, 16, 16, 128) 295040 dropout_77[0][0]
__________________________________________________________________________________________________
batch_normalization_173 (BatchN (None, 16, 16, 128) 512 conv2d_180[0][0]
__________________________________________________________________________________________________
activation_173 (Activation) (None, 16, 16, 128) 0 batch_normalization_173[0][0]
__________________________________________________________________________________________________
conv2d_181 (Conv2D) (None, 16, 16, 128) 147584 activation_173[0][0]
__________________________________________________________________________________________________
batch_normalization_174 (BatchN (None, 16, 16, 128) 512 conv2d_181[0][0]
__________________________________________________________________________________________________
activation_174 (Activation) (None, 16, 16, 128) 0 batch_normalization_174[0][0]
__________________________________________________________________________________________________
conv2d_transpose_38 (Conv2DTran (None, 32, 32, 64) 73792 activation_174[0][0]
__________________________________________________________________________________________________
concatenate_38 (Concatenate) (None, 32, 32, 128) 0 conv2d_transpose_38[0][0]
activation_168[0][0]
__________________________________________________________________________________________________
dropout_78 (Dropout) (None, 32, 32, 128) 0 concatenate_38[0][0]
__________________________________________________________________________________________________
conv2d_182 (Conv2D) (None, 32, 32, 64) 73792 dropout_78[0][0]
__________________________________________________________________________________________________
batch_normalization_175 (BatchN (None, 32, 32, 64) 256 conv2d_182[0][0]
__________________________________________________________________________________________________
activation_175 (Activation) (None, 32, 32, 64) 0 batch_normalization_175[0][0]
__________________________________________________________________________________________________
conv2d_183 (Conv2D) (None, 32, 32, 64) 36928 activation_175[0][0]
__________________________________________________________________________________________________
batch_normalization_176 (BatchN (None, 32, 32, 64) 256 conv2d_183[0][0]
__________________________________________________________________________________________________
activation_176 (Activation) (None, 32, 32, 64) 0 batch_normalization_176[0][0]
__________________________________________________________________________________________________
conv2d_transpose_39 (Conv2DTran (None, 64, 64, 32) 18464 activation_176[0][0]
__________________________________________________________________________________________________
concatenate_39 (Concatenate) (None, 64, 64, 64) 0 conv2d_transpose_39[0][0]
activation_166[0][0]
__________________________________________________________________________________________________
dropout_79 (Dropout) (None, 64, 64, 64) 0 concatenate_39[0][0]
__________________________________________________________________________________________________
conv2d_184 (Conv2D) (None, 64, 64, 32) 18464 dropout_79[0][0]
__________________________________________________________________________________________________
batch_normalization_177 (BatchN (None, 64, 64, 32) 128 conv2d_184[0][0]
__________________________________________________________________________________________________
activation_177 (Activation) (None, 64, 64, 32) 0 batch_normalization_177[0][0]
__________________________________________________________________________________________________
conv2d_185 (Conv2D) (None, 64, 64, 32) 9248 activation_177[0][0]
__________________________________________________________________________________________________
batch_normalization_178 (BatchN (None, 64, 64, 32) 128 conv2d_185[0][0]
__________________________________________________________________________________________________
activation_178 (Activation) (None, 64, 64, 32) 0 batch_normalization_178[0][0]
__________________________________________________________________________________________________
conv2d_transpose_40 (Conv2DTran (None, 128, 128, 16) 4624 activation_178[0][0]
__________________________________________________________________________________________________
concatenate_40 (Concatenate) (None, 128, 128, 32) 0 conv2d_transpose_40[0][0]
activation_164[0][0]
__________________________________________________________________________________________________
dropout_80 (Dropout) (None, 128, 128, 32) 0 concatenate_40[0][0]
__________________________________________________________________________________________________
conv2d_186 (Conv2D) (None, 128, 128, 16) 4624 dropout_80[0][0]
__________________________________________________________________________________________________
batch_normalization_179 (BatchN (None, 128, 128, 16) 64 conv2d_186[0][0]
__________________________________________________________________________________________________
activation_179 (Activation) (None, 128, 128, 16) 0 batch_normalization_179[0][0]
__________________________________________________________________________________________________
conv2d_187 (Conv2D) (None, 128, 128, 16) 2320 activation_179[0][0]
__________________________________________________________________________________________________
batch_normalization_180 (BatchN (None, 128, 128, 16) 64 conv2d_187[0][0]
__________________________________________________________________________________________________
activation_180 (Activation) (None, 128, 128, 16) 0 batch_normalization_180[0][0]
__________________________________________________________________________________________________
conv2d_188 (Conv2D) (None, 128, 128, 1) 17 activation_180[0][0]
==================================================================================================
Total params: 2,164,593
Trainable params: 2,161,649
Non-trainable params: 2,944
__________________________________________________________________________________________________
您可以看到输入有3个通道。最后一层应该有11个通道中的1个吗?我使用的数据集有11个类别,在图像中用不同的RGB值组合表示。.
谢谢。
答案 0 :(得分:0)
最后一层应该是11个通道,与每个像素位置的11个类相对应。就像对每个像素位置进行多类别分类一样。