apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.77k stars 6.8k forks source link

Run pretrained model on android #15265

Open sheep94lion opened 5 years ago

sheep94lion commented 5 years ago

Description

I want to run mxnet on android for inference with a pretrained model. I have build the libmxnet.so with ./build.py -p android_armv8. What should I do next?

Environment info (Required)

----------Python Info---------- Version : 3.7.3 Compiler : GCC 7.3.0 Build : ('default', 'Mar 27 2019 22:11:17') Arch : ('64bit', '') ------------Pip Info----------- Version : 19.0.3 Directory : /home/yizhao/anaconda3/lib/python3.7/site-packages/pip ----------MXNet Info----------- Hashtag not found. Not installed from pre-built package. ----------System Info---------- Platform : Linux-4.18.0-21-generic-x86_64-with-debian-buster-sid system : Linux node : pop-os release : 4.18.0-21-generic version : #22-Ubuntu SMP Wed May 15 13:13:21 UTC 2019 ----------Hardware Info---------- machine : x86_64 processor : x86_64 Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 12 On-line CPU(s) list: 0-11 Thread(s) per core: 2 Core(s) per socket: 6 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Stepping: 10 CPU MHz: 3880.857 CPU max MHz: 4100.0000 CPU min MHz: 800.0000 BogoMIPS: 4416.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 9216K NUMA node0 CPU(s): 0-11 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d ----------Network Test---------- Setting timeout: 10 Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0093 sec, LOAD: 2.6462 sec. Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.2073 sec, LOAD: 1.8427 sec. Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0917 sec, LOAD: 1.5550 sec. Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.3904 sec, LOAD: 2.6636 sec. Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0080 sec, LOAD: 6.3505 sec. Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.1671 sec, LOAD: 2.4808 sec.

Package used (Python/R/Scala/Julia): I'm using android

Build info (Required if built from source)

Compiler (gcc/clang/mingw/visual studio): I build with ci/build.py -p android_armv8

MXNet commit hash: b8b352d55bafed2910e5771d33982dea78989454

Build config: ci/build.py -p android_armv8

What have you tried to solve it?

1. 2.

mxnet-label-bot commented 5 years ago

Hey, this is the MXNet Label Bot. Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.

larroy commented 5 years ago

There are some java bindings in the amalgamation folder that you could use with this artifact, I would suggest trying that and report your findings. If you can contribute some improvements in that direction either by code or improving the docs it would be greatly appreciated 🙏

sheep94lion commented 5 years ago

With the libmxnet.so built by command ci/build.py -p android_armv8, I succeeded to run a resnet-18 image classification network on a pixel 3. I followed the C example from this I run it as native code in an android application. I am happy to provide some help to the people with the same question. I will organize the steps I did and put them on github together with my working code later.

leleamol commented 5 years ago

@sheep94lion Thank you very much for your response. It would be great help to the community if you could put together a README file with steps and create a PR for this repository.

@mxnet-label-bot add [Android, Call for Contribution]

fsaina commented 5 years ago

@sheep94lion would you please provide some help how you managed to do that ? I would be very much grateful if you could share the path you took in order to get mxnet working on android.