librealsense: Unable to load Keras Unet model for denoising example

Required Info
Camera Model D400
Firmware Version 05.12.05.00
Operating System & Version Linux (Ubuntu 18)
Kernel Version (Linux Only) 5.4.0
Platform PC
SDK Version 2.41.0
Language python
Segment Robot

Issue Description

I’m trying to run denoising example described in TensorFlow with Intel RealSense Cameras.

After downloading the script and Keras Unet model , I run the command below:

python3 'example5 - denoise.py' DEPTH_Keras_Unet.model

However, it raised an error:

Traceback (most recent call last):
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/training/py_checkpoint_reader.py", line 95, in NewCheckpointReader
    return CheckpointReader(compat.as_bytes(filepattern))
RuntimeError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for DEPTH_Keras_Unet.model/variables/variables

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 633, in load_internal
    ckpt_options)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 194, in __init__
    super(KerasObjectLoader, self).__init__(*args, **kwargs)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 131, in __init__
    self._restore_checkpoint()
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 328, in _restore_checkpoint
    self._checkpoint_options).expect_partial()
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/training/tracking/util.py", line 1275, in restore
    reader = py_checkpoint_reader.NewCheckpointReader(save_path)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/training/py_checkpoint_reader.py", line 99, in NewCheckpointReader
    error_translator(e)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/training/py_checkpoint_reader.py", line 35, in error_translator
    raise errors_impl.NotFoundError(None, None, error_message)
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for DEPTH_Keras_Unet.model/variables/variables

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example5 - denoise.py", line 23, in <module>
    model = keras.models.load_model(test_model_name)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 187, in load_model
    return saved_model_load.load(filepath, compile, options)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 121, in load
    path, options=options, loader_cls=KerasObjectLoader)
  File "/home/spritaro/.local/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 636, in load_internal
    str(err) + "\n If trying to load on a different device from the "
FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for DEPTH_Keras_Unet.model/variables/variables
 If trying to load on a different device from the computational device, consider using setting the `experimental_io_device` option on tf.saved_model.LoadOptions to the io_device such as '/job:localhost'.

DEPTH_Keras_Unet.model/variables directory does contain variables.data-00000-of-00002 and variables.data-00001-of-00002 though… My guess is that it requires variables.index file in DEPTH_Keras_Unet.model/variables directory, like the one in Using the SavedModel format. Is there any way to confirm this?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Hi @MartyG-RealSense it is my pleasure and thanks for pointing out this issue. @Spritaro the script camera_simulation.py is renamed as example5-denoised.py, I will fix it.

Hi @nohayassin, I tried your model and it worked really well! Thank you very much for your help!