这段代码发生了什么错误,我不明白

问题描述 投票:0回答:1
plt.figure(figsize=(12, 12))

for i, class_name in enumerate(classes.values()):
    
    class_subset = raw_data.loc[raw_data.class_name == class_name].sample(n=4)
    
    img_names = class_subset.filename.to_list()
    
    for j, img in enumerate(img_names):
        image = cv2.imread(os.path.join(img_dir, img))
        
        ## convert image to RGB
        image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
        
        ## subplot variables - (# of rows, # of columns, iterate through locations on grid)
        plt.subplot(8, 4, 4 * i + j + 1)
        plt.imshow(image_rgb, aspect=1)
        
        ## label with filename and diagnosis
        plt.xlabel('{}'.format(class_name))

        plt.tight_layout() 

here is the image of this code and error

有人定义错误并解码此代码。

python pandas numpy jupyter-notebook ml
1个回答
0
投票

该错误表明变量“classes”(您试图在第 3 行中枚举)不存在。

© www.soinside.com 2019 - 2024. All rights reserved.