qubvel / segmentation_models

Segmentation models with pretrained backbones. Keras and TensorFlow Keras.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to apply inferred mask to image

simonmelouah opened this issue · comments

Following along with the multiclass segmentation example, the model performs fairly well on a custom dataset however when I try to use the mask on the original image using OpenCV's bitwise_and function I get

error: OpenCV(4.8.0) [/Users/runner/work/opencv-python/opencv-python/opencv/modules/core/src/arithm.cpp:230](https://file+.vscode-resource.vscode-cdn.net/Users/runner/work/opencv-python/opencv-python/opencv/modules/core/src/arithm.cpp:230): error: (-215:Assertion failed) (mtype == CV_8U || mtype == CV_8S) && _mask.sameSize(*psrc1) in function 'binary_op'

Is there some post processing required to be able to use the inferred masks output by the trained model (apologies for the noise, have exhausted all possible other resources to try and figure it out)?