训练yolov5的时候如果启用了Albumentations库可能会出现:
cv2.cvtColor(im_hsv, cv2.COLOR_HSV2BGR, dst=im) # no return needed
TypeError: Expected Ptr<cv::UMat> for argument 'dst'
或者
cv2.cvtColor(im_hsv, cv2.COLOR_HSV2BGR, dst=im) # no return needed
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
> - Layout of the output array dst is incompatible with cv::Mat
> - Expected Ptr<cv::UMat> for argument 'dst'
原因是之前的操作使得im
在内存中不连续,在augment_hsv
之前加一行解决:
img = np.ascontiguousarray(img)