for filename in filenames:
if check_img_file(filename):
img_paths.append(os.path.join(cur_dir, filename))
labels.append(label_names.index(label_name))
return img_paths, np.array(labels, np.int32)
After Change
for filename in filenames:
if check_img_file(filename):
img_paths.append(os.path.join(cur_dir, filename))
labels.append(label_name_to_idx[label_name])
return img_paths, np.array(labels, np.int32)