STDC/README.md
charlie880624 7716a0060f
Some checks failed
deploy / build-n-publish (push) Has been cancelled
lint / lint (push) Has been cancelled
build / build_cpu (3.7, 1.5.1, torch1.5, 0.6.1) (push) Has been cancelled
build / build_cpu (3.7, 1.6.0, torch1.6, 0.7.0) (push) Has been cancelled
build / build_cpu (3.7, 1.7.0, torch1.7, 0.8.1) (push) Has been cancelled
build / build_cpu (3.7, 1.8.0, torch1.8, 0.9.0) (push) Has been cancelled
build / build_cpu (3.7, 1.9.0, torch1.9, 0.10.0) (push) Has been cancelled
build / build_cuda101 (3.7, 1.5.1+cu101, torch1.5, 0.6.1+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.6.0+cu101, torch1.6, 0.7.0+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.7.0+cu101, torch1.7, 0.8.1+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.8.0+cu101, torch1.8, 0.9.0+cu101) (push) Has been cancelled
build / build_cuda102 (3.6, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.7, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.8, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.9, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / test_windows (windows-2022, cpu, 3.8) (push) Has been cancelled
build / test_windows (windows-2022, cu111, 3.8) (push) Has been cancelled
feat: add golf dataset, kneron configs, and tools
- Add golf1/2/4/7/8 dataset classes for semantic segmentation
- Add kneron-specific configs (meconfig series, kn_stdc1_golf4class)
- Organize scripts into tools/check/ and tools/kneron/
- Add kneron_preprocessing module
- Update README with quick-start guide
- Update .gitignore to exclude data dirs, onnx, nef outputs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 13:14:30 +08:00

1.8 KiB
Raw Blame History

STDC GolfAce — Semantic Segmentation on Kneron

快速開始

環境安裝

# 建立與啟動 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

# 安裝專案
pip install -e .

# 安裝工具套件
pip install opencv-python tqdm matplotlib cityscapesscripts yapf==0.31.0

資料準備

  1. 使用 Roboflow 匯出資料集,格式選擇 Semantic Segmentation Masks
  2. 使用 seg2city.py 將 Roboflow 格式轉換為 Cityscapes 格式
  3. 將轉換後的資料放至 data/cityscapes/

訓練與測試

# 訓練
python tools/train.py configs/stdc/kn_stdc1_in1k-pre_512x1024_80k_cityscapes.py

# 測試(輸出視覺化結果)
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

轉換 ONNX / NEFKneron Toolchain

# 啟動 DockerWSL 環境)
docker run --rm -it \
    -v $(wslpath -u 'C:\Users\rd_de\stdc_git'):/workspace/stdc_git \
    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 <container_id>:/data1/kneron_flow/models_630.nef \
    "C:\Users\rd_de\stdc_git\work_dirs\nef\models_630.nef"