错误输出为:
Traceback (most recent call last): File "/home/hans/WorkSpace/Rand2AI/CoreDL/Model/Detector/PSENet/PSENet_test.py", line 120, in <module> net.deviceModel.save('/home/hans/WorkSpace/MODEL/PSENet_Model.h5') File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/network.py", line 1090, in save save_model(self, filepath, overwrite, include_optimizer) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/saving.py", line 382, in save_model _serialize_model(model, f, include_optimizer) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/saving.py", line 83, in _serialize_model model_config['config'] = model.get_config() File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/network.py", line 931, in get_config return copy.deepcopy(config) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 215, in _deepcopy_list append(deepcopy(a, memo)) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in <listcomp> y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in <listcomp> y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 169, in deepcopy rv = reductor(4) TypeError: can't pickle module objects
您好,首先感谢您开源PSENet的训练和测试代码和模型。
我想把模型和权重一起保存,也就是用keras中Model.save()这个接口,但是遇到了问题。能麻烦帮忙看一下嘛。谢谢!
系统是Ubuntu16.04 IDE是pycharm 专业版 python版本是3.6.8 keras版本是2.2.4 tensorflow版本是1.13.1
错误输出为:
Traceback (most recent call last): File "/home/hans/WorkSpace/Rand2AI/CoreDL/Model/Detector/PSENet/PSENet_test.py", line 120, in <module> net.deviceModel.save('/home/hans/WorkSpace/MODEL/PSENet_Model.h5') File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/network.py", line 1090, in save save_model(self, filepath, overwrite, include_optimizer) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/saving.py", line 382, in save_model _serialize_model(model, f, include_optimizer) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/saving.py", line 83, in _serialize_model model_config['config'] = model.get_config() File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/site-packages/keras/engine/network.py", line 931, in get_config return copy.deepcopy(config) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 215, in _deepcopy_list append(deepcopy(a, memo)) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in <listcomp> y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 220, in <listcomp> y = [deepcopy(a, memo) for a in x] File "/home/hans/WorkSpace/venv/Rand2AI/lib/python3.6/copy.py", line 169, in deepcopy rv = reductor(4) TypeError: can't pickle module objects