Doodleverse / doodleverse_utils

A set of common Doodleverse tools and utilities
MIT License
4 stars 3 forks source link

Do_Seg function `resize` is broken. Need to convert `est_label` to type `float32` #18

Closed 2320sharon closed 1 year ago

2320sharon commented 1 year ago

Yesterday while testing out segmentation zoo I discovered a bug with do_seg. You can find the full issue in detail [here].(https://github.com/Doodleverse/segmentation_zoo/issues/22) It was failing to resize imagery due to the image being converted to datatype float16 which was incompatible with skimage's resize function. With @ebgoldstein's help, I was able to find that the image needs to be converted to datatype float32 before being passed to the resize function.

The following block of code shows how to resize est_label to float32 within do_seg

        est_label /= counter + 1
        # new line: changes est_label from float16 to float32
        est_label = est_label.astype('float32')
        est_label = resize(est_label, (w, h))

I've tested this code and it works great for the RGB models. If est_label was never meant to be type float16 it might be worth looking into how that happened within the code.

I'll be submitting a PR to fix this later today and I recommend updating the package as soon as possible.