-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BC-Break] The Great Refactor with config files (#45)
* simple registry * register and run function * base runners & lane trainer * lane tester * seg trainer & tester * register datasets * register losses * lr_schedulers * lr_schedulers * optimizers * torch scheduler * register transforms * register models * remove defs * ddp from args * first config * refactor datasets * lane starting * parse args * debug * erfnet * refactor configs * doc * optimize args * first seg config * losses wrappers * debug * city matched * work dir * save-dir for final results * debug * tensorboard log moved * lane configs * doc change * basic configs [unchecked] * shell * debug lstr * debug gtav/synthia * val_batch_size * lstr debug * default val_bs back to align with seg * seg complete * vgg16 finished * vggs * conversions * add resnet50 * add resnet34 * add resnet18 * add resnet101 tusimple * add rep-vgg a0 * enet erfnet --cfg-options * lstr resa101 * add resnet101 baseline scnn * RepVGG-A tusimple * tools * fix cfg-options * add repvgg culane * multi GPU tests * update the result of repvgg-a on culane * add repvgg-a1 scnn * add mobilenetv2 * InvertedResidualV3 block * arch error * align arch with DeepLab-LargeFOV (resnets) * bias=False * add option for reducer * debug * update names * fix a1-culane config files * mobilenetv2 scnn config * mobilenet v3 test * align torchvision * v2 * refactor * lane dir * delete * bug fixes * lane video * v3 fix dilation * v3 fix padding * update repvgg config * seg vis * refactor common_models to a directory * move vgg encoder * remove test_images * refactor doc & vis debug * cherry-pick from rc-swin * repvgg config clean up * replace * replace all * credits * new video * adavanced doc * final mods Co-authored-by: cedricgsh <guoshaohua@sjtu.edu.cn>
- Loading branch information
1 parent
b21cb07
commit b93cc1f
Showing
371 changed files
with
11,706 additions
and
3,910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#!/bin/bash | ||
echo experiment name: $1 | ||
echo status: $2 | ||
echo save dir: $3 | ||
|
||
cd tools/culane_evaluation | ||
if [ "$2" = "test" ]; then | ||
# Perform test with official scripts | ||
./eval.sh $1 | ||
./eval.sh $1 $3 | ||
# Calculate overall F1 score | ||
python cal_total.py --exp-name=$1 | ||
python cal_total.py --exp-name=$1 --save-dir=$3 | ||
else | ||
# Perform validation with official scripts | ||
./eval_validation.sh $1 | ||
./eval_validation.sh $1 $3 | ||
fi | ||
cd ../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Configs | ||
|
||
Config files in *PytorchAutoDrive* (`./configs/`) are used to define models, | ||
how they are trained, tested, visualized, *etc*. | ||
|
||
### Registry Mechanism | ||
|
||
Different to existing class-based registers, we can also register functions. | ||
For functions, you only write static args in your config, | ||
while passing the dynamic ones on-the-fly by: | ||
|
||
``` | ||
REGISTRY.from_dict( | ||
<config dict for a function/class>, | ||
kwarg1=1, kwarg2=2, ... | ||
) | ||
``` | ||
|
||
Note that each argument must be keyword (k=v), and some kwargs can overwrite dict configs. | ||
|
||
### Use An Existing Config | ||
|
||
Modify customized options like the root of your datasets (in `configs/*/common/_*.py`). | ||
|
||
### Write A New Config | ||
|
||
Copy the config file most similar to your use case and modify it. | ||
Note that you can simply import config parts from `common` or other config files, it is like writing Python. | ||
|
||
### Register A New Class/Func | ||
|
||
Choose the appropriate registry and register your Class/Func by: | ||
|
||
``` | ||
@REGISTRY.register() | ||
``` | ||
|
||
Remember you still need to import this Class/Func for the registering to take effects. | ||
|
||
### How To Read The Code | ||
|
||
Since you can't just click 'go to definition' in your IDE, | ||
it is suggested to search the directory for each Class/Function by `name` in configs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Data pipeline | ||
from configs.lane_detection.common.datasets.culane_seg import dataset | ||
from configs.lane_detection.common.datasets.train_level0_288 import train_augmentation | ||
from configs.lane_detection.common.datasets.test_288 import test_augmentation | ||
|
||
# Optimization pipeline | ||
from configs.lane_detection.common.optims.segloss_5class import loss | ||
from configs.lane_detection.common.optims.sgd05 import optimizer | ||
from configs.lane_detection.common.optims.ep12_poly_warmup200 import lr_scheduler | ||
|
||
|
||
train = dict( | ||
exp_name='enet_baseline_culane', | ||
workers=10, | ||
batch_size=20, | ||
checkpoint=None, | ||
# Device args | ||
world_size=0, | ||
dist_url='env://', | ||
device='cuda', | ||
|
||
val_num_steps=0, # Seg IoU validation (mostly useless) | ||
save_dir='./checkpoints', | ||
|
||
input_size=(288, 800), | ||
original_size=(590, 1640), | ||
num_classes=5, | ||
num_epochs=12, | ||
collate_fn=None, # 'dict_collate_fn' for LSTR | ||
seg=True, # Seg-based method or not | ||
) | ||
|
||
test = dict( | ||
exp_name='enet_baseline_culane', | ||
workers=10, | ||
batch_size=80, | ||
checkpoint='./checkpoints/enet_baseline_culane/model.pt', | ||
# Device args | ||
device='cuda', | ||
|
||
save_dir='./checkpoints', | ||
|
||
seg=True, | ||
gap=20, | ||
ppl=18, | ||
thresh=0.3, | ||
collate_fn=None, # 'dict_collate_fn' for LSTR | ||
input_size=(288, 800), | ||
original_size=(590, 1640), | ||
max_lane=4, | ||
dataset_name='culane' | ||
) | ||
|
||
model = dict( | ||
name='ENet', | ||
num_classes=5, | ||
encoder_relu=False, | ||
decoder_relu=True, | ||
dropout_1=0.01, | ||
dropout_2=0.1, | ||
encoder_only=False, | ||
pretrained_weights=None, | ||
lane_classifier_cfg=dict( | ||
name='EDLaneExist', | ||
num_output=5 - 1, | ||
flattened_size=4500, | ||
dropout=0.1, | ||
pool='avg' | ||
) | ||
) |
Oops, something went wrong.