从keras.models导入load_model时出错

时间:2019-10-03 03:26:21

标签: tensorflow keras

我正在尝试在程序中加载keras(Tensorflow后端)模型。但是,导入keras时似乎立即失败:

from keras.models import load_model

下面是lldb中的调试跟踪:

    Process 26442 stopped
    * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
        frame #0: 0x0000000113915eee libtensorflow_cc.so`tensorflow::OpDef::SharedDtor() + 158
    libtensorflow_cc.so`tensorflow::OpDef::SharedDtor:
    ->  0x113915eee <+158>: jmpq   *0x8(%rax)
        0x113915ef1 <+161>: popq   %rbx
        0x113915ef2 <+162>: popq   %r14
        0x113915ef4 <+164>: popq   %rbp
    Target 0: (Python) stopped.
    (lldb) bt
    * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
      * frame #0: 0x0000000113915eee libtensorflow_cc.so`tensorflow::OpDef::SharedDtor() + 158
        frame #1: 0x0000000113915cdc libtensorflow_cc.so`tensorflow::OpDef::~OpDef() + 28
        frame #2: 0x000000012d1ba71c _pywrap_tensorflow_internal.so`_GLOBAL__sub_I_test_construction_fails_op.cc + 76
        frame #3: 0x0000000108125cc8 dyld`ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 518
        frame #4: 0x0000000108125ec6 dyld`ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40
        frame #5: 0x00000001081210da dyld`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 358
        frame #6: 0x0000000108120254 dyld`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 134
        frame #7: 0x00000001081202e8 dyld`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 74
        frame #8: 0x0000000108112d20 dyld`dyld::runInitializers(ImageLoader*) + 82
        frame #9: 0x000000010811c75f dyld`dlopen_internal + 609
        frame #10: 0x00007fff75ef05f3 libdyld.dylib`dlopen + 200
        fra

me #11: 0x00000001057dba0e Python`_PyImport_FindSharedFuncptr + 302
    frame #12: 0x00000001057b0d36 Python`_PyImport_LoadDynamicModuleWithSpec + 598
    frame #13: 0x00000001057b0799 Python`_imp_create_dynamic + 329
    frame #14: 0x00000001056d2038 Python`_PyMethodDef_RawFastCallDict + 248
    frame #15: 0x00000001056d1d21 Python`PyCFunction_Call + 209
    frame #16: 0x000000010578da08 Python`_PyEval_EvalFrameDefault + 26360
    frame #17: 0x00000001057910d6 Python`_PyEval_EvalCodeWithName + 2422

我有以下的keras和tensorflow版本:

Keras==2.2.4
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0

tensorboard==1.14.0
tensorboardX==1.8
tensorflow==1.14.0
tensorflow-estimator==1.14.0

知道我错过了什么吗?谢谢!

0 个答案:

没有答案