5/20/2023

timm swin transformer v2 model review

 refer to code:


.

import timm
import torch
from PIL import Image
from timm.data import resolve_data_config
from timm.data.transforms_factory import create_transform

# Load from Hub πŸ”₯
model = timm.create_model(
'hf-hub:nateraw/resnet50-oxford-iiit-pet',
pretrained=True
)

# Set model to eval mode for inference
model.eval()

#resolve
print(resolve_data_config(model.pretrained_cfg, model=model))

# Get the labels from the model config
print(model.pretrained_cfg)

# labels
labels = model.pretrained_cfg['label_names']
print(labels)

top_k = min(len(labels), 5)

# Create Transform
transform = create_transform(**resolve_data_config(model.pretrained_cfg, model=model))

# Use your own image file here...
image = Image.open('boxer.jpg').convert('RGB')

# Process PIL image with transforms and add a batch dimension
x = transform(image).unsqueeze(0)

print(x.shape)
# Pass inputs to model forward function to get outputs
out = model(x)
print(out.shape)

# Apply softmax to get predicted probabilities for each class
probabilities = torch.nn.functional.softmax(out[0], dim=0)

print(probabilities)

# Grab the values and indices of top 5 predicted classes
values, indices = torch.topk(probabilities, top_k)

# Prepare a nice dict of top k predictions
predictions = [
{"label": labels[i], "score": v.item()}
for i, v in zip(indices, values)
]
print(predictions)

from torchsummary import summary
input_size = (3, 224, 224)
# Use torchsummary to print the model summary
summary(model, input_size)


# Remove the last layer
model = torch.nn.Sequential(*list(model.children())[:-1])
input_size = (3, 224, 224)
# Use torchsummary to print the model summary
summary(model, input_size)

..

First Summary:

----------------------------------------------------------------

        Layer (type)               Output Shape         Param #

