Coder Social home page Coder Social logo

chainer-nnvm-example's Introduction

Chainer-NNVM-Example

Chainer Advent Calendar 2017 - Qiitaの2017/12/19の記事です。

Chainerで学習したモデルをONNX-ChainerとNNVM/TVMを使ってAndroidへデプロイする

img

Usage

Chainerの学習済みモデルYOLOv2_tinyをONNXに変換

$ cd models/YOLOv2_tiny/
$ python export.py

macBookのCPU,GPUにデプロイする

$ python run_pc.py

AndroidのCPU,GPUにデプロイする

$ python -m tvm.exec.rpc_proxy 

Android側でRPCプロキシサーバーに接続後、以下のコマンドを実行

$ python run_mobile.py

chainer-nnvm-example's People

Contributors

tkat0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chainer-nnvm-example's Issues

ValueError: not enough values to unpack (expected 4, got 0)

はじめまして
ディープラーニングを実務で活用することを考えるとエッジでモデルを使うことが重要と感じ、スマホで動かす事にトライしております
数少ないネット上の情報ですので、非常に参考にさせて頂いております

質問です
環境構築後、run_pc.pyを実行するすると以下のエラーが出てしまいました
原因で気付くことがございましたら教えて頂けると助かります

〜〜〜〜〜〜
$ python run_pc.py
/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
WARNING:root:Attribute momentum is disabled in nnvm.sym.batch_norm
Traceback (most recent call last):
File "run_pc.py", line 46, in
graph, lib, params = nnvm.compiler.build(sym, target, {input_name: data_shape}, params=params)
File "/anaconda3/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/compiler/build_module.py", line 272, in build
graph = optimize(graph, shape, dtype, layout)
File "/anaconda3/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/compiler/build_module.py", line 169, in optimize
graph = graph.apply(["InferShape", "InferType", "AlterOpLayout"])
File "/anaconda3/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/graph.py", line 234, in apply
check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
File "/anaconda3/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/_base.py", line 75, in check_call
raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: TVMCall CFunc Error:
Traceback (most recent call last):
File "tvm/_ffi/_cython/./function.pxi", line 38, in tvm._ffi._cy3.core.tvm_callback
File "/anaconda3/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/top/nn.py", line 125, in alter_conv2d_layout
return topi.nn.conv2d_alter_layout(attrs, inputs, tinfos)
File "", line 2, in conv2d_alter_layout
File "/anaconda3/lib/python3.6/site-packages/tvm-0.2.0-py3.6-macosx-10.7-x86_64.egg/tvm/target.py", line 345, in dispatch_func
return dispatch_dict[k](*args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/topi-0.2.0-py3.6.egg/topi/x86/conv2d.py", line 141, in _alter_conv2d_layout
wkl = _get_workload(data, kernel, stride, padding, data.dtype)
File "/anaconda3/lib/python3.6/site-packages/topi-0.2.0-py3.6.egg/topi/nn/conv2d.py", line 134, in _get_workload
_, CI, IH, IW = [x.value for x in data.shape]
ValueError: not enough values to unpack (expected 4, got 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.