tf_ResNeSt_RegNet_model icon indicating copy to clipboard operation
tf_ResNeSt_RegNet_model copied to clipboard

Support for Segmentation

Open digital-idiot opened this issue 3 years ago • 2 comments

It seems that semantic segmentation is not supported, only image classification is supported. When I build a model with input_shape = [256, 256,3] and n_classes = 6, it creates a model with output shape [None,6]. The verbose output is:

stem_out (None, 128, 128, 64)
MaxPool2D out (None, 64, 64, 64)
----- layer 0 out (None, 64, 64, 256) -----
----- layer 1 out (None, 32, 32, 512) -----
----- layer 2 out (None, 16, 16, 1024) -----
----- layer 3 out (None, 8, 8, 2048) -----
pool_out: (None, 2048)
fc_out: (None, 6)
Resnest builded with input (None, 256, 256, 4), output(None, 6)
  • How can I modified it for semantic segmentation?

digital-idiot avatar Feb 04 '21 09:02 digital-idiot

@digital-idiot Hi, sorry for the late reply, if you want a semantic segmentation, then the model output size should same as input size. Semantic segmentation has its own model design, because we usually need deconvolution/resize the features that been convolution from input, like textbook U-net, So the classification model cant directly used for Semantic segmentation. But can be directly used as backbone for object detection, instance segmentation, etc.

qiaoran-dawnlight avatar Apr 20 '21 06:04 qiaoran-dawnlight

For this case specific, if i want to change it to semantic segmentation, the simple way is modified like u-net. just deconvolution it. following is just a general ideal.

usual convolution way ----- layer 0 out (None, 64, 64, 256) ----- ----- layer 1 out (None, 32, 32, 512) ----- ----- layer 2 out (None, 16, 16, 1024) ----- ----- layer 3 out (None, 8, 8, 2048) -----

start deconvolution (can try use similar bock style from convolution) (layer 3 (None, 8, 8, 2048) -> (None, 16, 16, 1024)+ layer 2 out (None, 16, 16, 1024) -> (None, 16, 16, 2048) -> (None, 16, 16, 1024) ----- layer 4 out (None, 16, 16, 1024) ----- ----- layer 5 out (None, 32, 32, 512) ----- ----- layer 6 out (None, 64, 64, 256) ----- ----- layer 7 out (None, 128, 128, 128) ----- ----- layer 8 out (None, 256, 256, 64) ----- fc (None, 256, 256, 6) -----

qiaoran-dawnlight avatar Apr 20 '21 06:04 qiaoran-dawnlight