Resnet网络模型以及迁移学习

no.6 ResNet网络结构 BN层以及迁移学习详解 (Layer2的生成就有讲究了),由于第一层maxpooling帮第一层提前缩小了size,而layer2没有这么好的资源,他需要自己做这件事,首先在medel中就写了:self.layer2 = self._make_layer(block, 128, blocks_num[1], stride=2),定义了stride=2,进入make layer函数之后,满足stride!获得coco数据集中目标检测,图像分割的第一名。但是残差网络很好的解决了这一问题,如下图,随着网络的加深,反而我们的错误率越低。 阅读详情

1.网络中的亮点

  • 超深的网络结构(突破1000层)
  • 提出residual模块
  • 使用batch normalization加速训练(丢弃dropout)

2.迁移学习简介

2.1.使用迁移学习的优势

  • 能够快速的训练出一个理想的结果
  • 当数据集较小时也能训练出理想的结果

2.2.常见的迁移学习方式

  • 载入权重后训练所有参数
  • 载入权重后只训练最后几层参数
  • 载入权重后在原网络基础上再添加一层全连接层,仅训练最后一个全连接层

2.网络结构

3.batch normalization

目的是使我们的一批(batch)feature map满足均值为0,方差为1的分布规律。

4.ResNeXt网络结构

5.网络模型搭建

import torch.nn as nn
import torch


class BasicBlock(nn.Module):
    expansion = 1

    def __init__(self, in_channel, out_channel, stride=1, downsample=None, **kwargs):
        super(BasicBlock, self).__init__()
        self.conv1 = nn.Conv2d(in_channels=in_channel, out_channels=out_channel,
                               kernel_size=3, stride=stride, padding=1, bias=False)
        self.bn1 = nn.BatchNorm2d(out_channel)
        self.relu = nn.ReLU()
        self.conv2 = nn.Conv2d(in_channels=out_channel, out_channels=out_channel,
                               kernel_size=3, stride=1, padding=1, bias=False)
        self.bn2 = nn.BatchNorm2d(out_channel)
        self.downsample = downsample

    def forward(self, x):
        identity = x
        if self.downsample is not None:
            identity = self.downsample(x)

        out = self.conv1(x)
        out = self.bn1(out)
        out = self.relu(out)

        out = self.conv2(out)
        out = self.bn2(out)

        out += identity
        out = self.relu(out)

        return out


class Bottleneck(nn.Module):

    expansion = 4

    def __init__(self, in_channel, out_channel, stride=1, downsample=None,
                 groups=1, width_per_group=64):
        super(Bottleneck, self).__init__()

        width = int(out_channel * (width_per_group / 64.)) * groups

        self.conv1 = nn.Conv2d(in_channels=in_channel, out_channels=width,
                               kernel_size=1, stride=1, bias=False)  # squeeze channels
        self.bn1 = nn.BatchNorm2d(width)
        # -----------------------------------------
        self.conv2 = nn.Conv2d(in_channels=width, out_channels=width, groups=groups,
                               kernel_size=3, stride=stride, bias=False, padding=1)
        self.bn2 = nn.BatchNorm2d(width)
        # -----------------------------------------
        self.conv3 = nn.Conv2d(in_channels=width, out_channels=out_channel*self.expansion,
                               kernel_size=1, stride=1, bias=False)  # unsqueeze channels
        self.bn3 = nn.BatchNorm2d(out_channel*self.expansion)
        self.relu = nn.ReLU(inplace=True)
        self.downsample = downsample

    def forward(self, x):
        identity = x
        if self.downsample is not None:
            identity = self.downsample(x)

        out = self.conv1(x)
        out = self.bn1(out)
        out = self.relu(out)

        out = self.conv2(out)
        out = self.bn2(out)
        out = self.relu(out)

        out = self.conv3(out)
        out = self.bn3(out)

        out += identity
        out = self.relu(out)

        return out


