0

我尝试通过创建目录和类别来添加数据集,但对我来说并没有成功。它表明了这一点。请帮忙。

for category in CATEGORIES: 
    path = os.path.listdir() 
    for img in os.listdir(path): 
        img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) 
        plt.imshow(img_array, cmap='gray') 
        plt.show() 

ERROR : File "D:/DataScienceProj/main.py", line 12, in <module> path = os.path.listdir() AttributeError: module 'ntpath' has no attribute 'listdir' –
4

0 回答 0