Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOError: [Errno 21] Is a directory: 'data0/.ipynb_checkpoints' #4

Open
Hemanth-Mydugolam opened this issue Nov 21, 2017 · 0 comments
Open

Comments

@Hemanth-Mydugolam
Copy link

can anybody help ton this issue please.
while calling the function in the python code as:
cat_counter = get_car_categories()

the called function definition is as follows:

def get_car_categories():
d = defaultdict(float)
img_list = os.listdir('data0')
for i, img_path in enumerate(img_list):
path = 'data0/'+img_path
img = prepare_image(path)
out = vgg16.predict(img)
top = get_predictions(out, top=5)
for j in top[0]:
d[j[0:2]] += j[2]
if i % 50 == 0:
print i, '/', len(img_list), 'complete'
return Counter(d)

I am getting error as follows:

IOError Traceback (most recent call last)
in ()
----> 1 cat_counter = get_car_categories()

in get_car_categories()
4 for i, img_path in enumerate(img_list):
5 path = 'data0/'+img_path
----> 6 img = prepare_image(path)
7 out = vgg16.predict(img)
8 top = get_predictions(out, top=5)

in prepare_image(img_path)
1 def prepare_image(img_path):
----> 2 img = load_img(img_path, target_size=(224, 224))
3 x = img_to_array(img)
4 x = np.expand_dims(x, axis=0)
5 x = preprocess_input(x)

/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.pyc in load_img(path, grayscale, target_size)
294 raise ImportError('Could not import PIL.Image. '
295 'The use of array_to_img requires PIL.')
--> 296 img = pil_image.open(path)
297 if grayscale:
298 img = img.convert('L')

/usr/lib/python2.7/dist-packages/PIL/Image.pyc in open(fp, mode)
1994 if isPath(fp):
1995 filename = fp
-> 1996 fp = builtins.open(fp, "rb")
1997 else:
1998 filename = ""

IOError: [Errno 21] Is a directory: 'data0/.ipynb_checkpoints'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant