This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
products:sbc:vim4:npu:demos:densenet [2024/01/04 04:59] louis |
products:sbc:vim4:npu:demos:densenet [2024/01/04 21:23] (current) louis old revision restored (2023/09/20 01:13) |
||
---|---|---|---|
Line 62: | Line 62: | ||
``` | ``` | ||
- | The model input is grayscale image, so before quantification, | + | Enter '' |
- | + | ||
- | ```python convert_picture.py | + | |
- | import numpy as np | + | |
- | import cv2 | + | |
- | import os | + | |
- | + | ||
- | image_path = " | + | |
- | save_path = " | + | |
- | + | ||
- | for i in os.listdir(image_path): | + | |
- | image = cv2.imread(image_path + i, 0) | + | |
- | image = image / 255.0 | + | |
- | image = np.expand_dims(image, | + | |
- | np.save(save_path + i.split(" | + | |
- | ``` | + | |
- | + | ||
- | Enter '' | + | |
```bash convert_adla.sh | ```bash convert_adla.sh | ||
Line 98: | Line 81: | ||
--input-shapes | --input-shapes | ||
--dtypes " | --dtypes " | ||
- | --quantize-dtype | + | |
+ | --inference-output-type float32 \ | ||
+ | | ||
--channel-mean-value " | --channel-mean-value " | ||
--source-file ./ | --source-file ./ | ||
--iterations 500 \ | --iterations 500 \ | ||
--disable-per-channel False \ | --disable-per-channel False \ | ||
- | --inference-input-type float32 \ | ||
- | --inference-output-type float32 \ | ||
--batch-size 1 --target-platform PRODUCT_PID0XA003 | --batch-size 1 --target-platform PRODUCT_PID0XA003 | ||
``` | ``` | ||
- | |||
- | <WRAP important > | ||
- | Please prepare about 500 pictures for quantification. If the pictures size is smaller than model input size, please resize pictures to input size before quantification. | ||
- | </ | ||
Run '' | Run '' | ||
Line 127: | Line 106: | ||
$ git clone https:// | $ git clone https:// | ||
``` | ``` | ||
- | |||
- | <WRAP important > | ||
- | If your kernel version is 5.4 or earlier, please use tag '' | ||
- | </ | ||
==== Install dependencies ==== | ==== Install dependencies ==== |