- CrowdNet
https://github.com/davideverona/deep-crowd-counting_crowdnet
https://github.com/mrlzla/crowd_density_estimator
- MCNN
https://github.com/svishwa/crowdcount-mcnn
- MTL
https://github.com/svishwa/crowdcount-cascaded-mtl
- MSCNN
https://github.com/Ling-Bao/mscnn
- MCNN
https://github.com/aditya-vora/crowd_counting_tensorflow
MCNN(
(branch1): Sequential(
(0): Conv2d(3, 16, kernel_size=(9, 9), stride=(1, 1), padding=(4, 4))
(1): ReLU(inplace=True)
(2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(3): Conv2d(16, 32, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(4): ReLU(inplace=True)
(5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(6): Conv2d(32, 16, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(7): ReLU(inplace=True)
(8): Conv2d(16, 8, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(9): ReLU(inplace=True)
)
(branch2): Sequential(
(0): Conv2d(3, 20, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(1): ReLU(inplace=True)
(2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(3): Conv2d(20, 40, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
(4): ReLU(inplace=True)
(5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(6): Conv2d(40, 20, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
(7): ReLU(inplace=True)
(8): Conv2d(20, 10, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
(9): ReLU(inplace=True)
)
(branch3): Sequential(
(0): Conv2d(3, 24, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
(1): ReLU(inplace=True)
(2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(3): Conv2d(24, 48, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): ReLU(inplace=True)
(5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(6): Conv2d(48, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(7): ReLU(inplace=True)
(8): Conv2d(24, 12, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(9): ReLU(inplace=True)
)
(fuse): Sequential(
(0): Conv2d(30, 1, kernel_size=(1, 1), stride=(1, 1))
)
)
(b, 3, 224, 224) --> (b, 1, 56, 56)
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 16, 224, 224] 3,904
ReLU-2 [-1, 16, 224, 224] 0
MaxPool2d-3 [-1, 16, 112, 112] 0
Conv2d-4 [-1, 32, 112, 112] 25,120
ReLU-5 [-1, 32, 112, 112] 0
MaxPool2d-6 [-1, 32, 56, 56] 0
Conv2d-7 [-1, 16, 56, 56] 25,104
ReLU-8 [-1, 16, 56, 56] 0
Conv2d-9 [-1, 8, 56, 56] 6,280
ReLU-10 [-1, 8, 56, 56] 0
Conv2d-11 [-1, 20, 224, 224] 2,960
ReLU-12 [-1, 20, 224, 224] 0
MaxPool2d-13 [-1, 20, 112, 112] 0
Conv2d-14 [-1, 40, 112, 112] 20,040
ReLU-15 [-1, 40, 112, 112] 0
MaxPool2d-16 [-1, 40, 56, 56] 0
Conv2d-17 [-1, 20, 56, 56] 20,020
ReLU-18 [-1, 20, 56, 56] 0
Conv2d-19 [-1, 10, 56, 56] 5,010
ReLU-20 [-1, 10, 56, 56] 0
Conv2d-21 [-1, 24, 224, 224] 1,824
ReLU-22 [-1, 24, 224, 224] 0
MaxPool2d-23 [-1, 24, 112, 112] 0
Conv2d-24 [-1, 48, 112, 112] 10,416
ReLU-25 [-1, 48, 112, 112] 0
MaxPool2d-26 [-1, 48, 56, 56] 0
Conv2d-27 [-1, 24, 56, 56] 10,392
ReLU-28 [-1, 24, 56, 56] 0
Conv2d-29 [-1, 12, 56, 56] 2,604
ReLU-30 [-1, 12, 56, 56] 0
Conv2d-31 [-1, 1, 56, 56] 31
================================================================
Total params: 133,705
Trainable params: 133,705
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 81.85
Params size (MB): 0.51
Estimated Total Size (MB): 82.93
----------------------------------------------------------------
torch.Size([16, 3, 224, 224])
torch.Size([16, 1, 56, 56])
SaCNN(
(feature1): Sequential(
(0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU(inplace=True)
(2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(3): ReLU(inplace=True)
(4): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(5): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(6): ReLU(inplace=True)
(7): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): ReLU(inplace=True)
(9): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(10): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): ReLU(inplace=True)
(12): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(13): ReLU(inplace=True)
(14): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(15): ReLU(inplace=True)
(16): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(17): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(18): ReLU(inplace=True)
(19): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(20): ReLU(inplace=True)
(21): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(22): ReLU(inplace=True)
)
(deconv): ConvTranspose2d(1024, 512, kernel_size=(2, 2), stride=(2, 2))
(relu): ReLU(inplace=True)
(conv5_1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv5_2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv5_3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv6_1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv7_1): Conv2d(1024, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv7_2): Conv2d(512, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(conv7_3): Conv2d(256, 1, kernel_size=(1, 1), stride=(1, 1))
)
torch.Size([16, 3, 224, 224]) ---> torch.Size([16, 1, 28, 28])
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 224, 224] 1,792
ReLU-2 [-1, 64, 224, 224] 0
Conv2d-3 [-1, 64, 224, 224] 36,928
ReLU-4 [-1, 64, 224, 224] 0
MaxPool2d-5 [-1, 64, 112, 112] 0
Conv2d-6 [-1, 128, 112, 112] 73,856
ReLU-7 [-1, 128, 112, 112] 0
Conv2d-8 [-1, 128, 112, 112] 147,584
ReLU-9 [-1, 128, 112, 112] 0
MaxPool2d-10 [-1, 128, 56, 56] 0
Conv2d-11 [-1, 256, 56, 56] 295,168
ReLU-12 [-1, 256, 56, 56] 0
Conv2d-13 [-1, 256, 56, 56] 590,080
ReLU-14 [-1, 256, 56, 56] 0
Conv2d-15 [-1, 256, 56, 56] 590,080
ReLU-16 [-1, 256, 56, 56] 0
MaxPool2d-17 [-1, 256, 28, 28] 0
Conv2d-18 [-1, 512, 28, 28] 1,180,160
ReLU-19 [-1, 512, 28, 28] 0
Conv2d-20 [-1, 512, 28, 28] 2,359,808
ReLU-21 [-1, 512, 28, 28] 0
Conv2d-22 [-1, 512, 28, 28] 2,359,808
ReLU-23 [-1, 512, 28, 28] 0
Conv2d-24 [-1, 512, 14, 14] 2,359,808
ReLU-25 [-1, 512, 14, 14] 0
Conv2d-26 [-1, 512, 14, 14] 2,359,808
ReLU-27 [-1, 512, 14, 14] 0
Conv2d-28 [-1, 512, 14, 14] 2,359,808
ReLU-29 [-1, 512, 14, 14] 0
Conv2d-30 [-1, 512, 14, 14] 2,359,808
ReLU-31 [-1, 512, 14, 14] 0
ConvTranspose2d-32 [-1, 512, 28, 28] 2,097,664
ReLU-33 [-1, 512, 28, 28] 0
Conv2d-34 [-1, 512, 28, 28] 4,719,104
ReLU-35 [-1, 512, 28, 28] 0
Conv2d-36 [-1, 256, 28, 28] 1,179,904
ReLU-37 [-1, 256, 28, 28] 0
Conv2d-38 [-1, 1, 28, 28] 257
================================================================
Total params: 25,071,425
Trainable params: 25,071,425
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 234.29
Params size (MB): 95.64
Estimated Total Size (MB): 330.50
----------------------------------------------------------------
CSRNet(
(front_end): Sequential(
(0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace=True)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
(10): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(12): ReLU(inplace=True)
(13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(14): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(15): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(16): ReLU(inplace=True)
(17): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(18): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(19): ReLU(inplace=True)
(20): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(21): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(22): ReLU(inplace=True)
(23): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(24): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(25): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(26): ReLU(inplace=True)
(27): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(28): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(29): ReLU(inplace=True)
(30): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(31): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(32): ReLU(inplace=True)
)
(back_end): Sequential(
(0): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(4): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace=True)
(6): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(7): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(8): ReLU(inplace=True)
(9): Conv2d(512, 256, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(10): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(11): ReLU(inplace=True)
(12): Conv2d(256, 128, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(13): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(14): ReLU(inplace=True)
(15): Conv2d(128, 64, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(16): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(17): ReLU(inplace=True)
)
(output_layer): Conv2d(64, 1, kernel_size=(1, 1), stride=(1, 1))
)
(b, 3, 224, 224) --> (b, 1, 28, 28)
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 224, 224] 1,792
BatchNorm2d-2 [-1, 64, 224, 224] 128
ReLU-3 [-1, 64, 224, 224] 0
Conv2d-4 [-1, 64, 224, 224] 36,928
BatchNorm2d-5 [-1, 64, 224, 224] 128
ReLU-6 [-1, 64, 224, 224] 0
MaxPool2d-7 [-1, 64, 112, 112] 0
Conv2d-8 [-1, 128, 112, 112] 73,856
BatchNorm2d-9 [-1, 128, 112, 112] 256
ReLU-10 [-1, 128, 112, 112] 0
Conv2d-11 [-1, 128, 112, 112] 147,584
BatchNorm2d-12 [-1, 128, 112, 112] 256
ReLU-13 [-1, 128, 112, 112] 0
MaxPool2d-14 [-1, 128, 56, 56] 0
Conv2d-15 [-1, 256, 56, 56] 295,168
BatchNorm2d-16 [-1, 256, 56, 56] 512
ReLU-17 [-1, 256, 56, 56] 0
Conv2d-18 [-1, 256, 56, 56] 590,080
BatchNorm2d-19 [-1, 256, 56, 56] 512
ReLU-20 [-1, 256, 56, 56] 0
Conv2d-21 [-1, 256, 56, 56] 590,080
BatchNorm2d-22 [-1, 256, 56, 56] 512
ReLU-23 [-1, 256, 56, 56] 0
MaxPool2d-24 [-1, 256, 28, 28] 0
Conv2d-25 [-1, 512, 28, 28] 1,180,160
BatchNorm2d-26 [-1, 512, 28, 28] 1,024
ReLU-27 [-1, 512, 28, 28] 0
Conv2d-28 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-29 [-1, 512, 28, 28] 1,024
ReLU-30 [-1, 512, 28, 28] 0
Conv2d-31 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-32 [-1, 512, 28, 28] 1,024
ReLU-33 [-1, 512, 28, 28] 0
Conv2d-34 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-35 [-1, 512, 28, 28] 1,024
ReLU-36 [-1, 512, 28, 28] 0
Conv2d-37 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-38 [-1, 512, 28, 28] 1,024
ReLU-39 [-1, 512, 28, 28] 0
Conv2d-40 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-41 [-1, 512, 28, 28] 1,024
ReLU-42 [-1, 512, 28, 28] 0
Conv2d-43 [-1, 256, 28, 28] 1,179,904
BatchNorm2d-44 [-1, 256, 28, 28] 512
ReLU-45 [-1, 256, 28, 28] 0
Conv2d-46 [-1, 128, 28, 28] 295,040
BatchNorm2d-47 [-1, 128, 28, 28] 256
ReLU-48 [-1, 128, 28, 28] 0
Conv2d-49 [-1, 64, 28, 28] 73,792
BatchNorm2d-50 [-1, 64, 28, 28] 128
ReLU-51 [-1, 64, 28, 28] 0
Conv2d-52 [-1, 1, 28, 28] 65
================================================================
Total params: 16,272,833
Trainable params: 16,272,833
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 349.51
Params size (MB): 62.08
Estimated Total Size (MB): 412.16
----------------------------------------------------------------
torch.Size([16, 3, 224, 224])
torch.Size([16, 1, 28, 28])
Model(
(vgg): VGG(
(features): Sequential(
(0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace=True)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
(10): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(12): ReLU(inplace=True)
(13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(14): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(15): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(16): ReLU(inplace=True)
(17): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(18): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(19): ReLU(inplace=True)
(20): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(21): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(22): ReLU(inplace=True)
(23): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(24): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(25): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(26): ReLU(inplace=True)
(27): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(28): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(29): ReLU(inplace=True)
(30): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(31): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(32): ReLU(inplace=True)
(33): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(34): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(35): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(36): ReLU(inplace=True)
(37): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(38): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(39): ReLU(inplace=True)
(40): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(41): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(42): ReLU(inplace=True)
)
)
(branch1): Branch1(
(dc): BaseDeconv(
(activation): ReLU()
(deconv): ConvTranspose2d(512, 512, kernel_size=(2, 2), stride=(2, 2))
(bn): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv1): BaseConv(
(activation): ReLU()
(conv): Conv2d(512, 512, kernel_size=(1, 1), stride=(1, 1))
(bn): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv2): BaseConv(
(activation): ReLU()
(conv): Conv2d(512, 256, kernel_size=(9, 9), stride=(1, 1), padding=(4, 4))
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): BaseConv(
(activation): ReLU()
(conv): Conv2d(256, 128, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv4): BaseConv(
(activation): ReLU()
(conv): Conv2d(128, 64, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
(bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv5): BaseConv(
(conv): Conv2d(64, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn): BatchNorm2d(1, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(mp): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
)
(branch2): Branch2(
(conv1): BaseConv(
(activation): ReLU()
(conv): Conv2d(512, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv2): BaseConv(
(activation): ReLU()
(conv): Conv2d(256, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): BaseConv(
(activation): ReLU()
(conv): Conv2d(128, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv4): BaseConv(
(conv): Conv2d(64, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(bn): BatchNorm2d(1, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(branch3): Branch3(
(fc1): BaseLinear(
(activation): ReLU()
(fc): Linear(in_features=512, out_features=32, bias=True)
(drop): Dropout(p=0.5, inplace=False)
)
(fc2): BaseLinear(
(activation): Sigmoid()
(fc): Linear(in_features=32, out_features=1, bias=True)
(drop): Dropout(p=0.5, inplace=False)
)
)
)
(b, 3, 224, 224) --> (b, 1, 14, 14)
D:\Anaconda3\python.exe "E:/Crowd Counting/ASD/model.py"
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 224, 224] 1,792
BatchNorm2d-2 [-1, 64, 224, 224] 128
ReLU-3 [-1, 64, 224, 224] 0
Conv2d-4 [-1, 64, 224, 224] 36,928
BatchNorm2d-5 [-1, 64, 224, 224] 128
ReLU-6 [-1, 64, 224, 224] 0
MaxPool2d-7 [-1, 64, 112, 112] 0
Conv2d-8 [-1, 128, 112, 112] 73,856
BatchNorm2d-9 [-1, 128, 112, 112] 256
ReLU-10 [-1, 128, 112, 112] 0
Conv2d-11 [-1, 128, 112, 112] 147,584
BatchNorm2d-12 [-1, 128, 112, 112] 256
ReLU-13 [-1, 128, 112, 112] 0
MaxPool2d-14 [-1, 128, 56, 56] 0
Conv2d-15 [-1, 256, 56, 56] 295,168
BatchNorm2d-16 [-1, 256, 56, 56] 512
ReLU-17 [-1, 256, 56, 56] 0
Conv2d-18 [-1, 256, 56, 56] 590,080
BatchNorm2d-19 [-1, 256, 56, 56] 512
ReLU-20 [-1, 256, 56, 56] 0
Conv2d-21 [-1, 256, 56, 56] 590,080
BatchNorm2d-22 [-1, 256, 56, 56] 512
ReLU-23 [-1, 256, 56, 56] 0
MaxPool2d-24 [-1, 256, 28, 28] 0
Conv2d-25 [-1, 512, 28, 28] 1,180,160
BatchNorm2d-26 [-1, 512, 28, 28] 1,024
ReLU-27 [-1, 512, 28, 28] 0
Conv2d-28 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-29 [-1, 512, 28, 28] 1,024
ReLU-30 [-1, 512, 28, 28] 0
Conv2d-31 [-1, 512, 28, 28] 2,359,808
BatchNorm2d-32 [-1, 512, 28, 28] 1,024
ReLU-33 [-1, 512, 28, 28] 0
MaxPool2d-34 [-1, 512, 14, 14] 0
Conv2d-35 [-1, 512, 14, 14] 2,359,808
BatchNorm2d-36 [-1, 512, 14, 14] 1,024
ReLU-37 [-1, 512, 14, 14] 0
Conv2d-38 [-1, 512, 14, 14] 2,359,808
BatchNorm2d-39 [-1, 512, 14, 14] 1,024
ReLU-40 [-1, 512, 14, 14] 0
Conv2d-41 [-1, 512, 14, 14] 2,359,808
BatchNorm2d-42 [-1, 512, 14, 14] 1,024
ReLU-43 [-1, 512, 14, 14] 0
VGG-44 [-1, 512, 14, 14] 0
-----------------------------------------------------------------------------------------
以上为VGG的特征提取部分,共43层,13(卷积层)*3(CBR,Conv+BatchNormalization+ReLu) + 4(4层池化层)
-----------------------------------------------------------------------------------------
ConvTranspose2d-45 [-1, 512, 28, 28] 1,049,088
BatchNorm2d-46 [-1, 512, 28, 28] 1,024
ReLU-47 [-1, 512, 28, 28] 0
BaseDeconv-48 [-1, 512, 28, 28] 0
Conv2d-49 [-1, 512, 28, 28] 262,656
BatchNorm2d-50 [-1, 512, 28, 28] 1,024
ReLU-51 [-1, 512, 28, 28] 0
BaseConv-52 [-1, 512, 28, 28] 0
Conv2d-53 [-1, 256, 28, 28] 10,617,088
BatchNorm2d-54 [-1, 256, 28, 28] 512
ReLU-55 [-1, 256, 28, 28] 0
BaseConv-56 [-1, 256, 28, 28] 0
Conv2d-57 [-1, 128, 28, 28] 1,605,760
BatchNorm2d-58 [-1, 128, 28, 28] 256
ReLU-59 [-1, 128, 28, 28] 0
BaseConv-60 [-1, 128, 28, 28] 0
Conv2d-61 [-1, 64, 28, 28] 401,472
BatchNorm2d-62 [-1, 64, 28, 28] 128
ReLU-63 [-1, 64, 28, 28] 0
BaseConv-64 [-1, 64, 28, 28] 0
Conv2d-65 [-1, 1, 28, 28] 577
BaseConv-66 [-1, 1, 28, 28] 0
MaxPool2d-67 [-1, 1, 14, 14] 0
Branch1-68 [-1, 1, 14, 14] 0
Conv2d-69 [-1, 256, 14, 14] 1,179,904
BatchNorm2d-70 [-1, 256, 14, 14] 512
ReLU-71 [-1, 256, 14, 14] 0
BaseConv-72 [-1, 256, 14, 14] 0
Conv2d-73 [-1, 128, 14, 14] 295,040
BatchNorm2d-74 [-1, 128, 14, 14] 256
ReLU-75 [-1, 128, 14, 14] 0
BaseConv-76 [-1, 128, 14, 14] 0
Conv2d-77 [-1, 64, 14, 14] 73,792
BatchNorm2d-78 [-1, 64, 14, 14] 128
ReLU-79 [-1, 64, 14, 14] 0
BaseConv-80 [-1, 64, 14, 14] 0
Conv2d-81 [-1, 1, 14, 14] 577
BaseConv-82 [-1, 1, 14, 14] 0
Branch2-83 [-1, 1, 14, 14] 0
Linear-84 [-1, 32] 16,416
ReLU-85 [-1, 32] 0
Dropout-86 [-1, 32] 0
BaseLinear-87 [-1, 32] 0
Linear-88 [-1, 1] 33
Sigmoid-89 [-1, 1] 0
BaseLinear-90 [-1, 1] 0
Branch3-91 [-1, 1, 1, 1] 0
================================================================
Total params: 30,229,379
Trainable params: 30,229,379
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 360.25
Params size (MB): 115.32
Estimated Total Size (MB): 476.14
----------------------------------------------------------------
torch.Size([16, 3, 224, 224])
torch.Size([16, 1, 14, 14])
同上
PENet(
(encoder): Sequential(
(0): Conv2d(1, 64, kernel_size=(3, 3), stride=(2, 2))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): LeakyReLU(negative_slope=0.2, inplace=True)
(3): Conv2d(64, 128, kernel_size=(3, 3), stride=(2, 2))
(4): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): LeakyReLU(negative_slope=0.2, inplace=True)
(6): Conv2d(128, 256, kernel_size=(3, 3), stride=(2, 2))
(7): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(8): LeakyReLU(negative_slope=0.2, inplace=True)
(9): Conv2d(256, 512, kernel_size=(3, 3), stride=(2, 2))
(10): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(11): LeakyReLU(negative_slope=0.2, inplace=True)
)
(decoder): Sequential(
(0): ConvTranspose2d(512, 256, kernel_size=(3, 3), stride=(2, 2))
(1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): ConvTranspose2d(256, 128, kernel_size=(3, 3), stride=(2, 2))
(4): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace=True)
(6): ConvTranspose2d(128, 64, kernel_size=(3, 3), stride=(2, 2))
(7): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(8): ReLU(inplace=True)
(9): ConvTranspose2d(64, 1, kernel_size=(3, 3), stride=(2, 2))
(10): BatchNorm2d(1, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(11): ReLU(inplace=True)
)
)
P2PNet(
(backbone): Backbone_VGG(
(body1): Sequential(
(0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
(3): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU(inplace=True)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
(10): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(12): ReLU(inplace=True)
)
(body2): Sequential(
(0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(1): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(3): ReLU(inplace=True)
(4): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(5): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(6): ReLU(inplace=True)
(7): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
)
(body3): Sequential(
(0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(1): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(3): ReLU(inplace=True)
(4): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(5): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(6): ReLU(inplace=True)
(7): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
)
(body4): Sequential(
(0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(3): ReLU(inplace=True)
(4): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(5): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(6): ReLU(inplace=True)
(7): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(9): ReLU(inplace=True)
)
)
(regression): RegressionModel(
(conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act1): ReLU()
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act2): ReLU()
(conv3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act3): ReLU()
(conv4): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act4): ReLU()
(output): Conv2d(256, 8, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
)
(classification): ClassificationModel(
(conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act1): ReLU()
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act2): ReLU()
(conv3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act3): ReLU()
(conv4): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(act4): ReLU()
(output): Conv2d(256, 8, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(output_act): Sigmoid()
)
(anchor_points): AnchorPoints()
(fpn): Decoder(
(P5_1): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(P5_upsampled): Upsample(scale_factor=2.0, mode=nearest)
(P5_2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(P4_1): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
(P4_upsampled): Upsample(scale_factor=2.0, mode=nearest)
(P4_2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(P3_1): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1))
(P3_upsampled): Upsample(scale_factor=2.0, mode=nearest)
(P3_2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
)
)