Error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize' occur when runs code on Windows but works fine on Mac

it cannot find the image at all but the path is generated by image in the folder

img = cv2.imread(img_path)
if img is None:
# print some err
continue

if I do this nothing would pass into detection

as I have said it works correctly on mac but not on windows

why the last part of the path have to be \ and as you have said it works on program why the error occurs

actually I have seen a ton of [Error: (-215:Assertion failed) but their case, they can’t even run their code but mine perform correctly on mac