Very inaccurate output values for ResNet18 on Raspberry Pi Zero W

Running this tutorial’s script seems to produce inaccurate output values for Raspberry Pi Zero W:
https://docs.tvm.ai/tutorials/frontend/deploy_model_on_rasp.html#sphx-glr-tutorials-frontend-deploy-model-on-rasp-pyhttps://github.com/dmlc/tvm/issues/3818#issue-483807195

It works fine for my local machine (setting local_demo = False ):

File /home/std/.tvm_test_data/data/cat.png exists, skip.
exist file got corrupted, downloading /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt file freshly...
Downloading from url https://gist.githubusercontent.com/zhreshold/4d0b62f3d01426887599d4f7ede23ee5/raw/596b27d23537e5a1b5751d2b0481ef172f58b539/imagenet1000_clsid_to_human.txt to /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt

...26%, 0.01 MB, 37 KB/s, 0 seconds passed
...53%, 0.02 MB, 64 KB/s, 0 seconds passed
...80%, 0.02 MB, 96 KB/s, 0 seconds passed
...100%, 0.03 MB, 127 KB/s, 0 seconds passed
TVM prediction top-1: tiger cat

And works fine for a NVIDIA Jetson TX2:

File /home/std/.tvm_test_data/data/cat.png exists, skip.
exist file got corrupted, downloading /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt file freshly...
Downloading from url https://gist.githubusercontent.com/zhreshold/4d0b62f3d01426887599d4f7ede23ee5/raw/596b27d23537e5a1b5751d2b0481ef172f58b539/imagenet1000_clsid_to_human.txt to /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt

...26%, 0.01 MB, 20 KB/s, 0 seconds passed
...53%, 0.02 MB, 36 KB/s, 0 seconds passed
...80%, 0.02 MB, 55 KB/s, 0 seconds passed
...100%, 0.03 MB, 73 KB/s, 0 seconds passed
TVM prediction top-1: tiger cat

But not for the Raspberry Pi Zero W:

File /home/std/.tvm_test_data/data/cat.png exists, skip.
exist file got corrupted, downloading /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt file freshly...
Downloading from url https://gist.githubusercontent.com/zhreshold/4d0b62f3d01426887599d4f7ede23ee5/raw/596b27d23537e5a1b5751d2b0481ef172f58b539/imagenet1000_clsid_to_human.txt to /home/std/.tvm_test_data/data/imagenet1000_clsid_to_human.txt

...26%, 0.01 MB, 67 KB/s, 0 seconds passed
...53%, 0.02 MB, 120 KB/s, 0 seconds passed
...80%, 0.02 MB, 175 KB/s, 0 seconds passed
...100%, 0.03 MB, 232 KB/s, 0 seconds passed
TVM prediction top-1: colobus, colobus monkey

There’s no problem for this tutorial though for the Raspberry Pi Zero W.
https://docs.tvm.ai/tutorials/cross_compilation_and_rpc.html

Output of cat /proc/cpu/info on Raspberry Pi Zero W:

processor	: 0
model name	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 697.95
Features	: half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2835
Revision	: 9000c1
Serial		: 0000000014881f47

Output of gcc -v :

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 6.3.0 20170516 (Raspbian 6.3.0-18+rpi1+deb9u1) 
1 Like

I am trying to run ResNet18 on Raspberry Pi Zero W. But couldn’t upload the model and received TVMError: Check failed: code == RPCCode :: kReturn : code =1. Btw how did you changed the target? I just edited model in below line to be bcm2835 target = tvm.target.Target(‘llvm -device=arm_cpu -model=bcm2837 -mtriple=armv7l-linux-gnueabihf -mattr=+neon’) . Is it sufficient ?121049735_803943920430395_5015573025255569042_n