環境安裝: # 建立與啟動 conda 環境 conda create -n stdc_golface python=3.8 -y conda activate stdc_golface # 安裝 PyTorch + 對應 CUDA 11.3 版本 conda install pytorch=1.11.0 torchvision=0.12.0 torchaudio cudatoolkit=11.3 -c pytorch -y # 安裝對應版本的 mmcv-full pip install mmcv-full==1.5.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html # 安裝 kneronstdc 專案 cd kneronstdc pip install -e . # 安裝常用工具套件 pip install opencv-python tqdm matplotlib cityscapesscripts # 安裝 yapf 格式化工具(指定版本) pip install yapf==0.31.0 -------------------------------------------------------------------------------------- data: 使用 Roboflow 匯出資料集格式請選擇: Semantic Segmentation Masks 使用 seg2city.py 腳本將 Roboflow 格式轉換為 Cityscapes 格式 Cityscapes 範例資料可作為參考 將轉換後的資料放置至 data/cityscapes 資料夾 (cityscapes 為訓練預設的 dataset 名稱) -------------------------------------------------------------------------------------- 訓練模型: 開剛剛新裝好的env,用cmd下指令,cd到kneronstdc裡面 train的指令: python tools/train.py configs/stdc/kn_stdc1_in1k-pre_512x1024_80k_cityscapes.py test的指令: python tools/test.py configs/stdc/kn_stdc1_in1k-pre_512x1024_80k_cityscapes.py work_dirs/kn_stdc1_in1k-pre_512x1024_80k_cityscapes/latest.pth --show-dir work_dirs/vis_results ------------------------------------------------------------------------------------ 映射到資料夾 docker run --rm -it -v $(wslpath -u 'C:\Users\rd_de\kneronstdc'):/workspace/kneronstdc kneron/toolchain:latest 轉ONNX指令 python tools/pytorch2onnx_kneron.py configs/stdc/kn_stdc1_in1k-pre_512x1024_80k_cityscapes.py --checkpoint work_dirs/kn_stdc1_in1k-pre_512x1024_80k_cityscapes/latest.pth --output-file work_dirs/kn_stdc1_in1k-pre_512x1024_80k_cityscapes/latest.onnx --verify 把nef拉出來到電腦 docker cp f78594411e1b:/data1/kneron_flow/models_630.nef "C:\Users\rd_de\kneronstdc\work_dirs\nef\models_630.nef" --------------------------------------------------------------------------------------- pip install opencv-python RUN apt update && apt install -y libgl1