Skip to content

slice indices must be integers or None or have an __index__ method #2

Description

@Atwaman

To avoid this error:
in utils.py
in modcrop(img, scale =3):

add np.mod:
if len(img.shape) ==3:
h, w, _ = img.shape
h = h - np.mod(h,scale)
w = w - np.mod(w, scale)
img = img[0:h, 0:w, :]
else:
h, w = img.shape
h = h - np.mod(h, scale)
w = w - np.mod(w,scale)
img = img[0:h, 0:w]
return img

Additionally, since the division in input_setup in:
padding = abs(config.image_size - config.label_size) / 2
returns a float, padding cant be used as indexing as it is, so change to
padding = int(abs(config.image_size - config.label_size) / 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions