[英]what is the correct way to reshape image segmentation model output from 2D (num of classes, num of pixels) to 3D channel last images
我正在使用keras和python進行衛星圖像分割。 據我了解,要獲得圖像分割的(像素級)預測,模型會將尺寸(-1,num_classes,height,width)的圖層重塑為(-1,num_classes,height * width)的形狀,然后再應用激活功能,例如softmax或Sigmoid。 我的問題是在此步驟后以通道優先或通道末尾的格式恢復圖像? 示例代碼
o = (Reshape(( num_classes , outputHeight*outputWidth)))(o)
o = (Permute((2, 1)))(o)
o = (Activation('softmax'))(o)
我試圖在最后添加以下圖層到模型
o = (Reshape((outputHeight, outputWidth, num_classes)))(o)
這個對嗎? 這會以與原始順序相同的順序重新定向圖像像素嗎? 另一種選擇是在單個圖像上使用以下代碼。
array.reshape(height, width, num_classes)
我應該使用哪種方法來獲得像素級分割結果?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.