Я обучил CNN использованию Keras в Google Colab, но после загрузки модели я не могу загрузить файл hdf5
в моей локальной системе (Windows).
Я делал это раньше, и никогда не было никаких проблем.Это ошибка, которую я получаю.
Traceback (most recent call last):
File "D:/Work/binary-face-recognition/predict-test.py", line 27, in <module>
model = load_model('model.hdf5')
File "C:\Users\PARTHA.N\AppData\Local\Continuum\anaconda3\envs\face\lib\site-packages\keras\engine\saving.py", line 417, in load_model
f = h5dict(filepath, 'r')
File "C:\Users\PARTHA.N\AppData\Local\Continuum\anaconda3\envs\face\lib\site-packages\keras\utils\io_utils.py", line 186, in __init__
self.data = h5py.File(path, mode=mode)
File "C:\Users\PARTHA.N\AppData\Local\Continuum\anaconda3\envs\face\lib\site-packages\h5py\_hl\files.py", line 312, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "C:\Users\PARTHA.N\AppData\Local\Continuum\anaconda3\envs\face\lib\site-packages\h5py\_hl\files.py", line 142, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 38486016, sblock->base_addr = 0, stored_eof = 72708080)
Для загрузки модели я выполняю базовый load_model
вызов
from keras.models import load_model
model = load_model('model.hdf5')
Чтобы сохранить и загрузить модель из Google Colab, я использую следующий фрагмент.
# save model
model.save('model.hdf5')
# download model
from google.colab import files
files.download('model.hdf5')
В Google colb появляется следующая ошибка в строке files.download()
после загрузки файла.
----------------------------------------
Exception happened during processing of request from ('::ffff:172.28.0.1', 47132, 0, 0)
Traceback (most recent call last):
File "/usr/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.6/socketserver.py", line 348, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.6/socketserver.py", line 721, in __init__
self.handle()
File "/usr/lib/python3.6/http/server.py", line 418, in handle
self.handle_one_request()
File "/usr/lib/python3.6/http/server.py", line 406, in handle_one_request
method()
File "/usr/lib/python3.6/http/server.py", line 639, in do_GET
self.copyfile(f, self.wfile)
File "/usr/lib/python3.6/http/server.py", line 800, in copyfile
shutil.copyfileobj(source, outputfile)
File "/usr/lib/python3.6/shutil.py", line 82, in copyfileobj
fdst.write(buf)
File "/usr/lib/python3.6/socketserver.py", line 800, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------