JJGO / UniverSeg

UniverSeg: Universal Medical Image Segmentation
Apache License 2.0
504 stars 51 forks source link

the inference for three channel retina image #10

Closed JiHooooo closed 1 year ago

JiHooooo commented 1 year ago

Thanks for your good job and kindly sharing the inference code. I found that the inference code is designed for single channel image. But the retina image, which exists in MegaMedical dataset and was used to train the model of UniverSeg, is always 3 channel. Could you tell me how to processing those 3 channel image?

VictorButoi commented 1 year ago

For three channel images, we chose to convert them to greyscale first. We use something like this.

from PIL import Image
import numpy as np

im_dir = # Your image dir
label_dir = # Your label dir

loaded_image = np.array(Image.open(im_dir).convert('L'))
loaded_label = np.array(Image.open(label_dir))
JiHooooo commented 1 year ago

Thanks for your explanation. I will try that,