hsiangyuzhao / RCPS

official implementation of rectified contrastive pseudo supervision
MIT License
57 stars 3 forks source link

Test mould and make predictions #20

Closed Kelvin-hzm closed 4 months ago

Kelvin-hzm commented 4 months ago

Hello hsiangyuzhao! I saw the Figure 2 in your paper that has blue lines denote the predictions and I wonder how can I get that cut line after training my own mould? In other word, I wanna test the train mould I got and make some predictions. Is it mark red in the train_visualization?

hsiangyuzhao commented 4 months ago

Visualization code is not provided in the open source code.

If you want to make some visualizations using contours, you may use skimage.segmentation.find_boundaries function, which might be useful.

Kelvin-hzm commented 4 months ago

Sorry for disturbing you again, I try to use find_boundaries function but fail to get some result when I occur to make model predition, would you mind giving me more details?

hsiangyuzhao commented 4 months ago

Hi @Kelvin-hzm

You could run find_boundaries function at model prediction to find the contour, and then you could assign a RGB value to these regions at the corresponding image. The pseudo code might look like this:

# image: (H, W, 3), a 3-channel RGB image slice
# pred: (H, W), same shape with image
contours = find_boundaries(pred)
image[contours] = (255, 0, 0)  # red contour

I would suggest you generate the contour slice by slice for better visualization quality.

Kelvin-hzm commented 4 months ago

Thanks!