class ResNet(nn.Module):

    def __init__(self,
                 block,
                 blocks_num,
                 num_classes=1000,
                 include_top=True,
                 groups=1,
                 width_per_group=64):
        super(ResNet, self).__init__()
        self.include_top = include_top
        self.in_channel = 64

        self.groups = groups
        self.width_per_group = width_per_group

        self.conv1 = nn.Conv2d(3, self.in_channel, kernel_size=7, stride=2,
                               padding=3, bias=False)
        self.bn1 = nn.BatchNorm2d(self.in_channel)
        self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        self.layer1 = self._make_layer(block, 64, blocks_num[0])
        self.layer2 = self._make_layer(block, 128, blocks_num[1], stride=2)
        self.layer3 = self._make_layer(block, 256, blocks_num[2], stride=2)
        self.layer4 = self._make_layer(block, 512, blocks_num[3], stride=2)
        if self.include_top:
            self.avgpool = nn.AdaptiveAvgPool2d((1, 1))  # output size = (1, 1)
            self.fc = nn.Linear(512 * block.expansion, num_classes)

        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu')

    def _make_layer(self, block, channel, block_num, stride=1):
        downsample = None
        if stride != 1 or self.in_channel != channel * block.expansion:
            downsample = nn.Sequential(
                nn.Conv2d(self.in_channel, channel * block.expansion, kernel_size=1, stride=stride, bias=False),
                nn.BatchNorm2d(channel * block.expansion))

        layers = []
        layers.append(block(self.in_channel,
                            channel,
                            downsample=downsample,
                            stride=stride,
                            groups=self.groups,
                            width_per_group=self.width_per_group))
        self.in_channel = channel * block.expansion

        for _ in range(1, block_num):
            layers.append(block(self.in_channel,
                                channel,
                                groups=self.groups,
                                width_per_group=self.width_per_group))

        return nn.Sequential(*layers)

    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = self.maxpool(x)

        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        x = self.layer4(x)

        if self.include_top:
            x = self.avgpool(x)
            x = torch.flatten(x, 1)
            x = self.fc(x)

        return x


def resnet34(num_classes=1000, include_top=True):
    # https://download.pytorch.org/models/resnet34-333f7ec4.pth
    return ResNet(BasicBlock, [3, 4, 6, 3], num_classes=num_classes, include_top=include_top)


def resnet50(num_classes=1000, include_top=True):
    # https://download.pytorch.org/models/resnet50-19c8e357.pth
    return ResNet(Bottleneck, [3, 4, 6, 3], num_classes=num_classes, include_top=include_top)


def resnet101(num_classes=1000, include_top=True):
    # https://download.pytorch.org/models/resnet101-5d3b4d8f.pth
    return ResNet(Bottleneck, [3, 4, 23, 3], num_classes=num_classes, include_top=include_top)


def resnext50_32x4d(num_classes=1000, include_top=True):
    # https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth
    groups = 32
    width_per_group = 4
    return ResNet(Bottleneck, [3, 4, 6, 3],
                  num_classes=num_classes,
                  include_top=include_top,
                  groups=groups,
                  width_per_group=width_per_group)


def resnext101_32x8d(num_classes=1000, include_top=True):
    # https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth
    groups = 32
    width_per_group = 8
    return ResNet(Bottleneck, [3, 4, 23, 3],
                  num_classes=num_classes,
                  include_top=include_top,
                  groups=groups,
                  width_per_group=width_per_group)

6.模型训练

import os
import sys
import json

import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms, datasets
from tqdm import tqdm

from model import resnet34


