Image classification using SVM

I am running the below code :
import numpy as np
import os
from pathlib import Path
from keras.preprocessing import image
import matplotlib.pyplot as plt

p = Path(“C:/Users/hp/Documents/ML with python/DataSet/images”)

dirs = p.glob("*")

labels_dict = {“cat”:0,“dog”:1,“horse”:2,“human”:3}

image_data = []
labels = []

for folder_dir in dirs:
print(folder_dir)
label = str(folder_dir).split("\")[-1][:-1]

for img_path in folder_dir.glob("*.jpg"):
    print(img_path)
    img = image.load_img(img_path,target_size=(32,32))

I am getting following error

–> 108 raise ImportError('Could not import PIL.Image. ’
109 ‘The use of load_img requires PIL.’)
110 img = pil_image.open(path)

ImportError: Could not import PIL.Image. The use of load_img requires PIL.

Why am I getting an error, I have already installed keras and using the same

Thanks

hey @sanandasaha3,
try this command

pip install pillow

after this is successfully installed then try running your script.

Thank You. :slightly_smiling_face:.