自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

森林之王

我们的目标是星辰大海

  • 博客(254)
  • 收藏
  • 关注

原创 minist利用训练好的model推断并且可视化

import torchfrom torchvision import transformsfrom torchvision import datasetsimport torchvision as tvfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimimport osimport numpy as npbatch_size = 64t

2021-04-15 22:08:26 1

原创 tv.utils.make_grid

import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderfrom torchvision.transforms import ToPILImageimport torch.nn.functional as Fimport torch.optim as optimimport torch.nn as nnimport

2021-04-15 16:55:25 1

原创 ToPILImage

import matplotlib.pyplot as pltimport numpy as npshow = ToPILImage()data = torch.rand(3,64,128)data = show(data)plt.imshow(data)plt.show()

2021-04-15 16:18:41 7

原创 pytorch网络可学习参数

import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimbatch_size = 64transform = transforms.Compose([ transforms.ToTensor(

2021-04-15 10:22:51 5

原创 反向传播梯度的计算

import torch as tfrom torch.autograd import Variable as Vdef f(x): # 计算输出值 y = x ** 2 * t.exp(x) return ydef gradf(x): # 手动计算梯度 dx = 2 * x * t.exp(x) + x ** 2 * t.exp(x) return dxx = V(t.randn(3, 4), requires_grad=True)y = f(x

2021-04-14 23:12:46 4

原创 查看tensor的形状,行列大小

torch.size是tuple(元组的子类,因此他支持元组所有的操作,如x.size()[0]import pandas as pdimport numpy as npimport torchx = torch.rand(5,3)print(x.size())print(x.size()[0])print(x.size()[1])torch.Size([5, 3])53

2021-04-14 22:42:13 6

原创 one hot 编码

方式1import torchindex = [0,1,2,3,4,5,6,7,8,9]onehot = pd.get_dummies(index)onehot = np.array(onehot)onehot = torch.tensor(onehot)print(onehot)方式2import numpy as npimport torchindex = torch.tensor([0,1,2,3,4,5,6,7,8,9])t = torch.zeros(10,10)

2021-04-13 23:06:46 14

原创 pytorch18种损失函数全详解

https://blog.csdn.net/nstarlds/article/details/104733459/

2021-04-12 22:47:35 10

原创 PyCharm取消启动时自动加载项目

取消勾选效果

2021-04-12 10:14:03 8

原创 cbir

核心问题1需要用什么样的特征去表征图像网络hog,sift,gist基于具体的场景目标去训练卷积神经网络提取神经网络生成输出作为特征2如何定义相似各种距离准则3高维空间里面如何高效的查找最近邻ANN算法大有帮助卷积神经网训练的同时学习分桶桶号hog特征抽取0605年cvpr预先划分数据ANN库FLANN库...

2021-04-10 14:39:30 13

原创 argparse库的使用

import argparseparser = argparse.ArgumentParser(description='Process some integers.')parser.add_argument('integers', metavar='N', type=int, nargs='+', help='an integer for the accumulator')parser.add_argument('--sum', dest='accumula

2021-04-09 10:11:18 4

原创 python 工程生成requirements

https://blog.csdn.net/u014439564/article/details/99624361?ops_request_misc=&request_id=&biz_id=102&utm_term=pipreqs&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-6-99624361.pc_search_result_no_baidu_js

2021-04-08 10:29:05 7

原创 MINIST 数据展示代码可视化minist(深入浅出pytorch)

import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimimport torch.nn as nnimport numpy as npbatch_size = 64transform = tran

2021-04-07 22:14:34 11

原创 kaggle猫狗识别pytorch

https://zhuanlan.zhihu.com/p/136421422数据集下载链接:https://pan.baidu.com/s/1KZlADFFgI1zd_ia10U5FWw 提取码:r7wn 复制这段内容后打开百度网盘手机App,操作更方便哦

2021-04-06 15:09:43 20

原创 计算fc层超参数

全连接层参数1408是一个超参数,需要人工计算。可以再forward中先不写全连接层构建一个tensor输入然后看一下输出x.size()就是全连接层的参数

2021-04-01 11:33:14 23

原创 minist _On_[GoogleNet]

#google net#inception 盗梦空间import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimimport torch.nn as nnbatch_size = 64transfo

2021-03-31 23:16:03 14

原创 处理minist数据集,把网络和数据都放在gpu上面。

并且修改网络结构,把全连接层改为卷积层。正确率97增长至98,性能提升三分之一。~import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimbatch_size = 64transform = tr

2021-03-31 16:26:55 26

原创 处理minist多分类

import torchfrom torchvision import transformsfrom torchvision import datasetsfrom torch.utils.data import DataLoaderimport torch.nn.functional as Fimport torch.optim as optimbatch_size = 64transform = transforms.Compose([ transforms.ToTensor(

2021-03-30 22:54:35 46 2

原创 使用dataloader加载糖尿病数据集~

import torchfrom torch.utils.data import Datasetfrom torch.utils.data import DataLoaderimport numpy as npclass DiabetesDataset(Dataset): def __init__(self, filepath): xy = np.loadtxt(filepath, delimiter=',', dtype=np.float32) self

2021-03-30 17:09:32 27

原创 处理多维特征的输出(糖尿病数据)

#处理多维特征的输入#prepare Datesetimport numpy as npimport torchxy = np.loadtxt('./diabetes.csv',delimiter = ',',dtype = np.float32)x_data = torch.from_numpy(xy[:,:-1])y_data = torch.from_numpy(xy[:, [-1]])#[]加上则取出来的是矩阵class Model(torch.nn.Module): .

2021-03-30 15:30:34 18

原创 逻辑斯蒂回归

import torchvisionimport torchimport matplotlib.pyplot as plttrain_set = torchvision.datasets.MNIST(root='./dataset/mnist', train=True, download=False)#./test_set = torchvision.datasets.MNIST(root='./dataset/mnist', train=False, download=False)x_d.

2021-03-30 11:18:35 12

原创 plt绘制1 / (1 + np.exp(-x))

x = np.linspace(-20,20,10000)y = np.array(1 / (1 + np.exp(-x)))y1 = np.array(1 / (1 + np.exp(-x)) ** 0) / 2.0plt.plot(x,y)plt.plot(x,y1)plt.axhline(y=0.7,ls="-",c="red")plt.axis([-20,20,-0.1,1])plt.show()

2021-03-30 09:44:48 14

原创 Pytorch构建简单线性模型

import torchimport matplotlib.pyplot as pltx_data = torch.Tensor([[1.0], [2.0], [3.0]])y_data = torch.Tensor([[2.0], [4.0], [6.0]])class LinearModel(torch.nn.Module): def __init__(self): super(LinearModel, self).__init__() self.li.

2021-03-29 23:04:02 11

原创 乌班图anaconda安装

下载下来 安装包之后直接进入相应的文件夹然后 bash ananconda.sh在终端输入代码配置环境进入文件夹启动

2021-03-26 22:55:36 20

原创 乌班图安装pycharm

首先在jetbrain下载pycharm压缩包在downloads解压然后打开终端进入bin运行pycharm.sh./pycharm.sh

2021-03-26 21:17:32 15

原创 T-sne可视化digits

import matplotlib.pyplot as pltimport numpy as npimport sklearn.datasets as datasetsdigits = datasets.load_digits()print(digits)#探索数据结构data = digits.datalabel = digits.targetprint(data.shape)n_sample,n_features = data.shape#t-SNE降维from sklear

2021-03-25 22:30:02 11

原创 pytorch线性回归

import torchimport matplotlib.pyplot as plttorch.manual_seed(10)lr = 0.05 # 学习率# 创建训练数据x = torch.rand(20, 1) * 10 # x data (tensor), shape=(20, 1)# torch.randn(20, 1) 用于添加噪声y = 2*x + (5 + torch.randn(20, 1)) # y data (tensor), shape=(20, 1)#

2021-03-24 22:41:45 14

原创 对于DSH算法损失函数的理解

https://www.pianshen.com/article/4022682431/

2021-03-22 10:56:00 15

原创 卷积和池化后特征图的大小~

https://www.it610.com/article/1296242418328346624.htm

2021-03-15 20:34:43 24

原创 可视化

import matplotlib.pyplot as pltimport PIL as imgimport cv2import cv2import matplotlib.pyplot as pltimport numpy as npimg1 = cv2.imread('./ImgDB/tiger_001.jpg')img2 = cv2.imread('./ImgDB/tiger_002.jpg')img3 = cv2.imread('./ImgDB/tiger_003.jpg')img

2021-03-12 21:05:38 26

原创 6-7Pytorch搭建cifar10训练脚本(下)

和上相比。。下使用了board可视化训练过程,训练结束后在log文件下面生成日志在终端输入命令tensorboard --logdir ./打开# -*- encoding: utf-8 -*-"""@File : train.py@Time : 2021-03-07 16:24@Author : XD@Email : gudianpai@qq.com@Software: PyCharm"""import osimport torchimport t.

2021-03-11 23:04:46 15

原创 Deep Learning of Binary Hash Codes for Fast Image Retrieval(2015)

基于pytorch框架实现https://github.com/flyingpot/pytorch_deephash知乎上面解读https://zhuanlan.zhihu.com/p/23891866

2021-03-11 15:30:58 16

原创 Must-read papers on deep learning to hash

DeepHash-Papers=======Contributed by `Yue Cao <http://yue-cao.me/>`_.We release `DeepHash <https://github.com/thulab/deephash>`_, an open source library for deep learning to hash. This repository provides a standard deep hash training and

2021-03-11 08:53:22 27

原创 003数字识别

这种写法后续会用到。。。plt.savefig("test.png")"""================================Recognizing hand-written digits================================This example shows how scikit-learn can be used to recognize images ofhand-written digits, from 0-9."""print(__

2021-03-10 22:40:30 14

原创 002A demo of the Spectral Co-Clustering algorithm

这个例子演示如何产生一个数据集,并且用谱系共聚类法(Spectral Co-Clustering algorithm)对它进行双向聚类。所谓“双向聚类”,是指对变量和实例同时聚类。这里,使用函数make_biclusters产生双向聚类的数据集。该函数产生的矩阵元素较小,但嵌入的双向类bicluster具有较大的值。然后随机重排矩阵的行和列,作为参数传递给算法。再重新排列这个随机重排的矩阵,使得biclusters邻接。这样一来就可以看出算法的准确程度了。导入库import numpy as npf

2021-03-10 21:36:38 25

原创 001介绍

学习一下scikit-learn例子以便后续工作先逐个学习一下Examples,~~~~

2021-03-10 12:35:48 8

原创 步骤一:入门Linux基础\01.Linux 简介和安装\第2章 Ubuntu系统的安装

本来想自己写,然而发现这个人写的更好,塞拉斯

2021-03-08 16:23:56 16

原创 局部敏感哈希(lsh)包安装成功

我们需要安装一个lsh包直接pip install lsh报错error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools我们需要安装一下这个东西链接:https://pan.baidu.com/s/1wdYv76wxhOTffma2CQCWVw 提

2021-03-08 10:09:00 29

原创 6-7Pytorch搭建cifar10训练脚本(上)

需要详解一下代码~~List item# -*- encoding: utf-8 -*-"""@File : train.py@Time : 2021-03-07 16:24@Author : XD@Email : gudianpai@qq.com@Software: PyCharm"""import osimport torchimport torch.nn as nnimport torchvisionfrom vggnet import VGGN.

2021-03-07 22:03:08 25

原创 6-6Pytorch搭建VGGNet实现cifar10图像分类

import torchimport torch.nn as nnimport torch.nn.functional as Fclass VGGbase(nn.Module): def __init__(self): super(VGGbase, self).__init__() # 3 * 28 * 28 (crop-->32, 28) self.conv1 = nn.Sequential( nn.Conv.

2021-03-07 16:19:38 26

空空如也

空空如也

空空如也

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

TA关注的人 TA的粉丝

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