def main():
    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
    print("using {} device.".format(device))

    data_transform = {
        "train": transforms.Compose([transforms.RandomResizedCrop(224),
                                     transforms.RandomHorizontalFlip(),
                                     transforms.ToTensor(),
                                     transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])]),
        "val": transforms.Compose([transforms.Resize(256),
                                   transforms.CenterCrop(224),
                                   transforms.ToTensor(),
                                   transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])}

    data_root = os.path.abspath(os.path.join(os.getcwd(), "../.."))  # get data root path
    image_path = os.path.join(data_root, "data_set", "flower_data")  # flower data set path
    assert os.path.exists(image_path), "{} path does not exist.".format(image_path)
    train_dataset = datasets.ImageFolder(root=os.path.join(image_path, "train"),
                                         transform=data_transform["train"])
    train_num = len(train_dataset)

    # {'daisy':0, 'dandelion':1, 'roses':2, 'sunflower':3, 'tulips':4}
    flower_list = train_dataset.class_to_idx
    cla_dict = dict((val, key) for key, val in flower_list.items())
    # write dict into json file
    json_str = json.dumps(cla_dict, indent=4)
    with open('class_indices.json', 'w') as json_file:
        json_file.write(json_str)

    batch_size = 16
    nw = min([os.cpu_count(), batch_size if batch_size > 1 else 0, 8])  # number of workers
    print('Using {} dataloader workers every process'.format(nw))

    train_loader = torch.utils.data.DataLoader(train_dataset,
                                               batch_size=batch_size, shuffle=True,
                                               num_workers=nw)

    validate_dataset = datasets.ImageFolder(root=os.path.join(image_path, "val"),
                                            transform=data_transform["val"])
    val_num = len(validate_dataset)
    validate_loader = torch.utils.data.DataLoader(validate_dataset,
                                                  batch_size=batch_size, shuffle=False,
                                                  num_workers=nw)

    print("using {} images for training, {} images for validation.".format(train_num,
                                                                           val_num))
    
    net = resnet34()
    # load pretrain weights
    # download url: https://download.pytorch.org/models/resnet34-333f7ec4.pth
    model_weight_path = "./resnet34-pre.pth"
    assert os.path.exists(model_weight_path), "file {} does not exist.".format(model_weight_path)
    net.load_state_dict(torch.load(model_weight_path, map_location='cpu'))
    # for param in net.parameters():
    #     param.requires_grad = False

    # change fc layer structure
    in_channel = net.fc.in_features
    net.fc = nn.Linear(in_channel, 5)
    net.to(device)

    # define loss function
    loss_function = nn.CrossEntropyLoss()

    # construct an optimizer
    params = [p for p in net.parameters() if p.requires_grad]
    optimizer = optim.Adam(params, lr=0.0001)

    epochs = 3
    best_acc = 0.0
    save_path = './resNet34.pth'
    train_steps = len(train_loader)
    for epoch in range(epochs):
        # train
        net.train()
        running_loss = 0.0
        train_bar = tqdm(train_loader, file=sys.stdout)
        for step, data in enumerate(train_bar):
            images, labels = data
            optimizer.zero_grad()
            logits = net(images.to(device))
            loss = loss_function(logits, labels.to(device))
            loss.backward()
            optimizer.step()

            # print statistics
            running_loss += loss.item()

            train_bar.desc = "train epoch[{}/{}] loss:{:.3f}".format(epoch + 1,
                                                                     epochs,
                                                                     loss)

        # validate
        net.eval()
        acc = 0.0  # accumulate accurate number / epoch
        with torch.no_grad():
            val_bar = tqdm(validate_loader, file=sys.stdout)
            for val_data in val_bar:
                val_images, val_labels = val_data
                outputs = net(val_images.to(device))
                # loss = loss_function(outputs, test_labels)
                predict_y = torch.max(outputs, dim=1)[1]
                acc += torch.eq(predict_y, val_labels.to(device)).sum().item()

                val_bar.desc = "valid epoch[{}/{}]".format(epoch + 1,
                                                           epochs)

        val_accurate = acc / val_num
        print('[epoch %d] train_loss: %.3f  val_accuracy: %.3f' %
              (epoch + 1, running_loss / train_steps, val_accurate))

        if val_accurate > best_acc:
            best_acc = val_accurate
            torch.save(net.state_dict(), save_path)

    print('Finished Training')


if __name__ == '__main__':
    main()

 7.模型检验

import os
import json

import torch
from PIL import Image
from torchvision import transforms
import matplotlib.pyplot as plt

from model import resnet34


def main():
    device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

    data_transform = transforms.Compose(
        [transforms.Resize(256),
         transforms.CenterCrop(224),
         transforms.ToTensor(),
         transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])

    # load image
    img_path = "../tulip.jpg"
    assert os.path.exists(img_path), "file: '{}' dose not exist.".format(img_path)
    img = Image.open(img_path)
    plt.imshow(img)
    # [N, C, H, W]
    img = data_transform(img)
    # expand batch dimension
    img = torch.unsqueeze(img, dim=0)

    # read class_indict
    json_path = './class_indices.json'
    assert os.path.exists(json_path), "file: '{}' dose not exist.".format(json_path)

    with open(json_path, "r") as f:
        class_indict = json.load(f)

    # create model
    model = resnet34(num_classes=5).to(device)

    # load model weights
    weights_path = "./resNet34.pth"
    assert os.path.exists(weights_path), "file: '{}' dose not exist.".format(weights_path)
    model.load_state_dict(torch.load(weights_path, map_location=device))

    # prediction
    model.eval()
    with torch.no_grad():
        # predict class
        output = torch.squeeze(model(img.to(device))).cpu()
        predict = torch.softmax(output, dim=0)
        predict_cla = torch.argmax(predict).numpy()

    print_res = "class: {}   prob: {:.3}".format(class_indict[str(predict_cla)],
                                                 predict[predict_cla].numpy())
    plt.title(print_res)
    for i in range(len(predict)):
        print("class: {:10}   prob: {:.3}".format(class_indict[str(i)],
                                                  predict[i].numpy()))
    plt.show()


