python编码项目中的Google可教机器模型加载问题

python编码项目中的Google可教机器模型加载问题,python,python-3.x,keras,vision,Python,Python 3.x,Keras,Vision,上下文: 1. python==3.6.6 2. Keras==2.2.4 3. tensorflow==2.1.0 4. pillow==7.0.0 import tensorflow.keras from PIL import Image, ImageOps import numpy as np # Disable scientific notation for clarity np.set_printoptions(suppress=True) # Load the mod

上下文:

 1. python==3.6.6 
 2. Keras==2.2.4
 3. tensorflow==2.1.0
 4. pillow==7.0.0
import tensorflow.keras
from PIL import Image, ImageOps
import numpy as np

# Disable scientific notation for clarity
np.set_printoptions(suppress=True)

# Load the model
model = tensorflow.keras.models.load_model('keras_model.h5')

# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array is
# determined by the first position in the shape tuple, in this case 1.
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)

# Replace this with the path to your image
image = Image.open('38.jpg')

#resize the image to a 224x224 with the same strategy as in TM2:
#resizing the image to be at least 224x224 and then cropping from the center
size = (224, 224)
image = ImageOps.fit(image, size, Image.ANTIALIAS)

#turn the image into a numpy array
image_array = np.asarray(image)

# display the resized image
image.show()

# Normalize the image
normalized_image_array = (image_array.astype(np.float32) / 127.0) - 1

# Load the image into the array
data[0] = normalized_image_array

