[Python] "AttributeError: 'NoneType' object has no attribute 'shape'" 해결


[Python]

문제상황: 머신러닝 모델 개발 중 데이터 전처리 과정에서 에러가 발생했습니다. 아래 코드는 이미지 데이터를 불러와 전처리하는 과정을 담고 있습니다. import cv2 import numpy as np def load_and_preprocess_image(image_path): image = cv2.imread(image_path) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) image = cv2.resize(image, (224, 224)) return image image_path = "example.jpg" preprocessed_image = load_and_preprocess_image(image_path) print(preprocessed_image.s..


원문링크 : [Python] "AttributeError: 'NoneType' object has no attribute 'shape'" 해결