================================================================

            Conv2d-1         [-1, 64, 112, 112]           9,408

       BatchNorm2d-2         [-1, 64, 112, 112]             128

              ReLU-3         [-1, 64, 112, 112]               0

         MaxPool2d-4           [-1, 64, 56, 56]               0

            Conv2d-5           [-1, 64, 56, 56]           4,096

       BatchNorm2d-6           [-1, 64, 56, 56]             128

              ReLU-7           [-1, 64, 56, 56]               0

            Conv2d-8           [-1, 64, 56, 56]          36,864

       BatchNorm2d-9           [-1, 64, 56, 56]             128

         Identity-10           [-1, 64, 56, 56]               0

             ReLU-11           [-1, 64, 56, 56]               0

         Identity-12           [-1, 64, 56, 56]               0

           Conv2d-13          [-1, 256, 56, 56]          16,384

      BatchNorm2d-14          [-1, 256, 56, 56]             512

           Conv2d-15          [-1, 256, 56, 56]          16,384

      BatchNorm2d-16          [-1, 256, 56, 56]             512

             ReLU-17          [-1, 256, 56, 56]               0

       Bottleneck-18          [-1, 256, 56, 56]               0

           Conv2d-19           [-1, 64, 56, 56]          16,384

      BatchNorm2d-20           [-1, 64, 56, 56]             128

             ReLU-21           [-1, 64, 56, 56]               0

           Conv2d-22           [-1, 64, 56, 56]          36,864

      BatchNorm2d-23           [-1, 64, 56, 56]             128

         Identity-24           [-1, 64, 56, 56]               0

             ReLU-25           [-1, 64, 56, 56]               0

         Identity-26           [-1, 64, 56, 56]               0

           Conv2d-27          [-1, 256, 56, 56]          16,384

      BatchNorm2d-28          [-1, 256, 56, 56]             512

             ReLU-29          [-1, 256, 56, 56]               0

       Bottleneck-30          [-1, 256, 56, 56]               0

           Conv2d-31           [-1, 64, 56, 56]          16,384

      BatchNorm2d-32           [-1, 64, 56, 56]             128

             ReLU-33           [-1, 64, 56, 56]               0

           Conv2d-34           [-1, 64, 56, 56]          36,864

      BatchNorm2d-35           [-1, 64, 56, 56]             128

         Identity-36           [-1, 64, 56, 56]               0

             ReLU-37           [-1, 64, 56, 56]               0

         Identity-38           [-1, 64, 56, 56]               0

           Conv2d-39          [-1, 256, 56, 56]          16,384

      BatchNorm2d-40          [-1, 256, 56, 56]             512

             ReLU-41          [-1, 256, 56, 56]               0

       Bottleneck-42          [-1, 256, 56, 56]               0

           Conv2d-43          [-1, 128, 56, 56]          32,768

      BatchNorm2d-44          [-1, 128, 56, 56]             256

             ReLU-45          [-1, 128, 56, 56]               0

           Conv2d-46          [-1, 128, 28, 28]         147,456

      BatchNorm2d-47          [-1, 128, 28, 28]             256

         Identity-48          [-1, 128, 28, 28]               0

             ReLU-49          [-1, 128, 28, 28]               0

         Identity-50          [-1, 128, 28, 28]               0

           Conv2d-51          [-1, 512, 28, 28]          65,536

      BatchNorm2d-52          [-1, 512, 28, 28]           1,024

           Conv2d-53          [-1, 512, 28, 28]         131,072

      BatchNorm2d-54          [-1, 512, 28, 28]           1,024

             ReLU-55          [-1, 512, 28, 28]               0

       Bottleneck-56          [-1, 512, 28, 28]               0

           Conv2d-57          [-1, 128, 28, 28]          65,536

      BatchNorm2d-58          [-1, 128, 28, 28]             256

             ReLU-59          [-1, 128, 28, 28]               0

           Conv2d-60          [-1, 128, 28, 28]         147,456

      BatchNorm2d-61          [-1, 128, 28, 28]             256

         Identity-62          [-1, 128, 28, 28]               0

             ReLU-63          [-1, 128, 28, 28]               0

         Identity-64          [-1, 128, 28, 28]               0

           Conv2d-65          [-1, 512, 28, 28]          65,536

      BatchNorm2d-66          [-1, 512, 28, 28]           1,024

             ReLU-67          [-1, 512, 28, 28]               0

       Bottleneck-68          [-1, 512, 28, 28]               0

           Conv2d-69          [-1, 128, 28, 28]          65,536

      BatchNorm2d-70          [-1, 128, 28, 28]             256

             ReLU-71          [-1, 128, 28, 28]               0

           Conv2d-72          [-1, 128, 28, 28]         147,456

      BatchNorm2d-73          [-1, 128, 28, 28]             256

         Identity-74          [-1, 128, 28, 28]               0

             ReLU-75          [-1, 128, 28, 28]               0

         Identity-76          [-1, 128, 28, 28]               0

           Conv2d-77          [-1, 512, 28, 28]          65,536

      BatchNorm2d-78          [-1, 512, 28, 28]           1,024

             ReLU-79          [-1, 512, 28, 28]               0

       Bottleneck-80          [-1, 512, 28, 28]               0

           Conv2d-81          [-1, 128, 28, 28]          65,536

      BatchNorm2d-82          [-1, 128, 28, 28]             256

             ReLU-83          [-1, 128, 28, 28]               0

           Conv2d-84          [-1, 128, 28, 28]         147,456

      BatchNorm2d-85          [-1, 128, 28, 28]             256

         Identity-86          [-1, 128, 28, 28]               0

             ReLU-87          [-1, 128, 28, 28]               0

         Identity-88          [-1, 128, 28, 28]               0

           Conv2d-89          [-1, 512, 28, 28]          65,536

      BatchNorm2d-90          [-1, 512, 28, 28]           1,024

             ReLU-91          [-1, 512, 28, 28]               0

       Bottleneck-92          [-1, 512, 28, 28]               0

           Conv2d-93          [-1, 256, 28, 28]         131,072

      BatchNorm2d-94          [-1, 256, 28, 28]             512

             ReLU-95          [-1, 256, 28, 28]               0

           Conv2d-96          [-1, 256, 14, 14]         589,824

      BatchNorm2d-97          [-1, 256, 14, 14]             512

         Identity-98          [-1, 256, 14, 14]               0

             ReLU-99          [-1, 256, 14, 14]               0

        Identity-100          [-1, 256, 14, 14]               0

          Conv2d-101         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-102         [-1, 1024, 14, 14]           2,048

          Conv2d-103         [-1, 1024, 14, 14]         524,288

     BatchNorm2d-104         [-1, 1024, 14, 14]           2,048

            ReLU-105         [-1, 1024, 14, 14]               0

      Bottleneck-106         [-1, 1024, 14, 14]               0

          Conv2d-107          [-1, 256, 14, 14]         262,144

     BatchNorm2d-108          [-1, 256, 14, 14]             512

            ReLU-109          [-1, 256, 14, 14]               0

          Conv2d-110          [-1, 256, 14, 14]         589,824

     BatchNorm2d-111          [-1, 256, 14, 14]             512

        Identity-112          [-1, 256, 14, 14]               0

            ReLU-113          [-1, 256, 14, 14]               0

        Identity-114          [-1, 256, 14, 14]               0

          Conv2d-115         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-116         [-1, 1024, 14, 14]           2,048

            ReLU-117         [-1, 1024, 14, 14]               0

      Bottleneck-118         [-1, 1024, 14, 14]               0

          Conv2d-119          [-1, 256, 14, 14]         262,144

     BatchNorm2d-120          [-1, 256, 14, 14]             512

            ReLU-121          [-1, 256, 14, 14]               0

          Conv2d-122          [-1, 256, 14, 14]         589,824

     BatchNorm2d-123          [-1, 256, 14, 14]             512

        Identity-124          [-1, 256, 14, 14]               0

            ReLU-125          [-1, 256, 14, 14]               0

        Identity-126          [-1, 256, 14, 14]               0

          Conv2d-127         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-128         [-1, 1024, 14, 14]           2,048

            ReLU-129         [-1, 1024, 14, 14]               0

      Bottleneck-130         [-1, 1024, 14, 14]               0

          Conv2d-131          [-1, 256, 14, 14]         262,144

     BatchNorm2d-132          [-1, 256, 14, 14]             512

            ReLU-133          [-1, 256, 14, 14]               0

          Conv2d-134          [-1, 256, 14, 14]         589,824

     BatchNorm2d-135          [-1, 256, 14, 14]             512

        Identity-136          [-1, 256, 14, 14]               0

            ReLU-137          [-1, 256, 14, 14]               0

        Identity-138          [-1, 256, 14, 14]               0

          Conv2d-139         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-140         [-1, 1024, 14, 14]           2,048

            ReLU-141         [-1, 1024, 14, 14]               0

      Bottleneck-142         [-1, 1024, 14, 14]               0

          Conv2d-143          [-1, 256, 14, 14]         262,144

     BatchNorm2d-144          [-1, 256, 14, 14]             512

            ReLU-145          [-1, 256, 14, 14]               0

          Conv2d-146          [-1, 256, 14, 14]         589,824

     BatchNorm2d-147          [-1, 256, 14, 14]             512

        Identity-148          [-1, 256, 14, 14]               0

            ReLU-149          [-1, 256, 14, 14]               0

        Identity-150          [-1, 256, 14, 14]               0

          Conv2d-151         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-152         [-1, 1024, 14, 14]           2,048

            ReLU-153         [-1, 1024, 14, 14]               0

      Bottleneck-154         [-1, 1024, 14, 14]               0

          Conv2d-155          [-1, 256, 14, 14]         262,144

     BatchNorm2d-156          [-1, 256, 14, 14]             512

            ReLU-157          [-1, 256, 14, 14]               0

          Conv2d-158          [-1, 256, 14, 14]         589,824

     BatchNorm2d-159          [-1, 256, 14, 14]             512

        Identity-160          [-1, 256, 14, 14]               0

            ReLU-161          [-1, 256, 14, 14]               0

        Identity-162          [-1, 256, 14, 14]               0

          Conv2d-163         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-164         [-1, 1024, 14, 14]           2,048

            ReLU-165         [-1, 1024, 14, 14]               0

      Bottleneck-166         [-1, 1024, 14, 14]               0

          Conv2d-167          [-1, 512, 14, 14]         524,288

     BatchNorm2d-168          [-1, 512, 14, 14]           1,024

            ReLU-169          [-1, 512, 14, 14]               0

          Conv2d-170            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-171            [-1, 512, 7, 7]           1,024

        Identity-172            [-1, 512, 7, 7]               0

            ReLU-173            [-1, 512, 7, 7]               0

        Identity-174            [-1, 512, 7, 7]               0

          Conv2d-175           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-176           [-1, 2048, 7, 7]           4,096

          Conv2d-177           [-1, 2048, 7, 7]       2,097,152

     BatchNorm2d-178           [-1, 2048, 7, 7]           4,096

            ReLU-179           [-1, 2048, 7, 7]               0

      Bottleneck-180           [-1, 2048, 7, 7]               0

          Conv2d-181            [-1, 512, 7, 7]       1,048,576

     BatchNorm2d-182            [-1, 512, 7, 7]           1,024

            ReLU-183            [-1, 512, 7, 7]               0

          Conv2d-184            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-185            [-1, 512, 7, 7]           1,024

        Identity-186            [-1, 512, 7, 7]               0

            ReLU-187            [-1, 512, 7, 7]               0

        Identity-188            [-1, 512, 7, 7]               0

          Conv2d-189           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-190           [-1, 2048, 7, 7]           4,096

            ReLU-191           [-1, 2048, 7, 7]               0

      Bottleneck-192           [-1, 2048, 7, 7]               0

          Conv2d-193            [-1, 512, 7, 7]       1,048,576

     BatchNorm2d-194            [-1, 512, 7, 7]           1,024

            ReLU-195            [-1, 512, 7, 7]               0

          Conv2d-196            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-197            [-1, 512, 7, 7]           1,024

        Identity-198            [-1, 512, 7, 7]               0

            ReLU-199            [-1, 512, 7, 7]               0

        Identity-200            [-1, 512, 7, 7]               0

          Conv2d-201           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-202           [-1, 2048, 7, 7]           4,096

            ReLU-203           [-1, 2048, 7, 7]               0

      Bottleneck-204           [-1, 2048, 7, 7]               0