if __name__ == '__main__':
    main()

 

 

 

 

迁移学习|ResNet18 SGD:适用于需要严格控制训练过程的大规模模型,具有良好的收敛性质,但对学习率敏感。 Adam:具有自适应学习率特性,适用于快速实验和各种模型,但可能在某些情况下收敛到次优点。 AdamW:改进了 Adam 的权重衰减方式,适用于需要严格控制正则化的场景。 RMSProp:适用于处理非平稳目标的问题,如循环神经网络(RNN) 阅读详情

相关推荐

实战 迁移学习 VGG19、ResNet50、InceptionV3 实践 猫狗大战 问题

一、实践流程 1、数据预处理 主要是对训练数据进行随机偏移、转动等变换图像处理,这样可以尽可能让训练数据多样化 另外处理数据方式采用分批无序读取的形式,避免了数据按目录排序训练 #数据准备 def DataGen(self, dir_path, img_row, img_col, batch_size, is_train): if is_train:

pengdali的专栏 2万+

迁移学习:使用Resnet预训练模型构建高效的水果识别模型

迁移学习(Transfer Learning)是一种机器学习方法,就是把为任务 A 开发的模型作为初始点,重新使用在为任务 B 开发模型的过程中。迁移学习是通过从已学习的相关任务中转移知识来改进学习的新任务,虽然大多数机器学习算法都是为了解决单个任务而设计的,但是促进迁移学习的算法的开发是机器学习社区持续关注的话题。迁移学习通俗来讲就是学会举一反三的能力,通过运用已有的知识来学习新的知识,其核心是找到已有知识和新知识之间的相似性,通过这种相似性的迁移达到迁移学习的目的。

十年以上架构设计经验,专注于软件架构和人工智能领域,对机器视觉、NLP、音视频等领域都有涉猎 4311

【深度学习】CV_基于CNN的图像分类模型_代码逐行注释解析

基于CNN的图像分类模型,典型训练策略和网络模型。

ColinCooper的博客 2884

ResNet网络结构,BN以及迁移学习详解

ResNet残差结构详解,以及Batch Normalization和迁移学习的详解

pyscl01的博客 6199

3、中医舌象图像分类方法:基于多特征融合的创新方案

本文提出一种基于多特征融合的中医舌象图像分类方法,结合ResNet-34和VggNet-16网络模型,分别对舌色、苔色、舌形和裂纹四类特征进行提取与分类。通过迁移学习解决样本稀缺问题,采用并行融合策略实现多特征信息互补,提升分类准确性。该方法无需手动特征提取,自动化完成舌象分析,适用于临床辅助诊断、科研及远程医疗,推动中医舌诊向客观化、智能化发展。

study的专栏 143

【数学模型】灰色关联分析

数学模型-灰色关联分析

suic009的博客 1万+

机器学习20:基于ResNet50和FaceNet实现人脸识别

说明: 这是优达学城的一个机器学习作业项目, 我觉得还比较典型综合了几个常见的深度学习技术,值得分享一下;实现包括,数据增广,迁移学习,网络模型构建,训练,评估方法等。 缺点:由于训练数据集规模较小,训练的数据,不确定精确反映网络模型性能;比如ResNet50加载预训练模型权重,相比不加载(随机值),训练后精确度反而稍微较低,与理论不符。 项目3:人脸识别 欢迎来到机器学习工程师纳米学位的第三个项...

科学边界 1万+

MiniMax H3本地部署实战:ComfyUI整合包安装与提速插件验证指南

在AIGC工具链快速演进的当下,本地部署内容生成模型成为许多创作者和开发者的关注焦点。本地部署意味着数据不出本机、可按需定制工作流,还能规避云端排队与外部依赖,其核心价值在于为内容生产提供可控、私密且可编程的生成环境。ComfyUI作为模块化节点式AI绘画工具,凭借灵活的工作流编排和API接口能力,成为承载这类模型的热门平台。MiniMax H3作为支持文本、参考图等多种输入的内容生成模型,与ComfyUI结合后,既适合个人进行概念验证,也能用于团队私有化流程搭建。实际落地过程中,中文整合包显著降低了环境配

