FasterNet
FasterNet copied to clipboard
On the inconsistency between the printed network structure and the paper
Hello, author I added at the end of models/fasternet.py
if __name__ == "__main__":
model = FasterNet(
mlp_ratio=2.0,
embed_dim=128,
depths=(1, 2, 13, 2),
drop_path_rate=0.15,
act_layer='RELU',
fork_feat=True,
)
print(model)
Try to print the network structure, and the result is
If for detection, please install mmdetection first
FasterNet(
(patch_embed): PatchEmbed(
(proj): Conv2d(3, 128, kernel_size=(4, 4), stride=(4, 4), bias=False)
(norm): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(stages): Sequential(
(0): BasicStage(
(blocks): Sequential(
(0): MLPBlock(
(drop_path): Identity()
(mlp): Sequential(
(0): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
)
(spatial_mixing): Partial_conv3(
(partial_conv3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
)
)
)
(1): PatchMerging(
(reduction): Conv2d(128, 256, kernel_size=(2, 2), stride=(2, 2), bias=False)
(norm): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(2): BasicStage(
(blocks): Sequential(
(0): MLPBlock(
(drop_path): DropPath(drop_prob=0.009)
(mlp): Sequential(
(0): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
)
(spatial_mixing): Partial_conv3(
(partial_conv3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
)
(1): MLPBlock(
(drop_path): DropPath(drop_prob=0.018)
(mlp): Sequential(
(0): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
)
(spatial_mixing): Partial_conv3(
(partial_conv3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
)
)
)
(3): PatchMerging(
(reduction): Conv2d(256, 512, kernel_size=(2, 2), stride=(2, 2), bias=False)
(norm): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
........
As you can see from here.
(mlp): Sequential(
(0): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
)
(spatial_mixing): Partial_conv3(
(partial_conv3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
It goes through two 1x1 convolutions and then 3x3. Contrary to the paper, I don't know if there is something wrong with my understanding. I hope you can give me some advice.thinks 👍 :)