Skip to content

Commit 0d74cd8

Browse files
authored
Merge pull request open-mmlab#21 from hellock/docs
Add some instructions of customizing models
2 parents 6efefa2 + 6f42838 commit 0d74cd8

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

TECHNICAL_DETAILS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,50 @@ such as `SingleStageDetector` and `TwoStageDetector`.
3030
Following some basic pipelines (e.g., two-stage detectors), the model structure
3131
can be customized through config files with no pains.
3232

33+
If we want to implement some new components, e.g, the path aggregation
34+
FPN structure in [Path Aggregation Network for Instance Segmentation](https://arxiv.org/abs/1803.01534), there are two things to do.
35+
36+
1. create a new file in `mmdet/models/necks/pafpn.py`.
37+
38+
```python
39+
class PAFPN(nn.Module):
40+
41+
def __init__(self,
42+
in_channels,
43+
out_channels,
44+
num_outs,
45+
start_level=0,
46+
end_level=-1,
47+
add_extra_convs=False):
48+
pass
49+
50+
def forward(self, inputs):
51+
# implementation is ignored
52+
pass
53+
```
54+
55+
2. modify the config file from
56+
57+
```python
58+
neck=dict(
59+
type='FPN',
60+
in_channels=[256, 512, 1024, 2048],
61+
out_channels=256,
62+
num_outs=5)
63+
```
64+
65+
to
66+
67+
```python
68+
neck=dict(
69+
type='PAFPN',
70+
in_channels=[256, 512, 1024, 2048],
71+
out_channels=256,
72+
num_outs=5)
73+
```
74+
75+
We will release more components (backbones, necks, heads) for research purpose.
76+
3377
### Write a new model
3478

3579
To write a new detection pipeline, you need to inherit from `BaseDetector`,

0 commit comments

Comments
 (0)