labels.append(labels_dict[label])
bincynadar opened this issue · 3 comments
bincynadar commented
Getting an error in this line
CheshtaK commented
Hey @bincynadar! Apologies for the late reply.
Could you post the error log that you're receiving?
walusingogo commented
Hey @bincynadar! Apologies for the late reply.
Could you post the error log that you're receiving?
KeyError Traceback (most recent call last)
in ()
13 img_array = image.img_to_array(img)
14 image_data.append(img_array)
---> 15 labels.append(labels_dict[label])
KeyError: 'Images/dog'
walusingogo commented
To solve this issue, replace the following line of code:
label = str(folder_dir).split("\")[-1][:-1]
with:
label = os.path.basename(folder_dir).split("\")[-1][:-1]