Skip to content

Commit

Permalink
2022.09.09 21:06
Browse files Browse the repository at this point in the history
  • Loading branch information
2gunsu committed Sep 9, 2022
1 parent 720910f commit 7409e7f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 15 deletions.
40 changes: 40 additions & 0 deletions A/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
DATA:
BATCH_SIZE: 8
FILTER:
MAX_DEPTH: 65
MAX_OCCLUSION: 2
MAX_TRUNCATION: 0.5
MIN_DEPTH: 2
MIN_HEIGHT: 25
NUM_WORKERS: 4
ROOT: /home/user/SSD/KITTI
TEST_SPLIT: val
TRAIN_SPLIT: train
DESCRIPTION: MonoCon Default Configuration
GPU_ID: 0
MODEL:
BACKBONE:
IMAGENET_PRETRAINED: true
NUM_LAYERS: 34
HEAD:
MAX_OBJS: 30
NUM_CLASSES: 3
OUTPUT_DIR: A
PERIOD:
EVAL_PERIOD: 10
LOG_PERIOD: 50
SEED: 0
SOLVER:
CLIP_GRAD:
ENABLE: true
MAX_NORM: 35
NORM_TYPE: 2.0
OPTIM:
LR: 0.000225
NUM_EPOCHS: 200
WEIGHT_DECAY: 1.0e-05
SCHEDULER:
ENABLE: true
USE_BENCHMARK: false
VERSION: v1.0.3

Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Unchecked items are currently being prepared.
- [x] Single-GPU Training
- [x] KITTI Evaluation
- [ ] Multi-GPU Training
- [ ] Fancy Logger
- [x] Visualization (2D Bounding Box + Projected 3D Bounding Box)
- [x] Visualization (Bird Eye's View)
- [ ] Video Inference using KITTI Raw Data Sequences


## Preparations
Expand Down Expand Up @@ -79,6 +81,7 @@ The structure of the data files should be as below.
## Usage
### Training
Just edit the items in ```config/monocon_configs.py``` before execution.
If you want less GPU memory consumption, set ```_C.USE_BENCHMARK``` to ```False```.
```bash
python train.py
```
Expand Down Expand Up @@ -159,7 +162,7 @@ If possible, use a value greater than 4 as the batch size.


## Change Log
This repository was last updated to **v1.0.2** on **2022.08.30**.
This repository was last updated to **v1.0.3** on **2022.09.09**.
Check [changelog.md](changelog.MD) for detailed update history.


Expand Down
3 changes: 3 additions & 0 deletions changelog.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

### v1.0.3 (2022.09.09)
- Made ```torch.backend.cudnn.benchmark``` option configurable in ```monocon_config.py```.

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

Expand Down
14 changes: 6 additions & 8 deletions config/monocon_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

_C = CN()

_C.VERSION = 'v1.0.2'
_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.OUTPUT_DIR = "" # Output Directory
_C.SEED = -1 # -1: Random Seed Selection
_C.GPU_ID = 0 # Index of GPU to use

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


# Data
Expand All @@ -19,10 +21,6 @@
_C.DATA.TRAIN_SPLIT = 'train'
_C.DATA.TEST_SPLIT = 'val'

_C.DATA.STATS = CN()
_C.DATA.STATS.MEAN = [123.675, 116.28, 103.53]
_C.DATA.STATS.STD = [58.395, 57.12, 57.375]

_C.DATA.FILTER = CN()
_C.DATA.FILTER.MIN_HEIGHT = 25
_C.DATA.FILTER.MIN_DEPTH = 2
Expand Down
1 change: 1 addition & 0 deletions losses/l1_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from losses.utils import weighted_loss


# TODO Handling an exception so that it can be handled even when the target data is empty
@weighted_loss
def l1_loss(pred: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
assert pred.size() == target.size() and target.numel() > 0
Expand Down
11 changes: 8 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
torch.backends.cuda.matmul.allow_tf32 = False
torch.backends.cudnn.allow_tf32 = False

torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True


# Load Config
cfg = load_cfg(args.config_file)
cfg.GPU_ID = args.gpu_id


# Set Benchmark
# If this is set to True, it may consume more memory. (Default: True)
if cfg.get('USE_BENCHMARK', True):
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True
tprint(f"CuDNN Benchmark is enabled.")


# Set Random Seed
seed = cfg.get('SEED', -1)
seed = generate_random_seed(seed)
Expand Down
11 changes: 8 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
torch.backends.cuda.matmul.allow_tf32 = False
torch.backends.cudnn.allow_tf32 = False

torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True


# Get Config from 'config/monocon_configs.py'
cfg = get_default_cfg()


# Set Benchmark
# If this is set to True, it may consume more memory. (Default: True)
if cfg.get('USE_BENCHMARK', True):
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True
tprint(f"CuDNN Benchmark is enabled.")


# Set Random Seed
seed = cfg.get('SEED', -1)
seed = generate_random_seed(seed)
Expand Down

0 comments on commit 7409e7f

Please sign in to comment.