-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,10 @@ | |
|
||
1. 配置 | ||
2. 日志 | ||
1. 文本日志 | ||
2. 可视化日志 | ||
3. 数据 | ||
4. 检查点 | ||
4. 检查点 | ||
5. 优化器 | ||
1. 梯度更新 | ||
2. 学习率调度 |
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,25 @@ | ||
|
||
# 优化器 | ||
|
||
优化其分为`2`个部分: | ||
|
||
1. 梯度更新 | ||
2. 学习率调度 | ||
|
||
|
||
其涉及到配置参数有 | ||
|
||
``` | ||
_C.SOLVER = CN() | ||
# 梯度更新 | ||
_C.SOLVER.BATCH_SIZE = 32 | ||
_C.SOLVER.LR = 1e-3 | ||
_C.SOLVER.MOMENTUM = 0.9 | ||
# 学习率调度 | ||
_C.SOLVER.MAX_ITER = 120000 | ||
_C.SOLVER.LR_STEPS = [80000, 100000] | ||
_C.SOLVER.GAMMA = 0.1 | ||
_C.SOLVER.WEIGHT_DECAY = 5e-4 | ||
_C.SOLVER.WARMUP_FACTOR = 1.0 / 3 | ||
_C.SOLVER.WARMUP_ITERS = 500 | ||
``` |
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,17 @@ | ||
|
||
# 学习率调度 | ||
|
||
* 定义:`py/ssd/optim/__init__.py` | ||
* 声明:`py/train.py` | ||
* 使用:`py/ssd/enine/trainer.py` | ||
|
||
定义了一个辅助函数`make_lr_scheduler`来生成优化器 | ||
|
||
``` | ||
def make_lr_scheduler(cfg, optimizer, milestones=None): | ||
return WarmupMultiStepLR(optimizer=optimizer, | ||
milestones=cfg.SOLVER.LR_STEPS if milestones is None else milestones, | ||
gamma=cfg.SOLVER.GAMMA, | ||
warmup_factor=cfg.SOLVER.WARMUP_FACTOR, | ||
warmup_iters=cfg.SOLVER.WARMUP_ITERS) | ||
``` |
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,15 @@ | ||
|
||
# 梯度更新 | ||
|
||
* 定义:`py/ssd/optim/__init__.py` | ||
* 声明:`py/train.py` | ||
* 使用:`py/ssd/enine/trainer.py` | ||
|
||
定义了一个辅助函数`make_optimizer`来生成优化器 | ||
|
||
``` | ||
def make_optimizer(cfg, model, lr=None): | ||
lr = cfg.SOLVER.BASE_LR if lr is None else lr | ||
return torch.optim.SGD(model.parameters(), lr=lr, momentum=cfg.SOLVER.MOMENTUM, | ||
weight_decay=cfg.SOLVER.WEIGHT_DECAY) | ||
``` |
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