打赏

随笔分类 -  深度学习

1
深度学习学习心得
摘要:windows下安装conda和安装GPU版本的tensorflow和pytorch 驱动下载 查看自己电脑的独立显卡型号 如:NVIDIA GeForce RTX 3060 在查看自己电脑是否已经安装了显卡驱动,如果显卡可用,那么就是安装了驱动;否则就要到NVIDIA官网下载驱动 NVIDIA驱动 阅读全文
posted @ 2023-10-08 23:26 不像话 阅读(199) 评论(0) 推荐(0) 编辑
摘要:import os import urllib.request import zipfile from pprint import pprint import numpy as np import tensorflow as tf import keras as k def set_session( 阅读全文
posted @ 2023-10-05 16:19 不像话 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#Tensofrlow #假设我们有一个任务是从图像中预测物体的位置(x坐标和y坐标)和物体的类别。这个任务有三个目标标签:x坐标、y坐标和类别。 import numpy as np import tensorflow as tf from tensorflow import keras from 阅读全文
posted @ 2023-10-04 14:47 不像话 阅读(146) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l class Inception(nn.Module): # c1-c4是每条路径的输出通道数 def 阅读全文
posted @ 2023-08-06 14:47 不像话 阅读(13) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l def nin_block(in_channels,out_channels,kernel_size,strides,padding): return nn.Sequenti 阅读全文
posted @ 2023-08-06 14:45 不像话 阅读(11) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l def vgg_block(num_convs,in_channels,out_channels): layers = [] for _ in range(num_convs 阅读全文
posted @ 2023-08-06 14:44 不像话 阅读(16) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l net = nn.Sequential( # (224-11+1+2)/4=54 nn.Conv2d(1,96,kernel_size=11,stride=4,padding 阅读全文
posted @ 2023-08-06 14:41 不像话 阅读(6) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l class Reshape(torch.nn.Module): def forward(self,x): # 批量大小默认,输出通道为1 return x.view(-1,1 阅读全文
posted @ 2023-08-06 14:39 不像话 阅读(20) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l # 实现池化层的正向传播 def pool2d(x,pool_size,mode='max'): # 获取窗口大小 p_h,p_w=pool_size # 获取偏移量 y=t 阅读全文
posted @ 2023-08-06 14:35 不像话 阅读(11) 评论(0) 推荐(0) 编辑
摘要:import torch from d2l import torch as d2l from torch import nn # 多输入通道互相关运算 def corr2d_multi_in(x,k): # zip对每个通道配对,返回一个可迭代对象,其中每个元素是一个(x,k)元组,表示一个输入通道 阅读全文
posted @ 2023-08-06 14:33 不像话 阅读(52) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn def comp_conv2d(conv2d,x): # 在维度前面加上通道数和批量大小数1 x=x.reshape((1,1)+x.shape) # 得到4维 y=conv2d(x) # 把前面两维去掉 return y.resh 阅读全文
posted @ 2023-08-06 14:31 不像话 阅读(34) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l def corr2d(x,k): """计算二维互相关运算""" # 获取卷积核的高和宽 h,w=k.shape # 输出的高和宽 y=torch.zeros((x.shap 阅读全文
posted @ 2023-08-06 14:29 不像话 阅读(13) 评论(0) 推荐(0) 编辑
摘要:import os os.environ['KMP_DUPLICATE_LIB_OK']='True' import hashlib import tarfile import zipfile import requests import numpy as np import pandas as p 阅读全文
posted @ 2023-08-06 13:37 不像话 阅读(13) 评论(0) 推荐(0) 编辑
摘要:# 深度学习基础-李沐课程跟学 ## 基础知识 * 深度学习与经典方法的区别主要在于:前者关注功能强大的模型,这些模型有神经网络错综复杂的交织在一起,包含层层数据转换,因此被成为深度学习。 * 所谓“学习”是指模型自主提高完成某些任务的性能。在机器学习中,我们需要定义对模型的优劣程度的度量,这个度量 阅读全文
posted @ 2023-07-30 14:20 不像话 阅读(15) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l def dropout_layer(x,dropout): assert 0<= dropout <=1 if dropout ==1: return torch.zeros 阅读全文
posted @ 2023-07-30 14:01 不像话 阅读(8) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l # 将数据做的很小,这样容易实现过拟合 n_train, n_test, num_inputs, batch_size = 20, 100, 200, 5 true_w, t 阅读全文
posted @ 2023-07-30 13:57 不像话 阅读(5) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l batch_size = 256 train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size) num_in 阅读全文
posted @ 2023-07-29 09:22 不像话 阅读(10) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l batch_size = 256 train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size) # PyTo 阅读全文
posted @ 2023-07-29 09:16 不像话 阅读(14) 评论(0) 推荐(0) 编辑
摘要:import torch from IPython import display from d2l import torch as d2l # from d2l.mxnet import Accumulator batch_size = 256 # 每次读256张图片,返回训练iter和测试iter 阅读全文
posted @ 2023-07-29 09:14 不像话 阅读(12) 评论(0) 推荐(0) 编辑
摘要:import random import torch from d2l import torch as d2l def synthetic_data(w,b,num_examples): """生成y=Xw+b+噪声""" x = torch.normal(0,1,(num_examples,len 阅读全文
posted @ 2023-07-29 08:12 不像话 阅读(12) 评论(0) 推荐(0) 编辑

1
点击右上角即可分享
微信分享提示