akirasosa / mobile-semantic-segmentation

Real-Time Semantic Segmentation in Mobile device
MIT License
715 stars 135 forks source link

output size of the converted model is wrong #44

Closed roeiherz closed 4 years ago

roeiherz commented 5 years ago

Hi, I tried your coreml_converter.py script and the output layer (identifier 597) is: tensor_type { elem_type: FLOAT shape { dim { dim_value: 1 } dim { dim_value: 3 } dim { dim_value: 224 } dim { dim_value: 224 }

The identifier is 597 and not 595 as you told because I used your interpolate layer (was in # in your original code): x = interpolate(x, scale_factor=2, mode='bilinear', align_corners=False)

Now, I have two questions: (1) why the output is 3x224x224 and not 1x224x224 ? (2) the interpolate layer is getting error when I am trying to convert. Is there another way to upload from 112x112 to 224x224?

Thanks.

hugoliv commented 5 years ago

Hello,

I used Netron to explore the graph, I didn't connect the interpolate layer. The input_id is 0 and ouput_id is 590 but the shape is 1x112x112 and not 1x224x224.

Capture d’écran 2019-03-28 à 11 45 04
akirasosa commented 4 years ago

About 1. It's because iOS app requires 3 channels. So, I do it in model. It's also possible for you to write code in iOS which converts single channel to 3.

About 2, I don't have it in current code. It's not so difficult to show mask as twice large size in iOS.