mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08:36:34 +00:00
c234e8b190
Add classes = 80 as default number in yaml file
42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
# prerequisites
|
|
sudo apt install python3.12-venv python-is-python3
|
|
if [ ! -f azaion.pt ]; then
|
|
echo "----ERROR!----"
|
|
echo "Script requires azaion.pt file model in this folder!!!"
|
|
echo "----ERROR!----"
|
|
exit
|
|
fi
|
|
|
|
# convert PT to ONNX
|
|
git clone https://github.com/airockchip/ultralytics_yolov8
|
|
cd ultralytics_yolov8
|
|
python -m venv env
|
|
source env/bin/activate
|
|
pip install .
|
|
|
|
cp ../azaion.pt .
|
|
sed -i -E "s/(model:).*$/\1 azaion.pt/" ultralytics/cfg/default.yaml
|
|
export PYTHONPATH=./
|
|
python ./ultralytics/engine/exporter.py
|
|
cp azaion.onnx ../
|
|
cd ..
|
|
|
|
exit
|
|
|
|
# convert ONNX to RKNN
|
|
wget -c https://mirrors.bfsu.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
|
chmod +x Miniconda3-latest-Linux-x86_64.sh
|
|
bash Miniconda3-latest-Linux-x86_64.sh
|
|
source ~/miniconda3/bin/activate
|
|
conda create -n toolkit2 python=3.11
|
|
conda activate toolkit2
|
|
git clone https://github.com/rockchip-linux/rknn-toolkit2.git
|
|
cd rknn-toolkit2/rknn-toolkit2/packages
|
|
pip install -r requirements_cp311-1.6.0.txt
|
|
pip install rknn_toolkit2-1.6.0+81f21f4d-cp311-cp311-linux_x86_64.whl
|
|
cd ~/opi5-rknn
|
|
git clone https://github.com/airockchip/rknn_model_zoo.git
|
|
cd rknn_model_zoo/examples/yolov8/python
|
|
python convert.py ~/azaion/models/azaion-2024-08-13.onnx rk3588 i8
|
|
cp ../model/yolov8.rknn ~/azaion/models/azaion-2024-08-13.rknn # Output file form convert script is hard-coded...
|