TensorFlow-SRCNN icon indicating copy to clipboard operation
TensorFlow-SRCNN copied to clipboard

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

Open Atwaman opened this issue 6 years ago • 0 comments

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)

Atwaman avatar Jan 30 '19 12:01 Atwaman