AdaptiveAvgPool2d-205           [-1, 2048, 1, 1]               0

         Flatten-206                 [-1, 2048]               0

SelectAdaptivePool2d-207                 [-1, 2048]               0

          Linear-208                   [-1, 37]          75,813

================================================================

Total params: 23,583,845

Trainable params: 23,583,845

Non-trainable params: 0

----------------------------------------------------------------

Input size (MB): 0.57

Forward/backward pass size (MB): 307.64

Params size (MB): 89.97

Estimated Total Size (MB): 398.18



Second Summary:


----------------------------------------------------------------

----------------------------------------------------------------

        Layer (type)               Output Shape         Param #

================================================================

            Conv2d-1         [-1, 64, 112, 112]           9,408

       BatchNorm2d-2         [-1, 64, 112, 112]             128

              ReLU-3         [-1, 64, 112, 112]               0

         MaxPool2d-4           [-1, 64, 56, 56]               0

            Conv2d-5           [-1, 64, 56, 56]           4,096

       BatchNorm2d-6           [-1, 64, 56, 56]             128

              ReLU-7           [-1, 64, 56, 56]               0

            Conv2d-8           [-1, 64, 56, 56]          36,864

       BatchNorm2d-9           [-1, 64, 56, 56]             128

         Identity-10           [-1, 64, 56, 56]               0

             ReLU-11           [-1, 64, 56, 56]               0

         Identity-12           [-1, 64, 56, 56]               0

           Conv2d-13          [-1, 256, 56, 56]          16,384

      BatchNorm2d-14          [-1, 256, 56, 56]             512

           Conv2d-15          [-1, 256, 56, 56]          16,384

      BatchNorm2d-16          [-1, 256, 56, 56]             512

             ReLU-17          [-1, 256, 56, 56]               0

       Bottleneck-18          [-1, 256, 56, 56]               0

           Conv2d-19           [-1, 64, 56, 56]          16,384

      BatchNorm2d-20           [-1, 64, 56, 56]             128

             ReLU-21           [-1, 64, 56, 56]               0

           Conv2d-22           [-1, 64, 56, 56]          36,864

      BatchNorm2d-23           [-1, 64, 56, 56]             128

         Identity-24           [-1, 64, 56, 56]               0

             ReLU-25           [-1, 64, 56, 56]               0

         Identity-26           [-1, 64, 56, 56]               0

           Conv2d-27          [-1, 256, 56, 56]          16,384

      BatchNorm2d-28          [-1, 256, 56, 56]             512

             ReLU-29          [-1, 256, 56, 56]               0

       Bottleneck-30          [-1, 256, 56, 56]               0

           Conv2d-31           [-1, 64, 56, 56]          16,384

      BatchNorm2d-32           [-1, 64, 56, 56]             128

             ReLU-33           [-1, 64, 56, 56]               0

           Conv2d-34           [-1, 64, 56, 56]          36,864

      BatchNorm2d-35           [-1, 64, 56, 56]             128

         Identity-36           [-1, 64, 56, 56]               0

             ReLU-37           [-1, 64, 56, 56]               0

         Identity-38           [-1, 64, 56, 56]               0

           Conv2d-39          [-1, 256, 56, 56]          16,384

      BatchNorm2d-40          [-1, 256, 56, 56]             512

             ReLU-41          [-1, 256, 56, 56]               0

       Bottleneck-42          [-1, 256, 56, 56]               0

           Conv2d-43          [-1, 128, 56, 56]          32,768

      BatchNorm2d-44          [-1, 128, 56, 56]             256

             ReLU-45          [-1, 128, 56, 56]               0

           Conv2d-46          [-1, 128, 28, 28]         147,456

      BatchNorm2d-47          [-1, 128, 28, 28]             256

         Identity-48          [-1, 128, 28, 28]               0

             ReLU-49          [-1, 128, 28, 28]               0

         Identity-50          [-1, 128, 28, 28]               0

           Conv2d-51          [-1, 512, 28, 28]          65,536

      BatchNorm2d-52          [-1, 512, 28, 28]           1,024

           Conv2d-53          [-1, 512, 28, 28]         131,072

      BatchNorm2d-54          [-1, 512, 28, 28]           1,024

             ReLU-55          [-1, 512, 28, 28]               0

       Bottleneck-56          [-1, 512, 28, 28]               0

           Conv2d-57          [-1, 128, 28, 28]          65,536

      BatchNorm2d-58          [-1, 128, 28, 28]             256

             ReLU-59          [-1, 128, 28, 28]               0

           Conv2d-60          [-1, 128, 28, 28]         147,456

      BatchNorm2d-61          [-1, 128, 28, 28]             256

         Identity-62          [-1, 128, 28, 28]               0

             ReLU-63          [-1, 128, 28, 28]               0

         Identity-64          [-1, 128, 28, 28]               0

           Conv2d-65          [-1, 512, 28, 28]          65,536

      BatchNorm2d-66          [-1, 512, 28, 28]           1,024

             ReLU-67          [-1, 512, 28, 28]               0

       Bottleneck-68          [-1, 512, 28, 28]               0

           Conv2d-69          [-1, 128, 28, 28]          65,536

      BatchNorm2d-70          [-1, 128, 28, 28]             256

             ReLU-71          [-1, 128, 28, 28]               0

           Conv2d-72          [-1, 128, 28, 28]         147,456

      BatchNorm2d-73          [-1, 128, 28, 28]             256

         Identity-74          [-1, 128, 28, 28]               0

             ReLU-75          [-1, 128, 28, 28]               0

         Identity-76          [-1, 128, 28, 28]               0

           Conv2d-77          [-1, 512, 28, 28]          65,536

      BatchNorm2d-78          [-1, 512, 28, 28]           1,024

             ReLU-79          [-1, 512, 28, 28]               0

       Bottleneck-80          [-1, 512, 28, 28]               0

           Conv2d-81          [-1, 128, 28, 28]          65,536

      BatchNorm2d-82          [-1, 128, 28, 28]             256

             ReLU-83          [-1, 128, 28, 28]               0

           Conv2d-84          [-1, 128, 28, 28]         147,456

      BatchNorm2d-85          [-1, 128, 28, 28]             256

         Identity-86          [-1, 128, 28, 28]               0

             ReLU-87          [-1, 128, 28, 28]               0

         Identity-88          [-1, 128, 28, 28]               0

           Conv2d-89          [-1, 512, 28, 28]          65,536

      BatchNorm2d-90          [-1, 512, 28, 28]           1,024

             ReLU-91          [-1, 512, 28, 28]               0

       Bottleneck-92          [-1, 512, 28, 28]               0

           Conv2d-93          [-1, 256, 28, 28]         131,072

      BatchNorm2d-94          [-1, 256, 28, 28]             512

             ReLU-95          [-1, 256, 28, 28]               0

           Conv2d-96          [-1, 256, 14, 14]         589,824

      BatchNorm2d-97          [-1, 256, 14, 14]             512

         Identity-98          [-1, 256, 14, 14]               0

             ReLU-99          [-1, 256, 14, 14]               0

        Identity-100          [-1, 256, 14, 14]               0

          Conv2d-101         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-102         [-1, 1024, 14, 14]           2,048

          Conv2d-103         [-1, 1024, 14, 14]         524,288

     BatchNorm2d-104         [-1, 1024, 14, 14]           2,048

            ReLU-105         [-1, 1024, 14, 14]               0

      Bottleneck-106         [-1, 1024, 14, 14]               0

          Conv2d-107          [-1, 256, 14, 14]         262,144

     BatchNorm2d-108          [-1, 256, 14, 14]             512

            ReLU-109          [-1, 256, 14, 14]               0

          Conv2d-110          [-1, 256, 14, 14]         589,824

     BatchNorm2d-111          [-1, 256, 14, 14]             512

        Identity-112          [-1, 256, 14, 14]               0

            ReLU-113          [-1, 256, 14, 14]               0

        Identity-114          [-1, 256, 14, 14]               0

          Conv2d-115         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-116         [-1, 1024, 14, 14]           2,048

            ReLU-117         [-1, 1024, 14, 14]               0

      Bottleneck-118         [-1, 1024, 14, 14]               0

          Conv2d-119          [-1, 256, 14, 14]         262,144

     BatchNorm2d-120          [-1, 256, 14, 14]             512

            ReLU-121          [-1, 256, 14, 14]               0

          Conv2d-122          [-1, 256, 14, 14]         589,824

     BatchNorm2d-123          [-1, 256, 14, 14]             512

        Identity-124          [-1, 256, 14, 14]               0

            ReLU-125          [-1, 256, 14, 14]               0

        Identity-126          [-1, 256, 14, 14]               0

          Conv2d-127         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-128         [-1, 1024, 14, 14]           2,048

            ReLU-129         [-1, 1024, 14, 14]               0

      Bottleneck-130         [-1, 1024, 14, 14]               0

          Conv2d-131          [-1, 256, 14, 14]         262,144

     BatchNorm2d-132          [-1, 256, 14, 14]             512

            ReLU-133          [-1, 256, 14, 14]               0

          Conv2d-134          [-1, 256, 14, 14]         589,824

     BatchNorm2d-135          [-1, 256, 14, 14]             512

        Identity-136          [-1, 256, 14, 14]               0

            ReLU-137          [-1, 256, 14, 14]               0

        Identity-138          [-1, 256, 14, 14]               0

          Conv2d-139         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-140         [-1, 1024, 14, 14]           2,048

            ReLU-141         [-1, 1024, 14, 14]               0

      Bottleneck-142         [-1, 1024, 14, 14]               0

          Conv2d-143          [-1, 256, 14, 14]         262,144

     BatchNorm2d-144          [-1, 256, 14, 14]             512

            ReLU-145          [-1, 256, 14, 14]               0

          Conv2d-146          [-1, 256, 14, 14]         589,824

     BatchNorm2d-147          [-1, 256, 14, 14]             512

        Identity-148          [-1, 256, 14, 14]               0

            ReLU-149          [-1, 256, 14, 14]               0

        Identity-150          [-1, 256, 14, 14]               0

          Conv2d-151         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-152         [-1, 1024, 14, 14]           2,048

            ReLU-153         [-1, 1024, 14, 14]               0

      Bottleneck-154         [-1, 1024, 14, 14]               0

          Conv2d-155          [-1, 256, 14, 14]         262,144

     BatchNorm2d-156          [-1, 256, 14, 14]             512

            ReLU-157          [-1, 256, 14, 14]               0

          Conv2d-158          [-1, 256, 14, 14]         589,824

     BatchNorm2d-159          [-1, 256, 14, 14]             512

        Identity-160          [-1, 256, 14, 14]               0

            ReLU-161          [-1, 256, 14, 14]               0

        Identity-162          [-1, 256, 14, 14]               0

          Conv2d-163         [-1, 1024, 14, 14]         262,144

     BatchNorm2d-164         [-1, 1024, 14, 14]           2,048

            ReLU-165         [-1, 1024, 14, 14]               0

      Bottleneck-166         [-1, 1024, 14, 14]               0

          Conv2d-167          [-1, 512, 14, 14]         524,288

     BatchNorm2d-168          [-1, 512, 14, 14]           1,024

            ReLU-169          [-1, 512, 14, 14]               0

          Conv2d-170            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-171            [-1, 512, 7, 7]           1,024

        Identity-172            [-1, 512, 7, 7]               0

            ReLU-173            [-1, 512, 7, 7]               0

        Identity-174            [-1, 512, 7, 7]               0

          Conv2d-175           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-176           [-1, 2048, 7, 7]           4,096

          Conv2d-177           [-1, 2048, 7, 7]       2,097,152

     BatchNorm2d-178           [-1, 2048, 7, 7]           4,096

            ReLU-179           [-1, 2048, 7, 7]               0

      Bottleneck-180           [-1, 2048, 7, 7]               0

          Conv2d-181            [-1, 512, 7, 7]       1,048,576

     BatchNorm2d-182            [-1, 512, 7, 7]           1,024

            ReLU-183            [-1, 512, 7, 7]               0

          Conv2d-184            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-185            [-1, 512, 7, 7]           1,024

        Identity-186            [-1, 512, 7, 7]               0

            ReLU-187            [-1, 512, 7, 7]               0

        Identity-188            [-1, 512, 7, 7]               0

          Conv2d-189           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-190           [-1, 2048, 7, 7]           4,096

            ReLU-191           [-1, 2048, 7, 7]               0

      Bottleneck-192           [-1, 2048, 7, 7]               0

          Conv2d-193            [-1, 512, 7, 7]       1,048,576

     BatchNorm2d-194            [-1, 512, 7, 7]           1,024

            ReLU-195            [-1, 512, 7, 7]               0

          Conv2d-196            [-1, 512, 7, 7]       2,359,296

     BatchNorm2d-197            [-1, 512, 7, 7]           1,024

        Identity-198            [-1, 512, 7, 7]               0

            ReLU-199            [-1, 512, 7, 7]               0

        Identity-200            [-1, 512, 7, 7]               0

          Conv2d-201           [-1, 2048, 7, 7]       1,048,576

     BatchNorm2d-202           [-1, 2048, 7, 7]           4,096

            ReLU-203           [-1, 2048, 7, 7]               0

      Bottleneck-204           [-1, 2048, 7, 7]               0

AdaptiveAvgPool2d-205           [-1, 2048, 1, 1]               0

         Flatten-206                 [-1, 2048]               0

SelectAdaptivePool2d-207                 [-1, 2048]               0

================================================================

Total params: 23,508,032

Trainable params: 23,508,032

Non-trainable params: 0

----------------------------------------------------------------

Input size (MB): 0.57

Forward/backward pass size (MB): 307.64

Params size (MB): 89.68

Estimated Total Size (MB): 397.89

----------------------------------------------------------------


www.marearts.com

πŸ™‡πŸ»‍♂️

No comments:

Post a Comment