PaddlePaddle / Mobile

Embedded and Mobile Deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

capi加载模型出错mapGet(type, creatorMap_, &creator) Unknown class type: data

realsnake opened this issue · comments

ar_infer.paddle.zip
我使用了merge_model 生成了.paddle文件以供capi加载

init没报错应该是成功了,paddle_gradient_machine_create_for_inference_with_parameters报错了,传入的参数buf无为空,size对比模型文件本身大小是一致的,错误log如下:

I0109 20:28:47.075923 3058023296 Util.cpp:166] commandline:  --use_gpu=False --pool_limit_size=0 
F0109 20:28:58.992383 3058023296 ClassRegistrar.h:65] Check failed: mapGet(type, creatorMap_, &creator) Unknown class type: data
*** Check failure stack trace: ***
2018-01-09 20:28:59.041616+0800 IphoneCom[3630:2417368] Task <A23BCE12-DE2B-4E27-92CD-C29598C63E49>.<2> finished with error - code: -1001
2018-01-09 20:28:59.047358+0800 IphoneCom[3630:2417138] TIC TCP Conn Failed [2:0x1c0176500]: 3:-9802 Err(-9802)
2018-01-09 20:28:59.048243+0800 IphoneCom[3630:2417138] Task <A23BCE12-DE2B-4E27-92CD-C29598C63E49>.<2> HTTP load failed (error code: -999 [1:89])
    @        0x1059942e0  google::LogMessage::Fail()
    @        0x105993408  google::LogMessage::SendToLog()
    @        0x105993bdc  google::LogMessage::Flush()
    @        0x1059971b4  google::LogMessageFatal::~LogMessageFatal()
    @        0x105994620  google::LogMessageFatal::~LogMessageFatal()
    @        0x105918f10  _ZN6paddle14ClassRegistrarINS_5LayerEJNS_11LayerConfigEEE12createByTypeERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEES2_
    @        0x105918d94  paddle::Layer::create()
    @        0x10591a75c  paddle::NeuralNetwork::init()::$_0::operator()()
    @        0x10591a010  paddle::NeuralNetwork::init()
    @        0x10591f250  paddle::GradientMachine::create()
    @        0x105917410  paddle_gradient_machine_create_for_inference_with_parameters
    @        0x1043e0548  init_machine()
    @        0x1043e0280  -[BNLocationManager init]
    @        0x1043dff10  +[BNLocationManager GetInstance]
    @        0x104520878  +[BNCoreServices LocationService]
    @        0x10451c988  -[BNCoreServices doAfterInitEngine]
    @        0x1045195bc  __40-[BNCoreServices startSericesAsyn:fail:]_block_invoke_2
    @        0x10f87d2cc  _dispatch_call_block_and_release
    @        0x10f87d28c  _dispatch_client_callout
    @        0x10f881ea0  _dispatch_main_queue_callback_4CF
    @        0x1851b2544  <redacted>
    @        0x1851b0120  <redacted>
    @        0x1850cfe58  CFRunLoopRunSpecific
    @        0x186f7cf84  GSEventRunModal
    @        0x18e74f67c  UIApplicationMain
    @        0x102ee0c30  main
    @        0x184bec56c  <redacted>

你好,上述错误应该是没有正确地链接Paddle库。请问你的链接方式是?

target_link_libraries(${PROJECT_NAME}
-Wl,--start-group -Wl,--whole-archive -lpaddle_capi_layers
-Wl,--no-whole-archive -lpaddle_capi_engine -Wl,--end-group
${THIRD_PARTY_LIBRARYS}
log)

无论参考哪个,都需要保证-Wl,--whole-archive -lpaddle_capi_layers,即使用whole-archive链接libpaddle_capi_layers.a

仔细看了下log,貌似你是在iOS App中使用Paddle?那么Paddle的链接方式请参考:https://github.com/PaddlePaddle/Mobile/blob/develop/Demo/iOS/AICamera/README_cn.md#%E5%A6%82%E4%BD%95%E9%93%BE%E6%8E%A5paddlepaddle%E5%BA%93

需要配置-force_load链接libpaddle_capi_layers.a

恩,是这个问题,已解决多谢!