# run the inference
prediction = model.predict(data)
print(prediction)
"/home/muhammad_abdullah/anaconda3/envs/google teachable machine/bin/python" "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py"
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)])
Traceback (most recent call last):
  File "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py", line 9, in <module>
    model = tensorflow.keras.models.load_model('keras_model.h5')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/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 "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 212, in load_model_from_hdf5
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/model_config.py", line 55, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1121, in from_config
    process_layer(layer_data)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1105, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 194, in deserialize_keras_object
    return cls.from_config(cls_config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 446, in from_config
    return cls(**config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/input_layer.py", line 80, in __init__
    raise ValueError('Unrecognized keyword arguments:', kwargs.keys())
ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

Process finished with exit code 1
当我加载在GoogleTeachable机器中训练的模型时,它会显示以下错误代码

加载模型程序代码:

 1. python==3.6.6 
 2. Keras==2.2.4
 3. tensorflow==2.1.0
 4. pillow==7.0.0
import tensorflow.keras
from PIL import Image, ImageOps
import numpy as np

# Disable scientific notation for clarity
np.set_printoptions(suppress=True)

# Load the model
model = tensorflow.keras.models.load_model('keras_model.h5')

# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array is
# determined by the first position in the shape tuple, in this case 1.
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)

# Replace this with the path to your image
image = Image.open('38.jpg')

#resize the image to a 224x224 with the same strategy as in TM2:
#resizing the image to be at least 224x224 and then cropping from the center
size = (224, 224)
image = ImageOps.fit(image, size, Image.ANTIALIAS)

#turn the image into a numpy array
image_array = np.asarray(image)

# display the resized image
image.show()

# Normalize the image
normalized_image_array = (image_array.astype(np.float32) / 127.0) - 1

# Load the image into the array
data[0] = normalized_image_array

# run the inference
prediction = model.predict(data)
print(prediction)
"/home/muhammad_abdullah/anaconda3/envs/google teachable machine/bin/python" "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py"
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)])
Traceback (most recent call last):
  File "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py", line 9, in <module>
    model = tensorflow.keras.models.load_model('keras_model.h5')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/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 "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 212, in load_model_from_hdf5
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/model_config.py", line 55, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1121, in from_config
    process_layer(layer_data)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1105, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 194, in deserialize_keras_object
    return cls.from_config(cls_config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 446, in from_config
    return cls(**config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/input_layer.py", line 80, in __init__
    raise ValueError('Unrecognized keyword arguments:', kwargs.keys())
ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

Process finished with exit code 1
错误消息:

 1. python==3.6.6 
 2. Keras==2.2.4
 3. tensorflow==2.1.0
 4. pillow==7.0.0
import tensorflow.keras
from PIL import Image, ImageOps
import numpy as np

# Disable scientific notation for clarity
np.set_printoptions(suppress=True)

# Load the model
model = tensorflow.keras.models.load_model('keras_model.h5')

# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array is
# determined by the first position in the shape tuple, in this case 1.
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)

# Replace this with the path to your image
image = Image.open('38.jpg')

#resize the image to a 224x224 with the same strategy as in TM2:
#resizing the image to be at least 224x224 and then cropping from the center
size = (224, 224)
image = ImageOps.fit(image, size, Image.ANTIALIAS)

#turn the image into a numpy array
image_array = np.asarray(image)

# display the resized image
image.show()

# Normalize the image
normalized_image_array = (image_array.astype(np.float32) / 127.0) - 1

# Load the image into the array
data[0] = normalized_image_array

# run the inference
prediction = model.predict(data)
print(prediction)
"/home/muhammad_abdullah/anaconda3/envs/google teachable machine/bin/python" "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py"
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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)])
Traceback (most recent call last):
  File "/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py", line 9, in <module>
    model = tensorflow.keras.models.load_model('keras_model.h5')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/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 "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 212, in load_model_from_hdf5
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/saving/model_config.py", line 55, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/sequential.py", line 352, in from_config
    custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 192, in deserialize_keras_object
    list(custom_objects.items())))
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1121, in from_config
    process_layer(layer_data)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1105, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/layers/serialization.py", line 89, in deserialize
    printable_module_name='layer')
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 194, in deserialize_keras_object
    return cls.from_config(cls_config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 446, in from_config
    return cls(**config)
  File "/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site-packages/tensorflow/python/keras/engine/input_layer.py", line 80, in __init__
    raise ValueError('Unrecognized keyword arguments:', kwargs.keys())
ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

Process finished with exit code 1
“/home/muhammad_abdullah/anaconda3/envs/google teachable machine/bin/python”“/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py”
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:516:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint8=np.dtype([(“qint8”,np.int8,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:517:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_quint8=np.dtype([(“quint8”,np.uint8,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:518:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint16=np.dtype([(“qint16”,np.int16,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:519:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_quint16=np.dtype([(“quint16”,np.uint16,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:520:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint32=np.dtype([(“qint32”,np.int32,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/framework/dtypes.py:525:FutureWarning:Passing(type,1)或'1type'作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
np_resource=np.dtype([(“resource”,np.ubyte,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:541:futurearning:Passing(type,1)或“1type”作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint8=np.dtype([(“qint8”,np.int8,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:542:futurearning:Passing(type,1)或“1type”作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_quint8=np.dtype([(“quint8”,np.uint8,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:543:futurearning:Passing(type,1)或“1type”作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint16=np.dtype([(“qint16”,np.int16,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:544:futurearning:Passing(type,1)或“1type”作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_quint16=np.dtype([(“quint16”,np.uint16,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:545:futurearning:Passing(type,1)或“1type”作为type的同义词不推荐使用;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
_np_qint32=np.dtype([(“qint32”,np.int32,1)])
/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorboard/compat/tensorflow_stub/dtypes.py:550:futurearning警告:不推荐将(type,1)或“1type”作为type的同义词传递;在numpy的未来版本中,它将被理解为(type,(1,)/“(1,)type”。
np_resource=np.dtype([(“resource”,np.ubyte,1)])
回溯(最近一次呼叫最后一次):
文件“/home/muhammad_abdullah/PycharmProjects/google teachable machine/main.py”,第9行,在
模型=tensorflow.keras.models.load_模型('keras_模型.h5'))
文件“/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/keras/saving/save.py”,第146行,加载模式
返回hdf5\u格式。从\u hdf5加载\u模型\u(文件路径、自定义\u对象、编译)
文件“/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/keras/saving/hdf5_format.py”,第212行,从hdf5加载
自定义对象=自定义对象)
文件“/home/muhammad_-abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/keras/saving/model_-config.py”,第55行,model_from_-config
返回反序列化(配置,自定义对象=自定义对象)
文件“/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/keras/layers/serialization.py”,第89行,反序列化
可打印\u模块\u name='layer')
文件“/home/muhammad_abdullah/anaconda3/envs/google teachable machine/lib/python3.6/site packages/tensorflow/python/keras/utils/generic_utils.py”,第192行,反序列化_keras_对象
列出(自定义)对象。