Skip to content

Commit 2e2d756

Browse files
Update README.md - mivisionx_inference_analyzer (#501)
* Update README.md * Readme Updates - Codacy fix Co-authored-by: Kiriti Gowda <[email protected]>
1 parent a991813 commit 2e2d756

File tree

1 file changed

+57
-51
lines changed

1 file changed

+57
-51
lines changed

apps/mivisionx_inference_analyzer/README.md

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ MIVisionX provides developers with [docker images](https://hub.docker.com/u/mivi
5252

5353
* Start docker with display
5454

55-
```
56-
% sudo docker pull mivisionx/ubuntu-16.04:latest
57-
% xhost +local:root
58-
% sudo docker run -it --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=unix$DISPLAY --privileged --volume $XAUTH:/root/.Xauthority --volume /tmp/.X11-unix/:/tmp/.X11-unix mivisionx/ubuntu-16.04:latest
59-
```
55+
```
56+
% sudo docker pull mivisionx/ubuntu-16.04:latest
57+
% xhost +local:root
58+
% sudo docker run -it --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=unix$DISPLAY --privileged --volume $XAUTH:/root/.Xauthority --volume /tmp/.X11-unix/:/tmp/.X11-unix mivisionx/ubuntu-16.04:latest
59+
```
6060

6161
* Test display with MIVisionX sample
6262

63-
```
64-
% export PATH=$PATH:/opt/rocm/mivisionx/bin
65-
% export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/mivisionx/lib
66-
% runvx /opt/rocm/mivisionx/samples/gdf/canny.gdf
67-
```
63+
```
64+
% export PATH=$PATH:/opt/rocm/mivisionx/bin
65+
% export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/mivisionx/lib
66+
% runvx /opt/rocm/mivisionx/samples/gdf/canny.gdf
67+
```
6868

6969
* Run [Samples](#samples)
7070

@@ -73,7 +73,7 @@ MIVisionX provides developers with [docker images](https://hub.docker.com/u/mivi
7373
### Command Line Interface (CLI)
7474

7575
```
76-
usage: python mivisionx_inference_analyzer.py [-h]
76+
usage: python3 mivisionx_inference_analyzer.py [-h]
7777
--model_format MODEL_FORMAT
7878
--model_name MODEL_NAME
7979
--model MODEL
@@ -115,7 +115,7 @@ usage: python mivisionx_inference_analyzer.py [-h]
115115
### Graphical User Interface (GUI)
116116

117117
```
118-
usage: python mivisionx_inference_analyzer.py
118+
usage: python3 mivisionx_inference_analyzer.py
119119
```
120120

121121
<p align="center"><img width="75%" src="../../docs/images/analyzer-4.png" /></p>
@@ -138,23 +138,24 @@ usage: python mivisionx_inference_analyzer.py
138138

139139
* **Step 1:** Clone MIVisionX Inference Analyzer Project
140140

141-
```
142-
% cd && mkdir sample-1 && cd sample-1
143-
% git clone https://github.com/kiritigowda/MIVisionX-inference-analyzer.git
144-
```
141+
```
142+
% cd && mkdir sample-1 && cd sample-1
143+
% git clone https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX
144+
% cd MIVisionX/apps/mivisionx_inference_analyzer/
145+
```
145146

146-
**Note:**
147+
**Note:**
147148

148149
+ MIVisionX needs to be pre-installed
149150
+ MIVisionX Model Compiler & Optimizer scripts are at `/opt/rocm/mivisionx/model_compiler/python/`
150151
+ ONNX model conversion requires ONNX install using `pip install onnx`
151152

152153
* **Step 2:** Download pre-trained SqueezeNet ONNX model from [ONNX Model Zoo](https://github.com/onnx/models#open-neural-network-exchange-onnx-model-zoo) - [SqueezeNet Model](https://s3.amazonaws.com/download.onnx/models/opset_8/squeezenet.tar.gz)
153154

154-
```
155-
% wget https://s3.amazonaws.com/download.onnx/models/opset_8/squeezenet.tar.gz
156-
% tar -xvf squeezenet.tar.gz
157-
```
155+
```
156+
% wget https://s3.amazonaws.com/download.onnx/models/opset_8/squeezenet.tar.gz
157+
% tar -xvf squeezenet.tar.gz
158+
```
158159

159160
**Note:** pre-trained model - `squeezenet/model.onnx`
160161

@@ -164,15 +165,15 @@ usage: python mivisionx_inference_analyzer.py
164165

165166
+ View inference analyzer usage
166167

167-
```
168-
% cd ~/sample-1/MIVisionX-inference-analyzer/
169-
% python mivisionx_inference_analyzer.py -h
170-
```
168+
```
169+
% cd ~/sample-1/MIVisionX-inference-analyzer/
170+
% python3 mivisionx_inference_analyzer.py -h
171+
```
171172
172173
+ Run SqueezeNet Inference Analyzer
173174
174175
```
175-
% python mivisionx_inference_analyzer.py --model_format onnx --model_name SqueezeNet --model ~/sample-1/squeezenet/model.onnx --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-1/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
176+
% python3 mivisionx_inference_analyzer.py --model_format onnx --model_name SqueezeNet --model ~/sample-1/squeezenet/model.onnx --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-1/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
176177
```
177178
178179
<p align="center"><img width="100%" src="../../docs/images/sample-1-4.png" /></p>
@@ -187,34 +188,36 @@ usage: python mivisionx_inference_analyzer.py
187188
188189
* **Step 1:** Clone MIVisionX Inference Analyzer Project
189190
190-
```
191-
% cd && mkdir sample-2 && cd sample-2
192-
% git clone https://github.com/kiritigowda/MIVisionX-inference-analyzer.git
193-
```
191+
```
192+
% cd && mkdir sample-2 && cd sample-2
193+
% git clone https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX
194+
% cd MIVisionX/apps/mivisionx_inference_analyzer/
195+
```
194196
195-
**Note:**
197+
**Note:**
196198
197199
+ MIVisionX needs to be pre-installed
198200
+ MIVisionX Model Compiler & Optimizer scripts are at `/opt/rocm/mivisionx/model_compiler/python/`
201+
199202
* **Step 2:** Download pre-trained VGG 16 caffe model - [VGG_ILSVRC_16_layers.caffemodel](http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel)
200203
201-
```
202-
% wget http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel
203-
```
204+
```
205+
% wget http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel
206+
```
204207
205208
* **Step 3:** Use the command below to run the inference analyzer
206209
207210
+ View inference analyzer usage
208211
209212
```
210213
% cd ~/sample-2/MIVisionX-inference-analyzer/
211-
% python mivisionx_inference_analyzer.py -h
214+
% python3 mivisionx_inference_analyzer.py -h
212215
```
213216
214217
+ Run VGGNet-16 Inference Analyzer
215218
216219
```
217-
% python mivisionx_inference_analyzer.py --model_format caffe --model_name VggNet-16-Caffe --model ~/sample-2/VGG_ILSVRC_16_layers.caffemodel --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-2/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
220+
% python3 mivisionx_inference_analyzer.py --model_format caffe --model_name VggNet-16-Caffe --model ~/sample-2/VGG_ILSVRC_16_layers.caffemodel --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-2/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
218221
```
219222
220223
<p align="center"><img width="100%" src="../../docs/images/sample-2-2.png" /></p>
@@ -227,41 +230,44 @@ usage: python mivisionx_inference_analyzer.py
227230
228231
* **Step 1:** Clone MIVisionX Inference Analyzer Project
229232
230-
```
231-
% cd && mkdir sample-3 && cd sample-3
232-
% git clone https://github.com/kiritigowda/MIVisionX-inference-analyzer.git
233-
```
233+
```
234+
% cd && mkdir sample-3 && cd sample-3
235+
% git clone https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX
236+
% cd MIVisionX/apps/mivisionx_inference_analyzer/
237+
```
234238
235-
**Note:**
239+
**Note:**
236240
237241
+ MIVisionX needs to be pre-installed
238242
+ MIVisionX Model Compiler & Optimizer scripts are at `/opt/rocm/mivisionx/model_compiler/python/`
239243
+ NNEF model conversion requires [NNEF python parser](https://github.com/KhronosGroup/NNEF-Tools/tree/master/parser#nnef-parser-project) installed
240244
241245
* **Step 2:** Download pre-trained VGG 16 NNEF model
242246
243-
```
244-
% mkdir ~/sample-3/vgg16
245-
% cd ~/sample-3/vgg16
246-
% wget https://sfo2.digitaloceanspaces.com/nnef-public/vgg16.onnx.nnef.tgz
247-
% tar -xvf vgg16.onnx.nnef.tgz
248-
```
247+
```
248+
% mkdir ~/sample-3/vgg16
249+
% cd ~/sample-3/vgg16
250+
% wget https://sfo2.digitaloceanspaces.com/nnef-public/vgg16.onnx.nnef.tgz
251+
% tar -xvf vgg16.onnx.nnef.tgz
252+
```
249253
250254
* **Step 3:** Use the command below to run the inference analyzer
251255
252256
+ View inference analyzer usage
253257
254258
```
255-
% cd ~/sample-3/MIVisionX-inference-analyzer/
256-
% python mivisionx_inference_analyzer.py -h
259+
% cd ~/sample-3/MIVisionX-inference-analyzer/
260+
% python3 mivisionx_inference_analyzer.py -h
257261
```
258262
259263
+ Run VGGNet-16 Inference Analyzer
260264
261265
```
262-
% python mivisionx_inference_analyzer.py --model_format nnef --model_name VggNet-16-NNEF --model ~/sample-3/vgg16/ --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-3/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
266+
% python3 mivisionx_inference_analyzer.py --model_format nnef --model_name VggNet-16-NNEF --model ~/sample-3/vgg16/ --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-3/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes
263267
```
264268
265269
* **Preprocessing the model:** Use the --add/--multiply option to preprocess the input images
266270
267-
% python mivisionx_inference_analyzer.py --model_format nnef --model_name VggNet-16-NNEF --model ~/sample-3/vgg16/ --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-3/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes --add [-2.1179,-2.0357,-1.8044] --multiply [0.0171,0.0175,0.0174]
271+
```
272+
% python3 mivisionx_inference_analyzer.py --model_format nnef --model_name VggNet-16-NNEF --model ~/sample-3/vgg16/ --model_input_dims 3,224,224 --model_output_dims 1000,1,1 --label ./sample/labels.txt --output_dir ~/sample-3/ --image_dir ../../data/images/AMD-tinyDataSet/ --image_val ./sample/AMD-tinyDataSet-val.txt --hierarchy ./sample/hierarchy.csv --replace yes --add [-2.1179,-2.0357,-1.8044] --multiply [0.0171,0.0175,0.0174]
273+
```

0 commit comments

Comments
 (0)