application_vnd.jupyter.stderr_output_2.png text_plain_output_1.png
import numpy as np # linear algebra

import os

import numpy as np
import pandas as pd
import os

os.listdir('../input/rice-image-dataset/Rice_Image_Dataset')

def load(impath):
    imgs = []
    labels = []
    l1 = os.listdir(impath)
    for i in l1:
        if i[-1] == 't':
            continue
        l2 = os.listdir(impath + '/' + i)
        count = 0
        for j in l2:
            img = Image.open(impath + '/' + i + '/' + j)
            img = img.resize(size=(28, 28))
            img = img.convert('L')
            imgs.append(np.array(img))
            labels.append(i)
            count += 1
            if count >= 1000:
                break
    return (np.array(imgs), labels)

arr, l = load('../input/rice-image-dataset/Rice_Image_Dataset')
l