jetpacapp / DeepBeliefSDK

The SDK for Jetpac's iOS Deep Belief image recognition framework
Other
2.86k stars 437 forks source link

problem with test output #35

Open vodp opened 9 years ago

vodp commented 9 years ago

Hi,

I just tried your SDK. After downloading it, I extracted and enter $HOME/src in order to compile it: sudo make TARGET=pi GEMM=piqpu

Then I copied the two files jpcnn and libjpcnn.so into the directory $HOME/LinuxLibrary. Then run sudo ./install.sh. Fine!

Now I compiled the example with Linux and run it to test the lena image. The output is somehow strange, since everything is zero except that the class Euopean hoopoe. I tried several other images and get the same result.

A snippet of the output:

790 0.000000 maze 791 0.000000 pajama 792 0.000000 purse 793 0.000000 parachute 794 0.000000 matchstick 795 0.000000 puffer 796 0.000000 swimming trunks 797 0.000000 volcano 798 0.000000 ptarmigan 799 0.000000 armadillo 800 0.000000 cuirass 801 0.000000 frying pan 802 0.000000 scale 803 0.000000 leatherback turtle 804 0.000000 chainlink fence 805 0.000000 tile roof 806 0.000000 pretzel 807 0.000000 burrito 808 0.515223 Euopean hoopoe 809 0.000000 cassette 810 0.000000 maraca 811 0.000000 rule 812 0.000000 jersey 813 0.000000 sunscreen 814 0.000000 espresso 815 0.000000 vase 816 0.000000 gorilla 817 0.000000 spider monkey

Do you have any idea?

petewarden commented 9 years ago

Sorry you're hitting problems. This looks like the QPU code is failing silently somehow and returning bogus results. I've occasionally run into problems like this, but rebooting the Pi always seemed to fix it. If that doesn't work, you might need to try debugging the QPU access on your device. One way to do that is uncomment the test_gpu_gemm() call here: https://github.com/jetpacapp/DeepBeliefSDK/blob/15831fe5b5f51e66b6979433ca69e54ad5cc092c/source/src/lib/libjpcnn.cpp#L32

vodp commented 9 years ago

Rebooting does not help. I try to update the firmware (rpi-update) and re-build the library with the uncommented line of test_gpu_gemm(). The output seems problematic:

Buffer None - (384, 33), 8 bits per element, range (-0.393412-0.419856) : [[-0.3934119940, -0.3934119940, -0.3902351558, -0.3934119940..., -0.3934119940, -0.3457595706, -0.3934119940, -0.0026621222], [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222], [-0.3425827324, -0.3934119940, -0.3394059241, -0.3934119940..., -0.3934119940, -0.2949303389, -0.3934119940, -0.0026621222], [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222], ... [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222], [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222], [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222], [-0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222..., -0.0026621222, -0.0026621222, -0.0026621222, -0.0026621222]] 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0008, 0009, 000a, 000b, 000c, 000d, 000e, 000f Buffer outputCPU - (169, 384), 32 bits per element, range (0.000000-1.000000) : [[-6.2896776199, -0.0452391692, -5.8997416496, -0.0452391692..., -0.0452391692, -0.0452391692, -0.0452391692, -0.0452391692], [-6.2788891792, -0.0453577787, -5.7985749245, -0.0453577787..., -0.0453577787, -0.0453577787, -0.0453577787, -0.0453577787], [-7.2888879776, -0.0525493808, -6.8466563225, -0.0525493808..., -0.0525493808, -0.0525493808, -0.0525493808, -0.0525493808], [-6.3596019745, -0.0449345298, -5.9353032112, -0.0449345298..., -0.0449345298, -0.0449345298, -0.0449345298, -0.0449345298], ... [-4.8347711563, -0.0339521281, -4.5305986404, -0.0339521281..., -0.0339521281, -0.0339521281, -0.0339521281, -0.0339521281], [-7.3372507095, -0.0515110083, -6.8083953857, -0.0515110083..., -0.0515110083, -0.0515110083, -0.0515110083, -0.0515110083], [-6.5349278450, -0.0481614843, -6.0595965385, -0.0481614843..., -0.0481614843, -0.0481614843, -0.0481614843, -0.0481614843], [-6.6127810478, -0.0474724472, -6.1896333694, -0.0474724472..., -0.0474724472, -0.0474724472, -0.0474724472, -0.0474724472]] Buffers contained 100.000000% different values (64896), mean delta = 0.162606 - Buffer outputCPU - (169, 384), 32 bits per element, range (0.000000-1.000000) vs Buffer outputGPU - (169, 384), 32 bits per element, range (0.000000-1.000000) deepbelief: src/lib/pi/qpu_gemm.cpp:448: void test_qpu_gemm(): Assertion `buffer_are_all_close(outputCPU, outputGPU)' failed.

In order to check that the GPU works, I try the first tutorial here (https://rpiplayground.wordpress.com/2014/05/03/hacking-the-gpu-for-fun-and-profit-pt-1/). The output is correct. So maybe running GEMM on my RPi's GPU meets problems ?


Ps: I further tried with pi-gemm () and got the following output: QPU took 350ms ATLAS took 5551ms Buffers contained 98.628098% different values (286416), mean delta = 0.000055 - Buffer outputCPU - (3025, 96) vs Buffer outputGPU - (3025, 96) Buffers contained 98.628098% different values (286416), mean delta = 0.000055 - Buffer outputAtlas - (3025, 96) vs Buffer outputGPU - (3025, 96)