AayushKrChaudhary / RITnet

This is a winning model of OpenEDS Semantic Segmentation Challenge
MIT License
73 stars 28 forks source link

operands could not be broadcast together with shapes (288,400) (457,400) #15

Open supernumber17 opened 5 months ago

supernumber17 commented 5 months ago

I've encountered the issue described in the title while running train.py. It seems to be coming from the Starburst_augment class in dataset.py, and I'm not sure what's going on. I hope to get help from a professional. Also, I downloaded the openEDS dataset from the Kaggle.(https://www.kaggle.com/datasets/soumicksarker/openeds-dataset) `class Starburst_augment(object):

We have generated the starburst pattern from a train image 000000240768.png

## Please follow the file Starburst_generation_from_train_image_000000240768.pdf attached in the folder
## This procedure is used in order to handle people with multiple reflections for glasses
## a random translation of mask of starburst pattern

def __call__(self, img):
    x = np.random.randint(1, 40)
    y = np.random.randint(1, 40)
    mode = np.random.randint(0, 2)
    starburst = Image.open('starburst_black.png').convert("L")
    if mode == 0:
        starburst = np.pad(starburst, pad_width=((0, 0), (x, 0)), mode='constant')
        starburst = starburst[:, :-x]
    if mode == 1:
        starburst = np.pad(starburst, pad_width=((0, 0), (0, x)), mode='constant')
        starburst = starburst[:, x:]

    img[92 + y:549 + y, 0:400] = np.array(img)[92 + y:549 + y, 0:400] * (
            (255 - np.array(starburst)) / 255) + np.array(starburst)
    return Image.fromarray(img)`