自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 上采样

import torchimport torch.nn as nna = torch.arange(1,5,dtype=torch.float32).view(1,1,2,2)print(a)b = nn.Upsample(scale_factor=2,mode="nearest")#缩放因子print(b(a))#临近上采样c = nn.Upsample(scale_factor...

2020-01-14 18:04:04 162

原创 通道混洗(Channel shuffle)

import torch#通道混洗(Channel shuffle)#目的:在不增加计算量的情况下,使通道充分融合x = torch.randn(4,6,3,3)y = x.reshape(4,2,3,3,3)print(y.shape)z = y.permute(0,2,1,3,4)print(z.shape)v = z.reshape(4,6,3,3)print(v.shap...

2020-01-11 17:35:44 4867 1

原创 残差网络

import torchimport torch.nn as nn#残差class ResNet(nn.Module): def __init__(self): super(ResNet,self).__init__() self.conv = nn.Conv2d(3,6,3,1,padding=1) def forward(self,x):...

2020-01-11 17:15:21 111

原创 分组卷积(计算量)

import torchimport torch.nn as nn#分组卷积N,C_in,H,W,C_out = 10,4,16,16,4x = torch.randn(N,C_in,H,W)conv = nn.Conv2d(C_in,C_out,3,1,padding=0,bias=False)conv_group = nn.Conv2d(C_in,C_out,3,1,padding...

2020-01-10 13:15:26 1030

原创 对图像进行简单卷积和池化

import torchimport torch.nn as nnfrom PIL import Imageimport numpy as npimg = Image.open("pic1.jpeg")#加载图片img = np.array(img)#转为numpy形式#print(img.shape)img = np.reshape(img,(1,1244,700,3))#转为N...

2020-01-09 17:25:54 313

原创 python生成随机验证码(2)

from PIL import Image,ImageDraw,ImageFont#图片,画画,字体import random随机的字母def randChar():# return random.randint(65,90)#随机整数return chr(random.randint(65,90))#随机字母print(randChar())# 编码表随机颜色def randCo...

2020-01-07 15:17:36 101

原创 python生成随机验证码(OOP)

import randomdef getcode():return chr(random.randint(65,90))def getforeground():return (random.randint(60,120),random.randint(60,120),random.randint(60,120))def getbackground():return (random.ra...

2020-01-07 15:16:05 120

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除