Skip to content

Commit

Permalink
Refactor config (#367)
Browse files Browse the repository at this point in the history
* update readme

* refactor config

* fix unit tests

* fix unit tests

* fix unit tests

* fix unit tests

* fix unit tests
  • Loading branch information
RangiLyu committed Dec 24, 2021
1 parent 74a8acc commit efddda7
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
torch: [1.7.0, 1.8.0, 1.9.0]
torch: [1.7.0, 1.8.1, 1.9.0]
include:
- torch: 1.7.0
torchvision: 0.8.1
- torch: 1.8.0
torchvision: 0.9.0
- torch: 1.8.1
torchvision: 0.9.1
- torch: 1.9.0
torchvision: 0.10.0
steps:
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<div align="center">

# NanoDet-Plus

<img src="docs/imgs/Title.jpg" />

### Super fast and high accuracy lightweight anchor-free object detection model. Real-time on mobile devices.
# NanoDet-Plus
**Super fast and high accuracy lightweight anchor-free object detection model. Real-time on mobile devices.**


[![CI testing](https://img.shields.io/github/checks-status/RangiLyu/nanodet/main?label=CI&style=flat)](https://img.shields.io/github/checks-status/RangiLyu/nanodet/main?label=CI&style=flat)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion config/nanodet-plus-m_320.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ data:
pipeline:
normalize: [[103.53, 116.28, 123.675], [57.375, 57.12, 58.395]]
device:
gpu_ids: [0]
gpu_ids: [0] # Set like [0, 1, 2, 3] if you have multi-GPUs
workers_per_gpu: 10
batchsize_per_gpu: 96
schedule:
Expand Down
61 changes: 38 additions & 23 deletions config/nanodet_custom_xml_dataset.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
#Config File example
save_dir: workspace/nanodet_m
model:
weight_averager:
name: ExpMovingAverager
decay: 0.9998
arch:
name: OneStageDetector
name: NanoDetPlus
detach_epoch: 10
backbone:
name: ShuffleNetV2
model_size: 1.0x
out_stages: [2,3,4]
activation: LeakyReLU
fpn:
name: PAN
name: GhostPAN
in_channels: [116, 232, 464]
out_channels: 96
start_level: 0
num_outs: 3
kernel_size: 5
num_extra_level: 1
use_depthwise: True
activation: LeakyReLU
head:
name: NanoDetHead
num_classes: 80 #Please fill in the number of categories (not include background category)
name: NanoDetPlusHead
num_classes: 80
input_channel: 96
feat_channels: 96
stacked_convs: 2
share_cls_reg: True
octave_base_scale: 5
scales_per_octave: 1
strides: [8, 16, 32]
kernel_size: 5
strides: [8, 16, 32, 64]
activation: LeakyReLU
reg_max: 7
norm_cfg:
type: BN
Expand All @@ -39,6 +44,16 @@ model:
loss_bbox:
name: GIoULoss
loss_weight: 2.0
# Auxiliary head, only use in training time.
aux_head:
name: SimpleConvHead
num_classes: 80
input_channel: 192
feat_channels: 192
stacked_convs: 4
strides: [8, 16, 32, 64]
activation: LeakyReLU
reg_max: 7

class_names: &class_names ['NAME1', 'NAME2', 'NAME3', 'NAME4', '...'] #Please fill in the category names (not include background category)
data:
Expand Down Expand Up @@ -71,27 +86,27 @@ data:
pipeline:
normalize: [[103.53, 116.28, 123.675], [57.375, 57.12, 58.395]]
device:
gpu_ids: [0]
workers_per_gpu: 12
batchsize_per_gpu: 160
gpu_ids: [0] # Set like [0, 1, 2, 3] if you have multi-GPUs
workers_per_gpu: 8
batchsize_per_gpu: 96
schedule:
# resume:
# load_model: YOUR_MODEL_PATH
optimizer:
name: SGD
lr: 0.14
momentum: 0.9
weight_decay: 0.0001
name: AdamW
lr: 0.001
weight_decay: 0.05
warmup:
name: linear
steps: 300
ratio: 0.1
total_epochs: 190
steps: 500
ratio: 0.0001
total_epochs: 300
lr_schedule:
name: MultiStepLR
milestones: [130,160,175,185]
gamma: 0.1
name: CosineAnnealingLR
T_max: 300
eta_min: 0.00005
val_intervals: 10
grad_clip: 35
evaluator:
name: CocoDetectionEvaluator
save_key: mAP
Expand Down
2 changes: 1 addition & 1 deletion tests/test_trainer/test_lightning_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def func(*args, **kwargs):


def test_lightning_training_task():
load_config(cfg, "./config/nanodet-m.yml")
load_config(cfg, "./config/legacy_v0.x_configs/nanodet-m.yml")
task = TrainingTask(cfg)
runner = DummyRunner(task)
runner.test()
2 changes: 1 addition & 1 deletion tests/test_utils/test_flops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


def test_flops():
load_config(cfg, "./config/nanodet-m.yml")
load_config(cfg, "./config/legacy_v0.x_configs/nanodet-m.yml")

model = build_model(cfg.model)
input_shape = (3, 320, 320)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_logger():

logger.log_metrics({"mAP": 30.1}, 1)

load_config(cfg, "./config/nanodet-m.yml")
load_config(cfg, "./config/legacy_v0.x_configs/nanodet-m.yml")
logger.dump_cfg(cfg)

logger.finalize(None)

1 comment on commit efddda7

@VenkataAbhi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is ver goood

Please sign in to comment.