我使用 unet 進行影像分割我的問題是下面的代碼是什么意思
test_img_norm=test_img[:,:,0][:,:,None]
和
prediction_other = (model.predict(test_img_other_input)[0,:,:,0] > 0.2).astype(np.uint8)
uj5u.com熱心網友回復:
關于第一個問題test_img_norm=test_img[:,:,0][:,:,None], test_img[:,:,0]將復制影像的第test_img[:,:,0][:,:,None]一個通道并為其添加一個通道。例如,如果您有一個帶有 shape 的影像(256, 256, 3),test_img_norm則 shape 將是(256, 256, 1).
關于問題的第二部分,model.predict(test_img_other_input)[0,:,:,0] > 0.2會給你一個布爾陣列。對于 UNet 輸出中的每個元素,如果元素小于 0.2,則輸出為True,否則為False。最后.astype(np.uint8)將布林值設為零或一。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/416630.html
標籤:
上一篇:如何用Keras制作混淆矩陣?
