Classification test in Scikit-learn, ValueError: setting an array element with a sequence

前端 未结 1 486
耶瑟儿~
耶瑟儿~ 2021-01-23 00:00

Using the tutorial on multiclass adaboost, I\'m trying to classify some images that have two classes (but I don\'t suppose the algorithm shouldn\'t work if the problem is binary

相关标签:
1条回答
  • 2021-01-23 00:45

    try:

    imgs = []
    tmp_hogs = np.zeros((17, 256))
    # 13 of the images are with vehicles, 4 are without
    labels = [1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0]
    
    i = 0
    for file in out:
            filepath = "C:\PATH_TO_SAMPLE_IMAGES\\" + file
            curr_img = color.rgb2gray(io.imread(filepath))
            imgs.append(resize(curr_img,(60,40)))
            fd, hog_image = hog(curr_img, orientations=8, pixels_per_cell=(16, 16),
                     cells_per_block=(1, 1), visualise=True)
            tmp_hogs[i,:] = fd
            i+=1
    
    img_hogs = tmp_hogs
    
    0 讨论(0)
提交回复
热议问题