{"action":"created","issue":{"url":"https://api.github.com/repos/XiaoMi/mace/issues/117","repository_url":"https://api.github.com/repos/XiaoMi/mace","labels_url":"https://api.github.com/repos/XiaoMi/mace/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/XiaoMi/mace/issues/117/comments","events_url":"https://api.github.com/repos/XiaoMi/mace/issues/117/events","html_url":"https://github.com/XiaoMi/mace/issues/117","id":343969658,"node_id":"MDU6SXNzdWUzNDM5Njk2NTg=","number":117,"title":"c++调用deeplab-v3模型","user":{"login":"cuihuitao","id":23645894,"node_id":"MDQ6VXNlcjIzNjQ1ODk0","avatar_url":"https://avatars2.githubusercontent.com/u/23645894?v=4","gravatar_id":"","url":"https://api.github.com/users/cuihuitao","html_url":"https://github.com/cuihuitao","followers_url":"https://api.github.com/users/cuihuitao/followers","following_url":"https://api.github.com/users/cuihuitao/following{/other_user}","gists_url":"https://api.github.com/users/cuihuitao/gists{/gist_id}","starred_url":"https://api.github.com/users/cuihuitao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuihuitao/subscriptions","organizations_url":"https://api.github.com/users/cuihuitao/orgs","repos_url":"https://api.github.com/users/cuihuitao/repos","events_url":"https://api.github.com/users/cuihuitao/events{/privacy}","received_events_url":"https://api.github.com/users/cuihuitao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-07-24T10:05:11Z","updated_at":"2018-11-12T10:34:12Z","closed_at":null,"author_association":"NONE","body":"\r\n调用代码主要部分如下：\r\nmace::DeviceType device_type = mace::GPU;//CPU = 0, GPU = 2, HEXAGON = 3\r\n\r\n\tif (device_type == mace::DeviceType::GPU) \r\n\t{\r\n\t\tmace::SetGPUHints(\r\n\t\t\tstatic_cast<mace::GPUPerfHint>(3),\r\n\t\t\tstatic_cast<mace::GPUPriorityHint>(3));\r\n\t}\r\n\t\r\n\tif (device_type == mace::DeviceType::GPU) \r\n\t{\r\n\t\tstd::vector<std::string> opencl_binary_paths = {\"./opencl_binary\"};\r\n\t\t//mace::SetOpenCLBinaryPaths(opencl_binary_paths);\r\n\t}\r\n\r\n\t//1.read pb file\r\n\tstd::vector<unsigned char> model_pb_data;\r\n    if (!ReadBinaryFile(&model_pb_data, \"deeplab_v3.pb\")) \r\n    {\r\n\t\tprintf(\"=====>>>>Failed to read pb file!\\n\");\r\n\t\treturn 0;\r\n    }\r\n\t//2.create MaceEngine\r\n\tstd::shared_ptr<mace::MaceEngine> engine;\r\n    mace::MaceStatus create_engine_status;\r\n\tstd::vector<std::string> input_nodes;\r\n\tinput_nodes.push_back(std::string(\"sub_7\"));\r\n\tstd::vector<std::string> output_nodes;\r\n\toutput_nodes.push_back(std::string(\"ResizeBilinear_2\"));\r\n\tstd::cout << \"=====>>>>>start to CreateMaceEngineFromProto\" << \"\\n\";\r\n    create_engine_status = CreateMaceEngineFromProto(model_pb_data,std::string(\"deeplab_v3.data\"),input_nodes\r\n\t,output_nodes,device_type,&engine);\r\n\tif (create_engine_status != mace::MaceStatus::MACE_SUCCESS) \r\n\t{\r\n    \tstd::cout << \"Create engine error, please check the arguments\";\r\n\t\treturn 0;\r\n  \t}\r\n\tstd::cout << \"=====>>>>>end to CreateMaceEngineFromProto\" << \"\\n\";\r\n\t//3.load input data\r\n    std::cout << \"====>>start to load input data\" << \"\\n\";\r\n\tstd::vector<int64_t> input_shapes = {1,513,513,3};\r\n\tint64_t input_size =std::accumulate(input_shapes.begin(), input_shapes.end(), 1,std::multiplies<int64_t>());\r\n\tauto buffer_in = std::shared_ptr<float>(new float[input_size],std::default_delete<float[]>());\r\n\tstd::ifstream in_file(\"dog.npy\",std::ios::in | std::ios::binary);\r\n    if (in_file.is_open()) \r\n\t{\r\n      in_file.read(reinterpret_cast<char *>(buffer_in.get()),input_size * sizeof(float));\r\n      in_file.close();\r\n    } else \r\n\t{\r\n      std::cout << \"Open input file failed\";\r\n      return -1;\r\n    }\r\n\tstd::map<std::string, mace::MaceTensor> inputs;\r\n\tinputs[\"sub_7\"] = mace::MaceTensor(input_shapes, buffer_in);\r\n\t//4.output buffer\r\n\tstd::vector<int64_t> output_shapes = {1,65,65,21};\r\n\t int64_t output_size = std::accumulate(output_shapes.begin(), output_shapes.end(), 1,std::multiplies<int64_t>());\r\n    auto buffer_out = std::shared_ptr<float>(new float[output_size],std::default_delete<float[]>());\r\n\tstd::map<std::string, mace::MaceTensor> outputs;\r\n    outputs[\"ResizeBilinear_2\"] = mace::MaceTensor(output_shapes, buffer_out);\r\n\t//run Model\r\n\tstruct timeval tm_before,tm_after;\r\n\tgettimeofday(&tm_before,NULL);\r\n    engine->Run(inputs, &outputs);\r\n\tgettimeofday(&tm_after,NULL);\r\n\r\n报错如下：../mace/kernels/opencl/helper.cc:339] Check failed: error == CL_SUCCESS error: CL_INVALID_WORK_GROUP_SIZE。  Aborted (core dumped)；\r\n\r\n\r\n求解答！\r\n"},"comment":{"url":"https://api.github.com/repos/XiaoMi/mace/issues/comments/437831857","html_url":"https://github.com/XiaoMi/mace/issues/117#issuecomment-437831857","issue_url":"https://api.github.com/repos/XiaoMi/mace/issues/117","id":437831857,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzgzMTg1Nw==","user":{"login":"terryzhangthu","id":14011589,"node_id":"MDQ6VXNlcjE0MDExNTg5","avatar_url":"https://avatars3.githubusercontent.com/u/14011589?v=4","gravatar_id":"","url":"https://api.github.com/users/terryzhangthu","html_url":"https://github.com/terryzhangthu","followers_url":"https://api.github.com/users/terryzhangthu/followers","following_url":"https://api.github.com/users/terryzhangthu/following{/other_user}","gists_url":"https://api.github.com/users/terryzhangthu/gists{/gist_id}","starred_url":"https://api.github.com/users/terryzhangthu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terryzhangthu/subscriptions","organizations_url":"https://api.github.com/users/terryzhangthu/orgs","repos_url":"https://api.github.com/users/terryzhangthu/repos","events_url":"https://api.github.com/users/terryzhangthu/events{/privacy}","received_events_url":"https://api.github.com/users/terryzhangthu/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T10:34:12Z","updated_at":"2018-11-12T10:34:12Z","author_association":"NONE","body":"多谢回复，输入的Sub_7也不是直接传原图数据的float型吧？请问有如何处理数据的参考代码么？"}}
{"actor":{"display_login":"terryzhangthu"}}