Dear Concern,
What will be the transpose parameter for the grayscale image for conv2d?
training_data = []
def create_training_data():
for category in CATEGORIES_Train: # do dogs and cats
path = os.path.join(DATADIR_Train,category) # create path attack
class_num = CATEGORIES_Train.index(category) # get the classification (0, 1,.... ).
for img in tqdm(os.listdir(path)): # iterate over each image
try:
img_array = cv2.imread(os.path.join(path,img)) # convert to array
new_array = cv2.resize(img_array, (100, 100)) # resize to normalize data size
new_array = np.transpose(new_array, (2, 0, 1))
training_data.append([new_array, class_num]) # add this to our training_data
except Exception as e: # in the interest in keeping the output clean...
pass
#except OSError as e:
# print("OSErrroBad img most likely", e, os.path.join(path,img))
#except Exception as e:
# print("general exception", e, os.path.join(path,img))
create_training_data()
print(len(training_data))```
![image|690x28](upload://nJGZ8jjBcygJ7ZeiQxBYoCFk3HO.png)