https://ask.csdn.net/questions/1057478#answer_1310863
img = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color) # add border
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\copy.cpp:1421: error: (-215:Assertion failed) top >= 0 && bottom >= 0 && left >= 0 && right >= 0 && _src.dims() <= 2 in function 'cv::copyMakeBorder'
建议你把test.py文件中的第四十七行的
dataset = LoadImagesAndLabels(test_path, img_size, batch_size)
改为
dataset = LoadImagesAndLabels(test_path, img_size, batch_size,rect = False)试试