Python 类型错误:预期的Ptr<;cv::UMat>;对于参数';src';-滑动窗口

Python 类型错误:预期的Ptr<;cv::UMat>;对于参数';src';-滑动窗口,python,machine-learning,typeerror,object-detection,sliding-window,Python,Machine Learning,Typeerror,Object Detection,Sliding Window,我在Jupyter笔记本的滑动窗口上训练我的模型时遇到以下错误 TypeError Traceback (most recent call last) <ipython-input-33-258a109a8532> in <module> 18 index = i + startIndex 19 img = cv2.imread('C:/Users/hp/Desktop/M

我在Jupyter笔记本的滑动窗口上训练我的模型时遇到以下错误

TypeError                                 Traceback (most recent call last)
<ipython-input-33-258a109a8532> in <module>
     18     index = i + startIndex
     19     img = cv2.imread('C:/Users/hp/Desktop/Mod1-IITR/test/' + str(index) + '.jpg')
---> 20     img_with_label = label_vehicles(img, X_scaler)
     21     axarr[i].imshow(img_with_label)
     22 plt.setp([a.get_xticklabels() for a in axarr[:]], visible=False)

<ipython-input-33-258a109a8532> in label_vehicles(image, X_scaler)
      1 def label_vehicles(image, X_scaler):
      2     draw_image = np.copy(image)
----> 3     draw_image = cv2.cvtColor(draw_image, cv2.COLOR_RGB2BGR)
      4     windows = slide_window(image, x_start_stop=[None, None], y_start_stop=y_start_stop)
      5     hot_windows = search_windows(image, windows, svc, X_scaler, color_space=color_space, 

TypeError: Expected Ptr<cv::UMat> for argument 'src'
我写了范围(7,8),因为我只想在一张图片上看到结果。我应该如何解决此错误

def label_vehicles(image, X_scaler):
    draw_image = np.copy(image)
    draw_image = cv2.cvtColor(draw_image, cv2.COLOR_RGB2BGR)
    windows = slide_window(image, x_start_stop=[None, None], y_start_stop=y_start_stop)
    hot_windows = search_windows(image, windows, svc, X_scaler, color_space=color_space, 
                            spatial_size=spatial_size, hist_bins=hist_bins, 
                            orient=orient, pix_per_cell=pix_per_cell, 
                            cell_per_block=cell_per_block, 
                            hog_channel=hog_channel, spatial_feat=spatial_feat, 
                            hist_feat=hist_feat, hog_feat=hog_feat)                       

    window_img = draw_boxes(draw_image, hot_windows, color=(0, 0, 255), thick=6)  
    return window_img

f, axarr = plt.subplots(1, 1, figsize=(16, 12))
startIndex = random.randint(1, 40)
for i in range(7,8):
    index = i + startIndex
    img = cv2.imread('C:/Users/hp/Desktop/Mod1-IITR/test/' + str(index) + '.jpg')
    img_with_label = label_vehicles(img, X_scaler)
    axarr[i].imshow(img_with_label)
plt.setp([a.get_xticklabels() for a in axarr[:]], visible=False)
plt.setp([a.get_yticklabels() for a in axarr[:]], visible=False)
f.subplots_adjust(hspace=0)
plt.show()