summaryrefslogtreecommitdiff
path: root/acl_openailab/installation.md
blob: 340ea74d59e72a98a33531e9f72e582036d2f25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# 1. User Quick Guide
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)

This Installation will help you get started to setup Caffe-HRT on RK3399 quickly.

# 2. Preparation
## 2.1 General dependencies installation
	sudo apt-get install git cmake scons protobuf-compiler libgflags-dev libgoogle-glog-dev 
	sudo apt-get install libblas-dev libhdf5-serial-dev liblmdb-dev libleveldb-dev 
	sudo apt-get install liblapack-dev libsnappy-dev python-numpy 
	sudo apt-get install libprotobuf-dev libopenblas-dev libgtk2.0-dev
	sudo apt-get install python-yaml python-numpy python-scipy python-six
	
	sudo apt-get install --no-install-recommends libboost-all-dev

## 2.2 Download source code

	cd ~
	
#### Download "OpenCV" 
	wget --no-check-certificate https://github.com/opencv/opencv/archive/3.3.0.tar.gz
	tar -xvf 3.3.0.tar.gz
#### Download "gen-pkg-config-pc" 
	wget ftp://ftp.openailab.net/tools/script/gen-pkg-config-pc.sh
	chmod +x ./gen-pkg-config-pc.sh
#### Download "ACL" 
	git clone https://github.com/ARM-software/ComputeLibrary.git
	git checkout 48bc34e
#### Download "Caffe-HRT" :
	git clone https://github.com/OAID/Caffe-HRT.git
#### Download "Googletest" :
	git clone https://github.com/google/googletest.git

# 3. Build Caffe-HRT

## 3.1 Build OpenCV :
	cd ~/opencv-3.3.0
	mkdir build
	cd build
	cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/AID/opencv3.3.0 ..
	sudo make install
	sudo ~/gen-pkg-config-pc.sh /usr/local/AID
	
## 3.2 Build ACL :
	cd ~/ComputeLibrary
	mkdir build
    aarch64-linux-gnu-gcc opencl-1.2-stubs/opencl_stubs.c -Iinclude -shared -o build/libOpenCL.so
	scons Werror=1 -j4 debug=0 asserts=1 neon=1 opencl=1 embed_kernels=1 os=linux arch=arm64-v8a
	wget ftp://ftp.openailab.net/tools/script/Computelibrary/Makefile
	sudo make install
	sudo ~/gen-pkg-config-pc.sh /usr/local/AID

## 3.3 Build Caffe :
	cd ~/Caffe-HRT
	make all
	make distribute
	sudo make install
	sudo ~/gen-pkg-config-pc.sh /usr/local/AID

## 3.4 Build Unit tests
##### Build the gtest libraries
	cd ~/googletest
	cmake -D CMAKE_INSTALL_PREFIX=/usr/local/AID/googletest CMakeLists.txt
	make
	sudo make install

##### Build Caffe Unit tests
	cd ~/Caffe-HRT/unit_tests
	make clean
	make

## 3.5 To Configure The Libraries
	sudo ~/gen-pkg-config-pc.sh /usr/local/AID

# 4. Run tests

#### 4.1 Run Caffenet
	cd  ~/Caffe-HRT/data/ilsvrc12
	sudo chmod +x get_ilsvrc_aux.sh
	./get_ilsvrc_aux.sh
	cd ../..
	./scripts/download_model_binary.py ./models/bvlc_reference_caffenet
	./distribute/bin/classification.bin models/bvlc_reference_caffenet/deploy.prototxt models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel data/ilsvrc12/imagenet_mean.binaryproto data/ilsvrc12/synset_words.txt examples/images/cat.jpg
	output message --
	  ---------- Prediction for examples/images/cat.jpg ----------
	  0.3094 - "n02124075 Egyptian cat"
	  0.1761 - "n02123159 tiger cat"
	  0.1221 - "n02123045 tabby, tabby cat"
	  0.1132 - "n02119022 red fox, Vulpes vulpes"
	  0.0421 - "n02085620 Chihuahua"

#### 4.2 Run Unit test
	  cd ~/Caffe-HRT/unit_tests
	  ./test_caffe_main
	  output message:
	    [==========] 29 tests from 6 test cases ran. (1236 ms total) [ PASSED ] 29 tests.