Update README.md
#6
by
XiaodongWang
- opened
README.md
CHANGED
@@ -73,11 +73,11 @@ val: val2017.txt # val images (relative to 'path') 5000 images
|
|
73 |
|
74 |
### Test & Evaluation
|
75 |
|
76 |
-
- Code snippet from [`
|
77 |
```python
|
78 |
args = make_parser().parse_args()
|
79 |
-
onnx_path = args.
|
80 |
-
|
81 |
grid = np.load("./grid.npy", allow_pickle=True)
|
82 |
anchor_grid = np.load("./anchor_grid.npy", allow_pickle=True)
|
83 |
path = args.image_path
|
@@ -86,8 +86,8 @@ val: val2017.txt # val images (relative to 'path') 5000 images
|
|
86 |
|
87 |
img0 = cv2.imread(path)
|
88 |
img = pre_process(img0)
|
89 |
-
onnx_input = {
|
90 |
-
onnx_output =
|
91 |
onnx_output = post_process(onnx_output)
|
92 |
pred = non_max_suppression(
|
93 |
onnx_output[0], conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det
|
@@ -112,12 +112,12 @@ val: val2017.txt # val images (relative to 'path') 5000 images
|
|
112 |
|
113 |
- Run inference for a single image
|
114 |
```python
|
115 |
-
python
|
116 |
```
|
117 |
*Note: __vaip_config.json__ is located at the setup package of Ryzen AI (refer to [Installation](#installation))*
|
118 |
- Test accuracy of the quantized model
|
119 |
```python
|
120 |
-
python
|
121 |
```
|
122 |
|
123 |
### Performance
|
|
|
73 |
|
74 |
### Test & Evaluation
|
75 |
|
76 |
+
- Code snippet from [`infer_onnx.py`](infer_onnx.py) on how to use
|
77 |
```python
|
78 |
args = make_parser().parse_args()
|
79 |
+
onnx_path = args.onnx_model
|
80 |
+
onnx_weight = onnxruntime.InferenceSession(onnx_path)
|
81 |
grid = np.load("./grid.npy", allow_pickle=True)
|
82 |
anchor_grid = np.load("./anchor_grid.npy", allow_pickle=True)
|
83 |
path = args.image_path
|
|
|
86 |
|
87 |
img0 = cv2.imread(path)
|
88 |
img = pre_process(img0)
|
89 |
+
onnx_input = {onnx_weight.get_inputs()[0].name: img}
|
90 |
+
onnx_output = onnx_weight.run(None, onnx_input)
|
91 |
onnx_output = post_process(onnx_output)
|
92 |
pred = non_max_suppression(
|
93 |
onnx_output[0], conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det
|
|
|
112 |
|
113 |
- Run inference for a single image
|
114 |
```python
|
115 |
+
python infer_onnx.py --onnx_model ./yolov5s.onnx -i /Path/To/Your/Image --ipu --provider_config /Path/To/Your/Provider_config
|
116 |
```
|
117 |
*Note: __vaip_config.json__ is located at the setup package of Ryzen AI (refer to [Installation](#installation))*
|
118 |
- Test accuracy of the quantized model
|
119 |
```python
|
120 |
+
python eval_onnx.py --onnx_model ./yolov5s.onnx --ipu --provider_config /Path/To/Your/Provider_config
|
121 |
```
|
122 |
|
123 |
### Performance
|