Original code :
img_init = cv2.imread(img_path)
img_init = cv2.resize(img_init, (224, 224))
img = np.asarray(img_init)
Error message :
cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\imgproc\src\resize.cpp:4051: error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’
Reason : Chinese is included in the image path
Solution :
img_init = cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
img_init = cv2.resize(img_init, (224, 224))
img = np.asarray(img_init)