weixin_29042035的博客 298

基于PyTorch的卷积神经网络图像分类——猫狗大战(二):使用Pytorch定义网络模型

文章目录1. 需要用到的库2. 模型定义3. 测试 基于上一篇文章https://blog.youkuaiyun.com/linghu8812/article/details/100044971,这次介绍一下网络模型的定义。 1. 需要用到的库 import torch import torch.nn as nn from torchvision.models import resnet50 基于ResNet50定义网络模型,在此基础上进行微调。 2. 模型定义 class CatVSDogNet(nn.Module

linghu8812的博客 926

STM32F4用FSMC驱动AX58100 EtherCAT从站芯片,保姆级配置流程与避坑指南

本文详细介绍了STM32F4通过FSMC接口驱动AX58100 EtherCAT从站芯片的完整配置流程,包括硬件连接、时序优化、协议栈移植及TwinCAT主站集成。针对工业自动化场景,提供高性价比的实时控制解决方案,特别适合机械臂、CNC机床等精确同步应用,并分享关键调试技巧与性能优化方法。

weixin_27869497的博客 308

区域法(zonal method)重构波前

目的:实现区域法的Matlab代码 1.理论介绍 区域法波前重构即从波前探测器测得的波前斜率中恢复出波前的相位值,其分为:休晋模型(Hudgin)[90]、绍契威尔模型(Southwell)[40]和弗雷德模型(Fried)[48]。 1.1 Fried模型,对于N×N微透镜阵列构成的网格: 以3*3的子透镜为例,解释上式,对其展开 改写为矩阵形式: 记作:S=AΦ,A根据N而确定。S是波前探测器测得的斜率,Φ是重构矩阵的相位值。 1.2 而Southwel...

EyRe1的博客 8198

《PaddlePaddle从入门到炼丹》九——迁移学习

前言 在深度学习训练中,例如图像识别训练,每次从零开始训练都要消耗大量的时间和资源。而且当数据集比较少时,模型也难以拟合的情况。基于这种情况下,就出现了迁移学习,通过使用已经训练好的模型来初始化即将训练的网络,可以加快模型的收敛速度,而且还能提高模型的准确率。这个用于初始化训练网络的模型是使用大型数据集训练得到的一个模型,而且模型已经完全收敛。最好训练的模型和预训练的模型是同一个网络,这样可以最大限度地初始化全部层。

夜雨飘零 5588

CNN基础论文 精读+复现---- ResNet(二)

文章目录准备工作BasicBlock块ResNet-18、34网络结构完整代码:小总结 准备工作 昨天把论文读完了,CNN基础论文 精读+复现---- ResNet(一) ,今天用pytorch复现一下。 之前论文中提到过ResNet有很多种,这里复现一下ResNet-18和ResNet34吧,这俩基本一样。 这两种残差块,左边是 18 和34层的,50,101,152用右边的残差快。 ResNet-18,只需要左边的残差块,这俩残差块都实现一下,整体网络实现ResNet-18。 BasicBlock块

深度不学习!!的博客 5858

AUTOSAR实战:手把手教你配置EthTsync模块,搞定车载以太网时间同步

本文详细解析AUTOSAR架构中EthTsync模块的配置方法,实现车载以太网时间同步。通过对比gPTP与PTP协议差异,提供从开发环境准备到参数配置、模块集成的全流程指南,并分享性能优化与调试技巧,帮助开发者实现微秒级同步精度,满足自动驾驶等高精度时间同步需求。

weixin_28736335的博客 376

告别JavaScript!C#通过WebAssembly在浏览器中实现“原生级“性能

C# + WebAssembly:前端开发的革命性替代方案 摘要:本文探讨了C#通过WebAssembly取代JavaScript开发前端应用的新趋势。文章分析了JavaScript的局限性(弱类型、回调地狱等),并详细介绍了C#+WebAssembly组合的优势:强类型系统、高性能、多线程支持和代码重用。技术实现方面,阐述了C#通过Mono/.NET编译为WebAssembly字节码的原理,重点介绍了Blazor框架的两种模式。文章还提供了实战指南,包括项目创建、多线程配置,以及一个与ChatGPT AP

墨夶的博客 946

pytorch下分类神经网络的迁移学习transfer learning

