Skip to content

Commit 502bccc

Browse files
committed
readme
1 parent 500a33c commit 502bccc

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

README.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Check all parameters with `pprint` method:
4949
```python
5050
mc.pprint()
5151
```
52+
<details open>
53+
<summary>Output</summary>
54+
5255
name: MC
5356
in_chans: 3
5457
num_classes: 1000
@@ -76,6 +79,7 @@ mc.pprint()
7679
make_body: <function make_body at 0x7f064c7cd750>
7780
make_head: <function make_head at 0x7f064c7cd7e0>
7881

82+
</details>
7983

8084

8185
Now we have model constructor, default setting as xresnet18. And we can get model after call it.
@@ -86,6 +90,9 @@ Now we have model constructor, default setting as xresnet18. And we can get mode
8690
model = mc()
8791
model
8892
```
93+
<details >
94+
<summary>Output</summary>
95+
8996
Sequential(
9097
MC
9198
(stem): Sequential(
@@ -255,7 +262,7 @@ model
255262
(fc): Linear(in_features=512, out_features=1000, bias=True)
256263
)
257264
)
258-
265+
</details>
259266

260267

261268
If you want to change model, just change constructor parameters.
@@ -274,6 +281,9 @@ Now we can look at model parts - stem, body, head.
274281

275282
mc.body
276283
```
284+
<details >
285+
<summary>Output</summary>
286+
277287
Sequential(
278288
(l_0): Sequential(
279289
(bl_0): ResBlock(
@@ -615,7 +625,7 @@ mc.body
615625
)
616626
)
617627
)
618-
628+
</details>
619629

620630

621631
## Create constructor from config.
@@ -632,7 +642,11 @@ from model_constructor import ModelCfg
632642
cfg = ModelCfg()
633643
print(cfg)
634644
```
645+
<details open>
646+
<summary>Output</summary>
647+
635648
name='MC' in_chans=3 num_classes=1000 block=<class 'model_constructor.model_constructor.ResBlock'> conv_layer=<class 'model_constructor.layers.ConvBnAct'> block_sizes=[64, 128, 256, 512] layers=[2, 2, 2, 2] norm=<class 'torch.nn.modules.batchnorm.BatchNorm2d'> act_fn=ReLU(inplace=True) pool=AvgPool2d(kernel_size=2, stride=2, padding=0) expansion=1 groups=1 dw=False div_groups=None sa=False se=False se_module=None se_reduction=None bn_1st=True zero_bn=True stem_stride_on=0 stem_sizes=[32, 32, 64] stem_pool=MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False) stem_bn_end=False init_cnn=None make_stem=None make_layer=None make_body=None make_head=None
649+
</details>
636650

637651

638652
Now we can create constructor from config:
@@ -711,6 +725,9 @@ Here is model:
711725

712726
mc()
713727
```
728+
<details >
729+
<summary>Output</summary>
730+
714731
Sequential(
715732
MxResNet
716733
(stem): Sequential(
@@ -880,7 +897,7 @@ mc()
880897
(fc): Linear(in_features=512, out_features=1000, bias=True)
881898
)
882899
)
883-
900+
</details>
884901

885902

886903
## MXResNet50
@@ -917,19 +934,27 @@ mc
917934

918935
mc.stem.conv_1
919936
```
920-
ConvBnAct(
921-
(conv): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
922-
(bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
923-
(act_fn): Mish()
924-
)
925937

938+
<details open>
939+
<summary>Output</summary>
940+
941+
ConvBnAct(
942+
(conv): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1),
943+
bias=False)
944+
(bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
945+
(act_fn): Mish()
946+
)
947+
</details>
926948

927949

928950

929951
```python
930952

931953
mc.body.l_0.bl_0
932954
```
955+
<details >
956+
<summary>Output</summary>
957+
933958
ResBlock(
934959
(convs): Sequential(
935960
(conv_0): ConvBnAct(
@@ -955,6 +980,7 @@ mc.body.l_0.bl_0
955980
)
956981
(act_fn): Mish()
957982
)
983+
</details>
958984

959985

960986

@@ -998,6 +1024,8 @@ That all. Now we have YaResNet constructor
9981024
mc.name = 'YaResNet'
9991025
mc.pprint()
10001026
```
1027+
<details open>
1028+
<summary>Output</summary>
10011029

10021030
name: YaResNet
10031031
in_chans: 3
@@ -1026,6 +1054,7 @@ mc.pprint()
10261054
make_body: <function make_body at 0x7f064c7cd750>
10271055
make_head: <function make_head at 0x7f064c7cd7e0>
10281056

1057+
</details>
10291058

10301059

10311060
Let see what we have.
@@ -1035,6 +1064,9 @@ Let see what we have.
10351064

10361065
mc.body.l_1.bl_0
10371066
```
1067+
<details >
1068+
<summary>Output</summary>
1069+
10381070
YaResBlock(
10391071
(reduce): AvgPool2d(kernel_size=2, stride=2, padding=0)
10401072
(convs): Sequential(
@@ -1059,5 +1091,5 @@ mc.body.l_1.bl_0
10591091
)
10601092
(merge): Mish()
10611093
)
1062-
1094+
</details>
10631095

0 commit comments

Comments
 (0)