-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathface_detection_prereqs.yml
109 lines (94 loc) · 2.55 KB
/
face_detection_prereqs.yml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
---
- hosts: all
become: true
vars:
tmp_path: "/home/odroid/setup/download"
opencv_version: 4.7.0
python_packages:
- name: opencv-python
version: latest
tasks:
- name: Check if swapfile exists
stat:
path: /swapfile
register: swapfile_check
- name: Create 4GB swapfile
command: fallocate -l 4G /swapfile
when: swapfile_check.stat.exists == False
register: fallocate_result
ignore_errors: true
- name: Set up the swapfile
command: mkswap /swapfile
when: fallocate_result.changed
- name: Enable the swapfile
command: swapon /swapfile
when: fallocate_result.changed
- name: Install developer and compile tools
apt:
name:
- build-essential
- cmake
- git
- pkg-config
- unzip
- python3-dev
- libopenblas-dev
- liblapack-dev
- libx11-dev
- libgtk-3-dev
- libatlas-base-dev
- libboost-python-dev
state: latest
- name: Create tmp directory
file:
path: "{{ tmp_path }}"
state: directory
- name: Install python packages
pip:
name: "{{ item.name }}"
version: "{{ item.version }}"
executable: pip3
with_items: "{{ python_packages }}"
notify:
- test python packages
- name: Install mediapipe
pip:
name: "mediapipe-rpi4"
executable: pip3
- name: Download and unzip OpenCV
unarchive:
src: "https://github.com/opencv/opencv/archive/{{ opencv_version }}.zip"
dest: "{{ tmp_path }}"
copy: no
- name: Create build directory
file:
path: "{{ tmp_path }}/opencv-{{ opencv_version }}/build"
state: directory
- name: Make the opencv build artifacts
shell: |
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D WITH_TBB=ON \
-D WITH_OPENMP=ON \
-D WITH_NEON=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON {{ tmp_path }}/opencv-{{ opencv_version }}
args:
chdir: "{{ tmp_path }}/opencv-{{ opencv_version }}/build"
executable: /bin/bash
- name: Disable the swapfile
command: swapoff -av
- name: Remove the swapfile
command: rm -f /swapfile
handlers:
- name: test python packages
command: python3 -c "import {{ item.name }}"
with_items: "{{ python_packages }}"
register: test_results
notify: print test results
- name: print test results
debug:
msg: "{{ test_results }}"