JJGO / UniverSeg

UniverSeg: Universal Medical Image Segmentation
Apache License 2.0
481 stars 49 forks source link

Segmentation results not good enough. Clarification regarding preprocessing code. #27

Closed NishaniKasineshan closed 2 months ago

NishaniKasineshan commented 2 months ago

I ran through all the colab steps and it worked pretty well the sample datasets but not good with custom data provided as follows: with WBC: wbc with OASIS: oasis with my datasets(publicaly available): tufts

output I have my preprocessing codes as follows to be applied on the support images and support labels:

def process_img(path: None):
    img = cv2.imread(path,cv2.IMREAD_GRAYSCALE)
    img = cv2.resize(img,(128,128)).reshape(1, 128, 128)
    img = img.astype(np.float32)
    return img

def process_seg(path: None):
    seg = cv2.imread(path,cv2.IMREAD_GRAYSCALE)
    seg = cv2.resize(seg,(128,128)).reshape(1, 128, 128)
    seg = seg.astype(np.float32)
    return seg
 processed_support_images = [T(process_img(image)) for image in _support_images]
 processed_support_labels = [T(process_seg(label))for label in _support_labels]

 support_images = torch.stack(processed_support_images).to(device)
 support_labels = torch.stack(processed_support_labels).to(device)

Is there any issue with my preprocessing code?

NishaniKasineshan commented 2 months ago

Actually, I had the issue with my preprocessing code. I have figured it out. Thank you for your amazing work.