Skip to content

Commit

Permalink
update ddp
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzihao008 committed Nov 18, 2023
1 parent c50ec37 commit 0dae329
Show file tree
Hide file tree
Showing 59 changed files with 6,585 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git
_debug/
__pycache__/
pretrained/
checkpoint/
*.pth
dataset/debug_tools.py
debugger/
dataset/
output_all/
tf_logs/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# monocon_rp (2022.08.10)
此项目用于复现monocon
源码地址:https://github.com/chenzihao008/monocon-pytorch.git
## 修改部分
### 将训练源码修改为DDP训练,使用mp.spwan启动,单机单卡、单机多卡均可使用
- [修改了以下文件:]
- engine\base_engine.py
- engine\monocon_engine.py
- train.py
### 存在dataloader多进程读取数据占用显存问题
## environment
- [显卡] 3080*1 10G
- [CUDA] 10.1
Expand Down
17 changes: 17 additions & 0 deletions changelog.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Changelog

### v1.0.3 (2022.09.10)
- Made ```torch.backend.cudnn.benchmark``` option configurable in ```monocon_config.py```. (**Issue #2**)
```python
_C.USE_BENCHMARK = True
```
- Some code has been modified and added to enable video inference using kitti raw dataset.

### v1.0.2 (2022.08.30)
- A Transform class ```Resize3D``` for resize augmentation has been added. (**Issue #1**)

### v1.0.1 (2022.08.29)
- Visualization functions for 2D Boxes, 3D Boxes, and BEV have been added.

### v1.0.0 (2022.08.28)
- This repository is released.
41 changes: 41 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
DATA:
BATCH_SIZE: 2
FILTER:
MAX_DEPTH: 65
MAX_OCCLUSION: 2
MAX_TRUNCATION: 0.5
MIN_DEPTH: 2
MIN_HEIGHT: 25
NUM_WORKERS: 0
ROOT: dataset
TEST_SPLIT: val
TRAIN_SPLIT: train
DESCRIPTION: MonoCon Default Configuration
GPU_ID: 0
MODEL:
BACKBONE:
IMAGENET_PRETRAINED: false
NUM_LAYERS: 34
HEAD:
MAX_OBJS: 30
NUM_CLASSES: 3
OUTPUT_DIR: ''
PERIOD:
EVAL_PERIOD: 1
LOG_PERIOD: 50
SEED: 1891176477
SOLVER:
CLIP_GRAD:
ENABLE: true
MAX_NORM: 35
NORM_TYPE: 2.0
OPTIM:
LR: 0.000225
NUM_EPOCHS: 5
WEIGHT_DECAY: 1.0e-05
SCHEDULER:
ENABLE: true
TRAIN_TYPE: DDP
USE_BENCHMARK: false
VERSION: v1.0.3

65 changes: 65 additions & 0 deletions config/monocon_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from yacs.config import CfgNode as CN


_C = CN()

_C.VERSION = 'v1.0.3'
_C.DESCRIPTION = "MonoCon Default Configuration"

_C.OUTPUT_DIR = "" # Output Directory
_C.SEED = -1 # -1: Random Seed Selection
_C.GPU_ID = 0 # Index of GPU to use

_C.USE_BENCHMARK = False # Value of 'torch.backends.cudnn.benchmark' and 'torch.backends.cudnn.enabled'

_C.TRAIN_TYPE = 'DDP'
# Data
_C.DATA = CN()
_C.DATA.ROOT = 'dataset' # KITTI Root
_C.DATA.BATCH_SIZE = 8
_C.DATA.NUM_WORKERS = 0
_C.DATA.TRAIN_SPLIT = 'train'
_C.DATA.TEST_SPLIT = 'val'

_C.DATA.FILTER = CN()
_C.DATA.FILTER.MIN_HEIGHT = 25
_C.DATA.FILTER.MIN_DEPTH = 2
_C.DATA.FILTER.MAX_DEPTH = 65
_C.DATA.FILTER.MAX_TRUNCATION = 0.5
_C.DATA.FILTER.MAX_OCCLUSION = 2


# Model
_C.MODEL = CN()

_C.MODEL.BACKBONE = CN()
_C.MODEL.BACKBONE.NUM_LAYERS = 34
_C.MODEL.BACKBONE.IMAGENET_PRETRAINED = False #不用预训练的backbone效果肯定会好一点吧

_C.MODEL.HEAD = CN()
_C.MODEL.HEAD.NUM_CLASSES = 3
_C.MODEL.HEAD.MAX_OBJS = 30


# Optimization
_C.SOLVER = CN()

_C.SOLVER.OPTIM = CN()
_C.SOLVER.OPTIM.LR = 2.25E-04
_C.SOLVER.OPTIM.WEIGHT_DECAY = 1E-05
_C.SOLVER.OPTIM.NUM_EPOCHS = 5 # Max Training Epochs

_C.SOLVER.SCHEDULER = CN()
_C.SOLVER.SCHEDULER.ENABLE = True

_C.SOLVER.CLIP_GRAD = CN()
_C.SOLVER.CLIP_GRAD.ENABLE = True
_C.SOLVER.CLIP_GRAD.NORM_TYPE = 2.0
_C.SOLVER.CLIP_GRAD.MAX_NORM = 35


# Period
_C.PERIOD = CN()
_C.PERIOD.EVAL_PERIOD = 1 # In Epochs / Set -1 if you don't want validation
_C.PERIOD.LOG_PERIOD = 50 # In Steps

Loading

0 comments on commit 0dae329

Please sign in to comment.