文章分类 -  跟李沐动手学pytorch

1 2 3 下一页
13.5 多尺度锚框
摘要:13.5.0 头文件 import torch from d2l import torch as d2l from matplotlib import pyplot as plt d2l.set_figsize() 13.5.1 读入图像 img = d2l.plt.imread('../img/c 阅读全文
posted @ 2022-12-01 15:29 yc-limitless 阅读(130) 评论(0) 推荐(0)
13.4 锚框
摘要:13.4.0 头文件 import torch from d2l import torch as d2l from matplotlib import pyplot as plt d2l.set_figsize() torch.set_printoptions(2) # 精简输出精度 # 宽高比r是 阅读全文
posted @ 2022-12-01 09:27 yc-limitless 阅读(355) 评论(0) 推荐(0)
13.6 目标检测数据集
摘要:13.6.0 头文件 import os import pandas as pd import torch import torchvision from d2l import torch as d2l from matplotlib import pyplot as plt 13.6.1 下载ba 阅读全文
posted @ 2022-11-27 15:26 yc-limitless 阅读(424) 评论(0) 推荐(0)
13.2 微调
摘要:13.2.0 头文件 # 通过微调在ImageNet数据集上预训练得到的ResNet模型,得到新的微调模型 # 利用新的微调模型在一个小型数据集上识别图像中是否包含热狗 import os import torch import torchvision from torch import nn fr 阅读全文
posted @ 2022-11-27 13:25 yc-limitless 阅读(164) 评论(0) 推荐(0)
12.6 多GPU训练网络模型的简洁实现
摘要:12.6.0 头文件 import torch from torch import nn from d2l import torch as d2l 12.6.1 定义ResNet-18网络模型 # 定义ResNet-18网络模型 def resnet18(num_classes, in_channe 阅读全文
posted @ 2022-11-26 23:41 yc-limitless 阅读(164) 评论(0) 推荐(0)
12.5 多GPU训练的手动实现
摘要:12.5.0 头文件 import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l 12.5.1 创建网络模型并初始化模型参数 # 初始化模型参数 scale = 阅读全文
posted @ 2022-11-26 21:40 yc-limitless 阅读(145) 评论(0) 推荐(0)
13.1图像增广
摘要:13.1.0 头文件 import torch import torchvision from torch import nn from d2l import torch as d2l from matplotlib import pyplot as plt d2l.set_figsize() 13 阅读全文
posted @ 2022-11-24 16:26 yc-limitless 阅读(97) 评论(0) 推荐(0)
13.3 目标检测和边界框
摘要:13.3.0头文件 import torch from d2l import torch as d2l from matplotlib import pyplot as plt d2l.set_figsize() 13.3.1 边界框坐标转换 # 把框框的(左上(x,y),右下(x,y))坐标转换为 阅读全文
posted @ 2022-11-24 14:23 yc-limitless 阅读(147) 评论(0) 推荐(0)
7.6 批量归一化层
摘要:7.6.0 头文件 import torch from torch import nn from d2l import torch as d2l import pandas as pd import numpy as np from matplotlib import pyplot as plt t 阅读全文
posted @ 2022-11-24 10:27 yc-limitless 阅读(136) 评论(0) 推荐(0)
7.5 GoogLeNet
摘要:7.5.0 头文件 import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l from matplotlib import pyplot as plt 7.5 阅读全文
posted @ 2022-11-17 22:45 yc-limitless
7.4 NIN
摘要:7.4.0 头文件 import torch from torch import nn from d2l import torch as d2l from matplotlib import pyplot as plt 7.4.1 NiN网络模型 # 创建一个NiN块,NiN块包含三个卷积层,第一个 阅读全文
posted @ 2022-11-17 19:41 yc-limitless
7.3 VGG
摘要:7.3.0 头文件 import torch from torch import nn from d2l import torch as d2l from matplotlib import pyplot as plt 7.3.1 定义VGG11网络模型 # num_convs:该VGG块中包含的卷 阅读全文
posted @ 2022-11-17 16:36 yc-limitless
7.2 AlexNet
摘要:7.2.0 头文件 import torch from torch import nn from d2l import torch as d2l from matplotlib import pyplot as plt 7.2.1 定义AlexNet网络模型 # 定义AlexNet网络模型 net 阅读全文
posted @ 2022-11-10 16:49 yc-limitless
7.1 LeNet
摘要:对卷积网络的形象理解: 卷积网络在形式上类似于人民代表大会制度,卷积核相当于候选人,多个卷积核就相当于多个候选人,图像中不同的特征会激活不同的卷积核,池化层起着类似于合票的作用,代表着一个区域的得分,全连接层相当于对每个区域选出来的代表进行最终的投票 7.1.0 头文件 import torch f 阅读全文
posted @ 2022-11-09 21:28 yc-limitless
6.5 池化层
摘要:6.5.0 头文件 import torch from torch import nn from d2l import torch as d2l 6.5.1 自定义的图像池化操作 # X:待池化图像 pool_size池化尺寸 mode池化模式 # 对图像在每个通道上分别进行最大池化或平均池化,最后 阅读全文
posted @ 2022-11-09 17:01 yc-limitless
6.4 多输入通道与多输出通道
摘要:6.4.0 头文件 import torch from d2l import torch as d2l 6.4.1 多输入通道单输出通道卷积运算 # 定义多输入通道单输出通道卷积运算:将输入图像的第一个通道与卷积核第一个通道进行卷积运算,将输入图像的第二个通道与卷积核第二个通道进行卷积运算,依此类推 阅读全文
posted @ 2022-11-09 16:28 yc-limitless
6.3 填充和步幅
摘要:import torch from torch import nn # conv2d:卷积模型 # X:待卷积的图像(行数,列数) # 定义一个进行卷积操作的函数,返回卷积操作后的图像(不包含批量大小和通道数) def comp_conv2d(conv2d, X): # 把X维度扩充为(批量大小,通 阅读全文
posted @ 2022-11-09 15:30 yc-limitless
6.2 图像卷积
摘要:6.2.0 头文件 import torch from torch import nn from d2l import torch as d2l 6.2.1 图像与卷积核的卷积操作 # X:待卷积的图像 # K:卷积核 # 将图像X与卷积核K进行卷积操作,返回卷积的结果(无填充) def corr2 阅读全文
posted @ 2022-11-08 23:45 yc-limitless
5.4 张量和模型参数的导入与导出
摘要:5.4.0 头文件 import torch from torch import nn from torch.nn import functional as F 5.4.1 把张量保存在本地,从本地导入张量 # 定义一个张量 x = torch.arange(4) # 将张量x保存在本地x-file 阅读全文
posted @ 2022-11-08 17:01 yc-limitless
5.3 层
摘要:5.3.0 头文件 import torch import torch.nn.functional as F from torch import nn 5.3.1 定义不带参数的层 # 定义不带参数的层 class CenteredLayer(nn.Module): def __init__(sel 阅读全文
posted @ 2022-11-08 15:22 yc-limitless

1 2 3 下一页