неизвестная ошибка слоя при загрузке модели H5 - PullRequest
0 голосов
/ 26 апреля 2020

Я тренировал свою модель с обучаемой машины (https://teachablemachine.withgoogle.com/). когда я пытаюсь загрузить модель, это дает мне «неизвестный слой: имя».

import tensorflow.python.keras
model = tensorflow.keras.models.load_model('keras_model.h5')

Я искал решения для использования custom_objects. поэтому я попытался, что это дает мне NameError: имя 'имя' не определено.

import tensorflow.python.keras
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:469: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:470: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:471: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:472: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:473: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Farhan\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:476: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
>>> model = tensorflow.keras.models.load_model('keras_model.h5', custom_objects={'name': name})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'name' is not defined

Существует решение, которое инструктирует импортировать имя слоя из файла. а затем использовать его. но обучаемая машина не давала мне никаких файлов. просто сохраненная модель. Может кто-нибудь помочь мне

...