niciBume / Cat_Prey_Analyzer

Cat Prey Image-Classification with deeplearning
MIT License
142 stars 22 forks source link

AttributeError: module 'h5py' has no attribute 'File' #16

Closed maschde closed 3 years ago

maschde commented 3 years ago

I am very interested in this project, because we have a cat that has prey for me sometimes three times a day. I have installed everything following your readme. A few missing were showed at the first runs but this import errors i solved. But now i have an issue where i can not find a solution:

I get this Traceback when running catCam_starter.sh.

Traceback (most recent call last): File "cascade.py", line 724, in <module> sq_cascade = Sequential_Cascade_Feeder() File "cascade.py", line 75, in __init__ self.base_cascade = Cascade() File "cascade.py", line 417, in __init__ self.pc_stage = PC_Stage() File "/home/pi/CatPreyAnalyzer/model_stages.py", line 269, in __init__ self.pc_model = tf.keras.models.load_model(os.path.join(PC_models_dir, self.pc_model_name)) File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py", line 145, in load_model isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))): AttributeError: module 'h5py' has no attribute 'File'

Do you have any idea why this happens?

maschde commented 3 years ago

Ich habe die Lösung in dem geschlossenen Issue von badsche gefunden und dort auch gesehen dass du deutschsprachig bist. Nach der Installation von sudo apt-get install python3-h5py läuft bisher alles einwandfrei. Wenn noch weitere Fehler oder Fragen auftauchen würde ich mich wieder melden.

Flo-1995 commented 3 years ago

Hallo zusammen, Ich möchte kein neues issue aufmachen, da das problem sicherlich hinter dem Bildschirm sitzt. Bin sehr Interessiert daran, das Projekt nach zu bauen und ggf. mit einer KlappenConnection zu erweitern. Leider bin ich noch recht frisch was Python (Schul Python Kenntnis) und Raspberry angeht. Habe streng den Anleitungen gefolgt, dennoch komme ich leider auf keinen grünen Zweig.(Bereits 3x komplett neu aufgesetzt und komme immer wieder auf den gleichen Fehler.) Vielleicht hat jemand auf den ersten blick eine Idee und kann mir weiterhelfen: Danke im Voraus.

E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory Traceback (most recent call last):   File "cascade.py", line 15, in     from CatPreyAnalyzer.model_stages import PC_Stage, FF_Stage, Eye_Stage, Haar_Stage, CC_MobileNet_Stage   File "/home/pi/CatPreyAnalyzer/model_stages.py", line 1, in     import tensorflow as tf   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/init.py", line 98, in     from tensorflow_core import *   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/init.py", line 28, in     from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import   File "", line 1019, in _handle_fromlist   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/init.py", line 50, in getattr     module = self._load()   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow/init.py", line 44, in _load     module = _importlib.import_module(self.name)   File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/init.py", line 88, in     from tensorflow.python import keras   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/init.py", line 26, in     from tensorflow.python.keras import activations   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/init.py", line 26, in     from tensorflow.python.keras import activations   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/activations.py", line 23, in     from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/utils/init.py", line 34, in     from tensorflow.python.keras.utils.io_utils import HDF5Matrix   File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/utils/io_utils.py", line 30, in     import h5py   File "/home/pi/.local/lib/python3.7/site-packages/h5py/init.py", line 25, in     from . import _errors   File "h5py/_errors.pyx", line 1, in init h5py._errors ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject

niciBume commented 3 years ago

Hi! Habe die Fehlermeldung mal geGoogled und bin auf das gestossen. Was für eine numpy version hast du? Du kannst folgenden cmd brauchen: pip freeze | grep 'numpy' Evt. gibt es irgendwelche dependency konflikte. Ich habe numpy==1.16.2. Versuch mal diese Version.

Flo-1995 commented 3 years ago

Hi, danke für deine schnelle Antwort. numpy verwende ich ebenfalls die 1.16.2 Bei tensorflow habe ich : tensorflow-2.4.0-cp37-none-linux_armv7l.whl verwendet. (die neuste) Spielt das eine Rolle ? Protobuf habe ich manuell durchgeführt, war aber ohne Fehlermeldungen. Ich werde es morgen noch einmal von Grund auf neu aufsetzen und melde mich. Danke für die Unterstützung.

niciBume commented 3 years ago

Hmm... Also auf meinem Pi habe ich tensorflow==1.14.0 So wie es aussieht liegt dein Problem gänzlich beim import von tensorflow. Um andere Fehlerquellen zu vermeiden würde ich mich auf dies konzentrieren. Also einfach nur: python3 und dann import tensorflow as tf direkt im terminal. Ich kriege dann folgende Warnung: 2021-03-24 20:56:35.443227: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory Aber danach läuft es...