I am running a program and I have the code below. But I do not know what does that [:, :, ::-1]
do exactly. I get the following error when I run the program so understanding the function of [:, :, ::-1]
will help me to debug. Thanks.
while True:
ix = np.random.choice(np.arange(len(lists)), batch_size)
imgs = []
labels = []
for i in ix:
# images
img_path = img_dir + lists.iloc[i, 0] + '.png'
original_img = cv2.imread(img_path)[:, :, ::-1]
resized_img = cv2.resize(original_img, dims+[3])
array_img = img_to_array(resized_img)/255
imgs.append(array_img)
error:
original_img = cv2.imread(img_path)[:, :, ::-1]
TypeError: 'NoneType' object is not subscriptable