-
-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (113 loc) · 4.9 KB
/
main.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "00 7 * * 6" # Run every saturday on 7:00 UTC
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
convert:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Intel OpenVINO
run: |
python3 -m pip install --upgrade pip
python3 -m pip install openvino-dev[tensorflow]==2022.3
- name: Clone AutoML
run: |
git clone https://github.com/google/automl
cd automl
python3 -m pip install cython
git log --pretty=oneline | head -25
python3 -m pip install -r efficientdet/requirements.txt
python3 -m pip install tensorflow-model-optimization
python3 -m pip freeze
- name: Download checkpoints
run: |
cd automl/efficientdet
for version in d0 d4; do
wget https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-${version}.tar.gz
tar -xf efficientdet-${version}.tar.gz
done
- name: Freeze graph
run: |
cd automl/efficientdet
for version in d0 d4; do
python3 model_inspect.py \
--runmode=saved_model \
--model_name=efficientdet-${version} \
--ckpt_path=efficientdet-${version} \
--saved_model_dir=savedmodeldir-${version}
done
- name: Create IR
run: |
python3 -m pip install networkx defusedxml test-generator===0.1.1
export MO_DIR=$(dirname $(python3 -c "import openvino; print(openvino.__file__)"))/tools/mo
versions=(d0 d4)
sizes=(512 1024)
for (( i=0; i<2; i++ )); do
version=${versions[$i]}
size=${sizes[$i]}
mo \
--input_model automl/efficientdet/savedmodeldir-${version}/efficientdet-${version}_frozen.pb \
--transformations_config $MO_DIR/front/tf/automl_efficientdet.json \
--input_shape "[1, ${size}, ${size}, 3]" \
--model_name efficientdet-${version} \
--output_dir efficientdet-${version}-FP32 --data_type FP32
mo \
--input_model automl/efficientdet/savedmodeldir-${version}/efficientdet-${version}_frozen.pb \
--transformations_config $MO_DIR/front/tf/automl_efficientdet.json \
--input_shape "[1, ${size}, ${size}, 3]" \
--model_name efficientdet-${version} \
--output_dir efficientdet-${version}-FP16 --data_type FP16
done
- name: Validate IR
run: |
versions=(d0 d4)
sizes=(512 1024)
for (( i=0; i<2; i++ )); do
version=${versions[$i]}
size=${sizes[$i]}
echo "-------- Validate efficientdet-${version} FP32 IR --------"
ln -sf efficientdet-${version}-FP32/efficientdet-${version}.bin ./efficientdet-${version}.bin
ln -sf efficientdet-${version}-FP32/efficientdet-${version}.xml ./efficientdet-${version}.xml
python3 scripts/validate.py --version ${version} --width ${size} --height ${size} 2>&1 | grep -iv cuda || exit 1
rm -f ./efficientdet-${version}.xml
rm -f ./efficientdet-${version}.bin
echo "-------- Validate efficientdet-${version} FP16 IR --------"
ln -sf efficientdet-${version}-FP16/efficientdet-${version}.bin ./efficientdet-${version}.bin
ln -sf efficientdet-${version}-FP16/efficientdet-${version}.xml ./efficientdet-${version}.xml
python3 scripts/validate.py --version ${version} --width ${size} --height ${size} --fp16 2>&1 | grep -iv cuda || exit 1
rm -f ./efficientdet-${version}.xml
rm -f ./efficientdet-${version}.bin
done
- uses: actions/upload-artifact@v2
with:
name: efficientdet-d0
path: |
efficientdet-d0-FP16/efficientdet-d0.bin
efficientdet-d0-FP16/efficientdet-d0.xml
efficientdet-d0-FP32/efficientdet-d0.xml
efficientdet-d0-FP32/efficientdet-d0.xml
- uses: actions/upload-artifact@v2
with:
name: efficientdet-d4
path: |
efficientdet-d4-FP16/efficientdet-d4.bin
efficientdet-d4-FP16/efficientdet-d4.xml
efficientdet-d4-FP32/efficientdet-d4.bin
efficientdet-d4-FP32/efficientdet-d4.xml