ARM-software / ML-examples

Arm Machine Learning tutorials and examples

Home Page:https://developer.arm.com/technologies/machine-learning-on-arm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

couldn't retrieve the checkpoints

Aishaj opened this issue · comments

Hello,

I'm trying to run the following line
python test.py --model_architecture dnn --model_size_info 128 128 128 --checkpoint /tflu-kws-cortex-m/Pretrained_models/DNN/DNN_S/ckpt/checkpoint

Howevre I'm getting the following error

Traceback (most recent call last): File "test.py", line 182, in <module> test() File "test.py", line 44, in test model.load_weights(FLAGS.checkpoint).expect_partial() File "/home/pi/miniconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 162, in load_weights return super(Model, self).load_weights(filepath, by_name) File "/home/pi/miniconda3/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1384, in load_weights pywrap_tensorflow.NewCheckpointReader(filepath) File "/home/pi/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 636, in NewCheckpointReader return CheckpointReader(compat.as_bytes(filepattern)) File "/home/pi/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 648, in __init__ this = _pywrap_tensorflow_internal.new_CheckpointReader(filename) tensorflow.python.framework.errors_impl.InvalidArgumentError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on /tflu-kws-cortex-m/Pretrained_models/DNN/DNN_S/ckpt/checkpoint: Not found: /tflu-kws-cortex-m/Pretrained_models/DNN/DNN_S/ckpt; No such file or directory

Any anyone had the same issue and managed to fix it?

Thank you

Your path is incorrect, you have supplied an absolute path so it is looking in your whole machine for /tflu-kws-cortex-m/Pretrained_models/DNN/DNN_S/ckpt
you are probably wanting to use a relative path like ../Pretrained_models/DNN/DNN_S/ckpt/dnn_0.84_ckpt instead.

Also note that when using the checkpoint files they correspond to a model in train_commands.txt so you need to make sure parameters you supply to test.py like model_size_info, window_size_ms, winow_stride_ms match what was used in training these checkpoints. You can just take what is used in train_commands.txt for this bit.

Thank you Richard @Burton2000 . I edited the path and it worked.
I did use the parameters in train_commands.txt but still there is a problem. When running this
python test.py --model_architecture ds_cnn --model_size_info 5 64 10 4 2 2 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 --checkpoint ../Pretrained_models/DNN/DNN_S/ckpt/dnn_0.84_ckp

I'm getting ,
Running testing on validation set... <DatasetV1Adapter shapes: ((?, 3920), (?,)), types: (tf.float32, tf.int32)>

Thank you

The parameters should match the checkpoint you are trying to restore. Those parameters are for the DS-CNN S model but you are trying to restore the DNN-S checkpoint. You would want something like this and it should work:

python test.py --model_architecture ds_cnn --model_size_info 5 64 10 4 2 2 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 --dct_coefficient_count 10 --window_size_ms 40 --window_stride_ms 20 --checkpoint ../Pretrained_models/DS_CNN/DS_CNN_S/ckpt/ds_cnn_0.94_ckpt

Thanks