# Lane detection **Before diving into this, please make sure you followed the instructions to prepare datasets in [DATASET.md](./DATASET.md)** **Execution is based on [config files](../configs/README.md)** ## Training: Some models' ImageNet pre-trained weights need to be manually downloaded, refer to [this table](./IMAGENET_MODELS.md). ``` python main_landet.py --train \ --config= \ --mixed-precision # Optional, enable mixed precision \ --cfg-options= # Optional ``` Your `` 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.lane_classifier_cfg.dropout=0.1"` 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_landet.py --help ``` Example shells are provided in [tools/shells](../tools/shells/). ## Distributed Training We support multi-GPU training with Distributed Data Parallel (DDP): ``` python -m torch.distributed.launch --nproc_per_node= --use_env main_landet.py ``` 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 ### Evaluation: **Important Notice: Do not simoutanously run multiple evaluation on CULane, since the eval use the same pytorch-auto-drive/output cache directory, the results could be overwritten! Same goes for LLAMAS!** 1. Predict lane lines: ``` python main_landet.py --test \ # Or --val for validation --config= \ --mixed-precision # Optional, enable mixed precision \ --cfg-options= # Optional ``` To test a downloaded pt file, try add `--checkpoint=`. Note that LLAMAS doesn't have test set labels. 2. Test with official scripts on ``: ``` ./autotest_.sh ``` `` includes `test` and `val`. `` and `` are recommended to set the same as in config file, so detail evaluation results will be saved to `//` Overall result will be saved to `log.txt`. ### Fast evaluation in mIoU [Not Recommended]: Training contains online fast validations by using `val_num_steps` and the best model is saved, but we find that the best checkpoint is usually the last, so probably no need for validations. For log details you can checkout tensorboard. To validate a trained model on mean IoU, you can use either mixed-precision or fp32 for any model trained with/without mixed-precision: ``` python main_landet.py --valfast \ --config= \ --mixed-precision # Optional, enable mixed precision \ --cfg-options= # Optional ```