Esri / raster-deep-learning

ArcGIS built-in python raster functions for deep learning to get you started fast.
Apache License 2.0
190 stars 88 forks source link

Tensorflow example - AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__' #14

Closed tim-mcg closed 5 years ago

tim-mcg commented 5 years ago

Trying to run the Tensorflow object detection example. When choosing the provided tensorflow_objectdetectionapi_coconuttree.emd file in the geoprocessing tool in ArcGIS Pro the below error is shown:

ERROR 002667 Unable to initialize python raster function with scalar arguments. [c:\program files\arcgis\pro\Resources\Raster\Functions\System\DeepLearning\ObjectDetector.py] Traceback (most recent call last): File "c:\program files\arcgis\pro\Resources\Raster\Functions\System\DeepLearning\ObjectDetector.py", line 41, in initialize '{}.{}'.format(framework, self.json_info['ModelConfiguration'])), 'ChildObjectDetector') File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "c:\program files\arcgis\pro\Resources\Raster\Functions\System\DeepLearning\TensorFlow\ObjectDetectionAPI.py", line 2, in import tensorflow as tf File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow__init.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python__init.py", line 82, in from tensorflow.python import keras File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\init__.py", line 24, in from tensorflow.python.keras import activations File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\activations.py", line 24, in from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\utils\init.py", line 38, in from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\utils\multi_gpu_utils.py", line 22, in from tensorflow.python.keras.engine.training import Model File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\engine\training.py", line 42, in from tensorflow.python.keras.engine.network import Network File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\engine\network.py", line 40, in from tensorflow.python.keras.engine import saving File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\tensorflow\python\keras\engine\saving.py", line 38, in import h5py File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\DeepLearningEnvTest\Lib\site-packages\h5py\init__.py", line 36, in from ._conv import register_converters as _register_converters File "h5py\h5r.pxd", line 21, in init h5py._conv File "h5py\h5r.pyx", line 145, in init h5py.h5r AttributeError: type object 'h5py.h5r.Reference' has no attribute 'reduce_cython__'

Unable to initialize python raster function with scalar arguments.

I was able to get around this by commenting out the following line from the env_setup.bat file and reinstalling the environment. Following this the tensorflow example worked correctly.

From:

CALL "%SCRIPTS_DIR%conda.exe" install -c scw h5py --yes

To:

rem CALL "%SCRIPTS_DIR%conda.exe" install -c scw h5py --yes

lingtangraster commented 5 years ago

@tim-mcg Thank you so much for the suggestion.
Yes, you are right, this command line was originally imported to resolve a Python packages dependency issue between TensorFlow 1.12 and ArcGIS Pro 2.4 preinstalled h5py. Now Pro has updated its h5py library to 2.9, we do not need this command line anymore. I will remove this command line from env_setup.bat file. Once again, we really appreciate your help with regard to this issue.