2021-09-12 02:22 PM
I'm running your acoustic_scene_classification.ipynb, available in FP-AI-SENSING1, the Middleware ASC (acoustic scene classification):
https://www.st.com/en/embedded-software/fp-ai-sensing1.html
When I try to import and convert data, I get the following error warning:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-9-87cd88dbb12e> in <module>
1 dataset_dir = './Dataset'
2 meta_path = path = os.path.join(dataset_dir, 'TrainSet.txt')
----> 3 fileset = np.loadtxt(meta_path, dtype=str)
4
5 # 3 classes : 0 indoor, 1 outdoor, 2 in-vehicle
C:\ST\Anaconda3\lib\site-packages\numpy\lib\npyio.py in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin, encoding, max_rows, like)
1063 raise ValueError("Wrong number of columns at line %d"
1064 % line_num)
-> 1065
1066 # Convert each value according to its column and store
1067 items = [conv(val) for (conv, val) in zip(converters, vals)]
C:\ST\Anaconda3\lib\site-packages\numpy\lib\_datasource.py in open(path, mode, destpath, encoding, newline)
192 """
193
--> 194 ds = DataSource(destpath)
195 return ds.open(path, mode, encoding=encoding, newline=newline)
196
C:\ST\Anaconda3\lib\site-packages\numpy\lib\_datasource.py in open(self, path, mode, encoding, newline)
529 _fname, ext = self._splitzipext(found)
530 if ext == 'bz2':
--> 531 mode.replace("+", "")
532 return _file_openers[ext](found, mode=mode,
533 encoding=encoding, newline=newline)
OSError: ./Dataset\TrainSet.txt not found.
....................................................................................................................
TrainSet.tx is inside the Dataset folder, as you settled.
Did you fix this issue ?
Thanks
Solved! Go to Solution.
2021-09-14 07:24 AM
then maybe the versions are not compatible with one another, you should install older versions it should work . this pack was developed ages ago ...
2021-09-13 01:20 AM
Hello
I just run the jupyter notebook ( from version 4.0.3) on windows10 without an issue on my side .
Could you check you are using TrainSet.txt and not TrainSet.tx like you wrote ?
try to clear output & restart
best regards
L.
2021-09-13 01:47 AM
you may also want to check the "/" vs "\" in your environment
2021-09-13 02:30 PM
Yes, it works. I was using a wrong path in my environment. Thank you!
I anyway changed "keras.utils.to_categorical" to "tf.keras.utils.to_categorical" when preparing output data, because I got an error warning.
Compiling the model I get:
sgd = optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True)
model.compile(optimizer=sgd, loss='categorical_crossentropy', metrics=['acc'])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-14-c51f12e1fab9> in <module>
----> 1 sgd = optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True)
2 model.compile(optimizer=sgd, loss='categorical_crossentropy', metrics=['acc'])
AttributeError: module 'keras.optimizers' has no attribute 'SGD'
Thanks
M
2021-09-13 11:45 PM
Can you check the keras & tf version ?
In my environment I get ( you can see it from cell 3 of the jupyter notebook) :
try to align the versions and check
best regards
L.
2021-09-13 11:48 PM
2021-09-14 07:17 AM
Keras: 2.6.0
TensorFlow: 2.6.0
librosa: 2.6.0
2021-09-14 07:24 AM
then maybe the versions are not compatible with one another, you should install older versions it should work . this pack was developed ages ago ...
2021-09-14 07:29 AM
sgd = tf.keras.optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True)
works well in this way .............. no warning
2021-09-14 07:49 AM
I updated this instruction too:
converter = tf.compat.v1.lite.TFLiteConverter.from_keras_model_file(out_dir + "model.h5" )
for generating the TFLite model.
Thank you !
M