Files
HSAP/algorithms/lane_ufld/code.embedded.bak/pytorch-auto-drive-master/docs/SEGMENTATION.md
Chengfang Lu e72bc061c5 feat: HSAP platform v2 — modular navigation, quality review, audit log, world model simulation
Major changes:
- New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind
- 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理
- Data catalog with charts (DMS/ADAS/Lane 3-tab view)
- Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance
- Audit enhancements: batch operations, rejection categories, Feishu notifications
- Operation audit log (操作日志)
- World model simulation studio (仿真工坊)
- Dataset version management with snapshots and diff
- ADAS 7-class dataset integration (138K images organized + compressed)
- User management with Feishu integration and pagination
- CRUD/search/filter on all pages, card layout redesign
- PIL-optimized image overlay rendering
- Auto-snapshot on build, in_review workflow stage
- Removed embedded algorithm code (now in workspace)
2026-06-03 11:40:21 +08:00

2.3 KiB

Semantic segmentation

Before diving into this, please make sure you followed the instructions to prepare datasets in DATASET.md

Execution is based on config files

Training:

Some models' ImageNet pre-trained weights need to be manually downloaded, refer to this table.

python main_semseg.py --train \
                      --config=<config file path> \
                      --mixed-precision  # Optional, enable mixed precision \
                      --cfg-options=<overwrite cfg dict>  # Optional

Your <overwrite cfg dict> is used to manually override config file options in commandline so you don't have to modify config file each time. It should look like this (the quotation marks are necessary!): "train.batch_size=8 train.workers=4 model.classifier_cfg.num_classes=21"

Some options can be used by shortcuts, such as --batch-size will set both train.batch_size and test.batch_size, for more info:

python main_semseg.py --help

Example shells are provided in tools/shells.

Distributed Training

We support multi-GPU training with Distributed Data Parallel (DDP):

python -m torch.distributed.launch --nproc_per_node=<number of GPU per-node> --use_env main_semseg.py <your normal args>

With DDP, batch size and number of workers are per-GPU. Do not forget to set device args like world_size in your config.

Testing:

Training contains online evaluations and the best model is saved.

To evaluate a trained model:

python main_semseg.py --val \  # No test set labels available
                      --config=<config file path> \
                      --mixed-precision  # Optional, enable mixed precision \
                      --cfg-options=<overwrite cfg dict>  # Optional

To test a downloaded pt file, try add --checkpoint=<pt file path>.

Detail results will be saved to <save_dir>/<exp_name>/.

Overall result will be saved to log.txt.

Recommend workers=0 batch_size=1 for high precision inference.

Notes:

  1. Cityscapes dataset is down-sampled by 2 when training at 256 x 512, to specify different sizes, modify them in config files if needed.

  2. All segmentation results reported are from single model without CRF and without multi-scale testing.