ماسبب ظهور الخطأ 'TypeError: __init__() got an unexpected keyword argument 'ragged في الكودالتالي:
path ="E:/keras_model.h5"from keras.models import load_model
model = load_model(path)from imutils.video importVideoStream
strem =VideoStream(usePiCamera=True)from keras.preprocessing.image import img_to_array
import cv2 as cv
import imutils
import numpy
while1:
f = strem.Read()
f = imutils.resize(f, width=600)
im = cv.resize(f,(32,32))
im = im.astype("float32")/255.0
im = img_to_array(im)
im = numpy.expand_dims(im, axis=0)(x, rb, whiteBall, none)= model.predict(image)[0]
l ="none"
p = none
if x > none and x > rb and x > wb:
l ="Fuel"
p = x
elif rb > none and rb > fuel and rb > wb:
l ="Red Ball"
p = rb
elif wb > none and wb > rb and wb > x:
l ="white ball"
p = wb
else:
l ="none"
p = none
f = cv.putText(f,"{}:{:.2f%}".format(l, p *100),(10,25),cv.FONT_HERSHEY_SIMPLEX,0.7,(0,255,0),2)
cv.imshow("Frame", f)
key = cv.waitKey(1)&0xFFif key == ord("q"):break-----------------------------------------------------------------------------------------------------------------------Traceback(most recent call last):File"/home/pi/Documents/converted_keras/keras-script.py", line 3,in<module>
model = load_model(MODEL_PATH)File"/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 492,in load_wrapper
return load_function(*args,**kwargs)File"/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 584,in load_model
model = _deserialize_model(h5dict, custom_objects, compile)File"/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 274,in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)File"/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 627,in model_from_config
return deserialize(config, custom_objects=custom_objects)File"/usr/local/lib/python3.7/dist-packages/keras/layers/__init__.py", line 168,in deserialize
printable_module_name='layer')File"/usr/local/lib/python3.7/dist-packages/keras/utils/generic_utils.py", line 147,in deserialize_keras_object
list(custom_objects.items())))File"/usr/local/lib/python3.7/dist-packages/keras/engine/sequential.py", line 301,in from_config
custom_objects=custom_objects)File"/usr/local/lib/python3.7/dist-packages/keras/layers/__init__.py", line 168,in deserialize
printable_module_name='layer')File"/usr/local/lib/python3.7/dist-packages/keras/utils/generic_utils.py", line 147,in deserialize_keras_object
list(custom_objects.items())))File"/usr/local/lib/python3.7/dist-packages/keras/engine/sequential.py", line 301,in from_config
custom_objects=custom_objects)File"/usr/local/lib/python3.7/dist-packages/keras/layers/__init__.py", line 168,in deserialize
printable_module_name='layer')File"/usr/local/lib/python3.7/dist-packages/keras/utils/generic_utils.py", line 147,in deserialize_keras_object
list(custom_objects.items())))File"/usr/local/lib/python3.7/dist-packages/keras/engine/network.py", line 1056,in from_config
process_layer(layer_data)File"/usr/local/lib/python3.7/dist-packages/keras/engine/network.py", line 1042,in process_layer
custom_objects=custom_objects)File"/usr/local/lib/python3.7/dist-packages/keras/layers/__init__.py", line 168,in deserialize
printable_module_name='layer')File"/usr/local/lib/python3.7/dist-packages/keras/utils/generic_utils.py", line 149,in deserialize_keras_object
return cls.from_config(config['config'])File"/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py", line 1179,in from_config
return cls(**config)File"/usr/local/lib/python3.7/dist-packages/keras/legacy/interfaces.py", line 91,in wrapper
return func(*args,**kwargs)TypeError: __init__() got an unexpected keyword argument 'ragged'
السؤال
Meezo ML
ماسبب ظهور الخطأ 'TypeError: __init__() got an unexpected keyword argument 'ragged في الكودالتالي:
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.