shaheen-syed / CNN-Non-Wear-Time-Algorithm

A novel algorithm to detect non-wear time from raw accelerometer data using convolutional neural networks.
7 stars 3 forks source link

Error in model - can't infer #1

Closed muschellij2 closed 4 years ago

muschellij2 commented 4 years ago
mkdir data
wget https://ndownloader.figshare.com/files/21855675 -O data/AI12_NEO1F09120034_2017-09-25.gt3x.gz
gunzip data/AI12_NEO1F09120034_2017-09-25.gt3x.gz
python3 infer_nw_time.py -fd data/
root        : INFO     Found 1 raw acceleration files to process
root        : INFO     Processing file data/AI12_NEO1F09120034_2017-09-25/AI12_NEO1F09120034_2017-09-25.npz 0/1
root        : INFO     Sampling frequency of the data is 30Hz, should be 100Hz, starting resampling....
root        : INFO     Start resample_acceleration
root        : INFO     Data resampled to 100hz
tensorflow  : WARNING  From /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/ops/init_ops.py:1251: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
2020-08-11 13:26:30.756923: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
  File "infer_nw_time.py", line 107, in <module>
    start_stop_label_decision = start_stop_label_decision
  File "/Users/johnmuschelli/Dropbox/Packages/CNN-Non-Wear-Time-Algorithm/functions/raw_non_wear_functions.py", line 457, in cnn_nw_algorithm
    cnn_model = models.load_model(cnn_model_file)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/keras/saving/save.py", line 146, in load_model
    return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 244, in load_model_from_hdf5
    sample_weight_mode=sample_weight_mode)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/training/tracking/base.py", line 457, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 300, in compile
    self.loss, self.output_names)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_utils.py", line 1094, in prepare_loss_functions
    generic_utils.check_for_unexpected_keys('loss', loss, output_names)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 592, in check_for_unexpected_keys
    expected_values))
ValueError: Unknown entries in loss dictionary: ['class_name', 'config']. Only expected following keys: ['dense_5']
shaheen-syed commented 4 years ago

What version of Tensorflow are you using? I'm on 2.1 and can't replicate the error.