README.md 2.7 KB
Newer Older
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
134
135
136
137
138
139
140
141
142
143
144
# SSD(TensorFlow2.7)测试

## 测试前准备

### 数据集准备

训练所需的ssd_weights.h5和主干的权值可以在百度云下载。

链接: https://pan.baidu.com/s/1Ddk5UcZS5Dm4qechwGJDlA

提取码: 1k5d

VOC数据集下载地址如下,里面已经包括了训练集、测试集、验证集(与测试集一样),无需再次划分:

链接: https://pan.baidu.com/s/1YuBbBKxm2FGgTU5OfaeC5A  

提取码: uack 

### python依赖包

使用Conda配置TF2.7环境,环境中包括根据whl文件安装的Tensorflow2.7和Python3.6

构建TF2的支持文件requiresments.txt

使用命令:

```
pip3 install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/
```

requiresments.txt中包括:

```
# Python dependencies required for development

astor 

astunparse 

cached-property 

cachetools 

certifi 

charset-normalizer 

dataclasses 

devscripts

distro 

flatbuffers 

gast

google-auth 

google-auth-oauthlib

google-pasta 

grpcio 

h5py 

idna 

importlib-metadata 

keras 

Keras-Applications 

Keras-Preprocessing

libclang 

Markdown 

mock 

numpy

oauthlib 

opt-einsum

packaging

portpicker 

protobuf 

pyasn1

pyasn1-modules 

pyparsing 

requests 

requests-oauthlib 

rsa 

scikit-build 

scipy 

setuptools

six

tensorboard 

tensorboard-data-server 

tensorboard-plugin-wit 

tensorflow-estimator 

tensorflow-io-gcs-filesystem 

tensorflow-model-optimization 

termcolor 

tf-models-official 

typing-extensions

urllib3 

Werkzeug

wheel 

wrapt 

zipp 

horovod
zhenyi's avatar
zhenyi committed
145
```
146
147
148
149
150
151
152
153
154
155
156
157
158
159

### 环境变量设置

```
conda activate tensorflow2.7  
source /public/software/compiler/rocm/dtk-21.10.1/env.sh  
export LD_LIBRARY_PATH=/public/software/compiler/rocm/dtk-21.10.1/roctracer/lib/:$LD_LIBRARY_PATH  
export HSA_FORCE_FINE_GRAIN_PCIE=1  
export MIOPEN_FIND_MODE=3  
export HIP_VISIBLE_DEVICES=0 
```

## 单卡测试

zhenyi's avatar
zhenyi committed
160
```
161
162
163
164
165
166
167
168
169
source activate  
conda activate tensorflow2.7  
source /public/software/compiler/rocm/dtk-21.10.1/env.sh  
export LD_LIBRARY_PATH=/public/software/compiler/rocm/dtk-21.10.1/roctracer/lib/:$LD_LIBRARY_PATH  
export HSA_FORCE_FINE_GRAIN_PCIE=1  
export MIOPEN_FIND_MODE=3  
export HIP_VISIBLE_DEVICES=0  
cd /public/home/libodi/work1/ssd-tf2-master  
python3 train32.py --dtype=fp32
zhenyi's avatar
zhenyi committed
170
```
171
172
173
174
175

执行如下代码即可进行训练

```
python3 train32.py --dtype=fp32
zhenyi's avatar
zhenyi committed
176
```
177
178
179
180

使用ssd-tf2-master/voc_annotation.py自动生成训练集和验证集,其中训练集5717 张、验证集5823张。**具体为,修改voc_annotation.py里面的annotation_mode=2,运行voc_annotation.py生成根目录下的2007_train.txt和2007_val.txt。**

使用ssd-tf2-master/trian.py进行训练,train.py中有详细的参数配置选项,如batch_size、epoch数等。