对预训练模型的迁移引用【1】中的提法,分为两种形式 只训练最后fc层的freeze and train以预训练模型为初始参数,训练所有层的finetune 这里只讨论网络结构的变更 finetune model_ft = models.resnet18(pretrained=True) num_ftrs = model_ft.fc.in_features #最后fc层的输入

LXX516的博客 8450

【华为OD机试】真题E卷-一种字符串压缩表示的解压(C++)

有一种简易压缩算法:针对全部为小写英文字母组成的字符串,将其中连续超过两个相同字母的部分压缩为连续个数加该字母,其他部分保持原样不变。例如:字符串aaabbccccd 经过压缩变成字符串 3abb4cd请您编写解压函数,根据输入的字符串, 判断其是否为合法压缩过的字符串若输入合法则输出解压缩后的字符串 否则输出字符串!error来报告错误。

u014481728的博客 895

resnet18实战宝可梦精灵

文件路径 pokemon.py(自定义数据集加载文件) import torch import os,glob import random,csv from torch.utils.data import Dataset,DataLoader from torchvision import transforms from PIL import Image datapath="pokemon" class Pokemon(Dataset): def __init__(self,.

qq_35605081的博客 675

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

神经网络助力器!

各种网络模型解析,写的很好,概念性了解,为了节约时间,直接链接过来 1,CNN进化史 2,卷积神经网络(CNN) 3,循环神经网络(RNN) 4,深度残差网络(DRN)ResNet网络原理 5,深度信念网络(DBN) 6,LeNet 7,AlexNet 8,VGGNet 9,GoogLeNet(从Inception v1到v4的演进) 10,RCNN、Fast RCNN、Fas...

qq_40119386的博客 272

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

CNN、数据预处理、模型保存

读取数据 训练网络模型 比如数据不够,可以对数据进行旋转,翻转等操作来添加数据 例如使用预训练模型 输出为102 定义数据预处理操作 冻结resnet18的函数 改最后一层的,因为默认的是1000输出 设置哪些层需要训练 训练 开始训练

醋酸洋红的博客 1603

python图片分类教程_[深度应用]·实战掌握PyTorch图片分类简明教程

[深度应用]·实战掌握PyTorch图片分类简明教程1.引文深度学习的比赛中,图片分类是很常见的比赛,同时也是很难取得特别高名次的比赛,因为图片分类已经被大家研究的很透彻,一些开源的网络很容易取得高分。如果大家还掌握不了使用开源的网络进行训练,再慢慢去模型调优,很难取得较好的成绩。我们在[PyTorch小试牛刀]实战六·准备自己的数据集用于训练讲解了如何制作自己的数据集用于训练,这个教程在此基础上...

weixin_39610488的博客 157

Task1 赛题理解---学习笔记

*** 网络模型 *** 使用resnet18网络模型,进行迁移学习,保留resnet18网络的卷积网络部分,并保留预训练参数,另外设置5个全连阶层,分别对应5个可能的街道字符的识别,代码如下: model_conv = models.resnet18(pretrained=True) model_conv.avgpool = nn.AdaptiveAvgPool2d(1) model_conv = nn.Sequential(*list(model_conv.children())[:-1]) self.

jiaow的博客 516

吴恩达公开课笔记--第3单元第2周内容

2.1 为什么要进行实例探究 在上一周,我们已经学习了组成神经网络模型的基础构件,如卷积层、池化层、全连接层等内容。本节课主要介绍在计算机视觉领域近些年发展过程中积累的优秀实例,通过实例能够了解学习如何对基础的构件进行组合。从而在以后自己做计算机 视觉相关任务时能够有所启发。 网络总览: 经典的网络模型: LeNet-5 AlexNet VGG 卷积残差网络: ResNet (152层的神经...

CV前沿 308

4、卷积神经网络.(1)

1、边缘检测 Padding 步长 在彩色图像上卷积的具体过程 下面两个过滤器检测红色的垂直边缘,第二个检测三种颜色的垂直边缘,输出为4*4*1 把检测不同角度的边缘的输出叠加起来 加入激活函数 参数 池化层:减小模型大小,加快训练速度,提高所提取特征的鲁棒性 最大池化一般很少用padding填充,不过也有列外 类似L...

qq_34514046的博客 256

cs231n学习记录

cs231n计算机视觉与深度学习课程,学习心得笔记。

ProfSnail的博客 508
上一篇: GoogleNet网络模型
下一篇: MobileNet v1、v2,v3网络模型
Caoyy686868
博客等级 码龄8年 5742粉丝 57原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Caoyy686868

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值