Код: Выделить всё
ValueError Traceback (most recent call last)
Cell In[4], line 8
5 import cv2
6 from scipy import ndimage
----> 8 classifier=load_model('cnn_svhn.model')
File ~\AppData\Roaming\Python\Python312\site-packages\keras\src\saving\saving_api.py:193, in load_model(filepath, custom_objects, compile, safe_mode)
187 raise ValueError(
188 f"File not found: filepath={filepath}. "
189 "Please ensure the file is an accessible `.keras` "
190 "zip file."
191 )
192 else:
--> 193 raise ValueError(
194 f"File format not supported: filepath={filepath}. "
195 "Keras 3 only supports V3 `.keras` files and "
196 "legacy H5 format files (`.h5` extension). "
197 "Note that the legacy SavedModel format is not "
198 "supported by `load_model()` in Keras 3. In "
199 "order to reload a TensorFlow SavedModel as an "
200 "inference-only layer in Keras 3, use "
201 "`keras.layers.TFSMLayer("
202 f"{filepath}, call_endpoint='serving_default')` "
203 "(note that your `call_endpoint` "
204 "might have a different name)."
205 )
ValueError: File format not supported: filepath=cnn_svhn.model. Keras 3 only supports V3 `.keras` files and legacy H5 format files (`.h5` extension). Note that the legacy SavedModel format is not supported by `load_model()` in Keras 3. In order to reload a TensorFlow SavedModel as an inference-only layer in Keras 3, use `keras.layers.TFSMLayer(cnn_svhn.model, call_endpoint='serving_default')` (note that your `call_endpoint` might have a different name).
Код: Выделить всё
from keras.models import load_model
import numpy as np
from matplotlib import pyplot as plt
import cv2
from scipy import ndimage
classifier=load_model('cnn_svhn.model')

Подробнее здесь: https://stackoverflow.com/questions/786 ... ras-and-h5