当前位置:   article > 正文

根据Resnet论文复现 Resnet50 Restnet101 Resnet152 pytorch实现_resnet50、101、150

resnet50、101、150

根据Resnet论文复现 Resnet50 Restnet101 Resnet152

Resnet的构成
在这里插入图片描述

代码

import torch
import torch.nn as nn
from torch.nn import (
    Module,
    Conv2d,
    MaxPool2d,
    AvgPool2d,
    Linear,
    Softmax,
    ReLU,
    BatchNorm2d,
    Sequential
)


def Conv1(in_channel=3, out_channel=64, kernel_size=(7, 7), stride=2, padding=3):
    return Sequential(
        Conv2d(in_channels=in_channel, out_channels=out_channel, kernel_size=kernel_size, stride=stride, padding=padding),
        MaxPool2d(kernel_size=(3, 3), stride=2, padding=1)
    )


class BottleNeck(Module):
    def __init__(self, in_channel, out_channel, stride=1, downsampling=False, expansion=4):
        super(BottleNeck, self).__init__()
        self
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
  

闽ICP备14008679号