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

Error 21 #3

Open
Pascalx77 opened this issue Mar 14, 2021 · 1 comment
Open

Error 21 #3

Pascalx77 opened this issue Mar 14, 2021 · 1 comment

Comments

@Pascalx77
Copy link

First of all, great code, I like it. I am newbe a python with my raspberry pi. I read your article ,"towardsdatascience.com/create-your-own-smart-baby-monitor-with-a-raspberrypi".
I have this error with the train.py and I don't understand what is the problem, any hint will be appreciated:

Traceback (most recent call last):
File "train.py", line 54, in
model.save(model_dir, overwrite=True)
File "/usr/local/lib/python3.7/dist-packages/micmon-0.1-py3.7.egg/micmon/model/init.py", line 58, in save
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/keras/engine/network.py", line 986, in save
signatures, options)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/keras/saving/save.py", line 112, in save_model
model, filepath, overwrite, include_optimizer)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 92, in save_model_to_hdf5
f = h5py.File(filepath, mode='w')
File "/usr/local/lib/python3.7/dist-packages/h5py/_hl/files.py", line 445, in init
swmr=swmr)
File "/usr/local/lib/python3.7/dist-packages/h5py/_hl/files.py", line 201, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 116, in h5py.h5f.create
IsADirectoryError: [Errno 21] Unable to create file (unable to open file: name = '/home/pi/models/sound-detect', errno = 21, error message = 'Is a directory', flags = 13, o_flags = 242)

@jenssss
Copy link

jenssss commented Mar 20, 2021

I was having the same problem. In my case it was caused by the version of Tensorflow installed by pip on Raspberry by default being too old (1.14.0 in my case). Changing to the newest version fixed this (see e.g. this guide https://towardsdatascience.com/3-ways-to-install-tensorflow-2-on-raspberry-pi-fe1fa2da9104). Looks like there were a lot of changes in Tensorflow 2.0, including how output is written. See also #1 (comment).

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

2 participants