深度学习
cv阿文
联系邮箱:kangkzhao@126.com
展开
-
tf.placeholder()函数
函数形式:tf.placeholder( dtype, shape=None, name=None)参数:dtype:数据类型,例如float32,float64等 shape:数据形状,None默认是一维,也可以是多维 name:数据名称 很多python程序的底层为C语言或者其他语言,执行一行脚本,就要切换一次,是有成本的,tensorflow...原创 2018-12-18 21:22:35 · 891 阅读 · 0 评论 -
Pytorch (三)数据加载与处理
数据加载和处理教程了解如何从非平凡的数据集加载和预处理/扩充数据。导入包:from __future__ import print_function ,divisionimport osimport torchimport pandas as pdfrom skimage import io, transformimport numpy as npimport ma...原创 2018-10-23 11:25:54 · 635 阅读 · 0 评论 -
Torch中Tensor与Numpy或各种图像格式的相互转化
在这篇文章中:前言格式转换PIL与Tensornumpy与Tensor注意前言在pytorch中经常会遇到图像格式的转化,例如将PIL库读取出来的图片转化为Tensor,亦或者将Tensor转化为numpy格式的图片。而且使用不同图像处理库读取出来的图片格式也不相同,因此,如何在pytorch中正确转化各种图片格式(PIL、numpy、Tensor)是一个在调试中比较重要的问题。...转载 2019-03-30 09:36:56 · 7576 阅读 · 2 评论 -
交叉熵损失函数(CrossEntropyLoss)
CrossEntropyLoss计算公式为CrossEntropyLoss带权重的计算公式为(默认weight=None)多维度计算时:loss为所有维度loss的平均。import torchimport torch.nn as nnimport mathloss = nn.CrossEntropyLoss()input = torch.randn(...转载 2019-07-10 15:12:13 · 9142 阅读 · 0 评论 -
hard negative mining
目前在看visual tracking相关的论文,有的论文中会用到hard negative mining技术,hard negative mining是什么意思呢?训练时有positive 样本和negative 样本,但在训练过程中大多数的negative examples 是没有用的或者说用处不大。negative 样本分为不包含目标的样本、包含部分目标的样本,也就是容易判别/不容易判别...原创 2019-02-22 21:32:37 · 470 阅读 · 0 评论 -
深度学习之PyTorch---- 一维线性回归
# 一维线性回归的代码实现x_train = np.array([[3.3],[4.4],[5.5],[6.71],[6.93],[4.168], [9.779],[6.182],[7.59],[2.167],[7.042], [10.791],[5.313],[7.997],[3.1]],dtype=np.fl...原创 2018-10-30 19:17:45 · 470 阅读 · 0 评论 -
深度学习之PyTorch---- 多项式线性回归
"""多项式回归"""def make_features(x): """Builds features a matrix with columns [x,x^2,x^3]""" x = x.unsqueeze(1) return torch.cat([x ** i for i in range(1,4)],1)def f(x): "&原创 2018-10-30 19:19:57 · 915 阅读 · 0 评论 -
深度学习之PyTorch---- Logistic回归(二分类问题)
"""Logistic 回归"""class LogisticRegression(nn.Module): def __init__(self): super(LogisticRegression,self).__init__() self.lr = nn.Linear(2,1) self.sm = nn.Sigmoid() ...原创 2018-10-30 19:21:57 · 3847 阅读 · 3 评论 -
深度学习之PyTorch——Deep NN实现手写MNIST数字分类
MNIST 数据集mnist 数据集是一个非常出名的数据集,基本上很多网络都将其作为一个测试的标准,其来自美国国家标准与技术研究所, National Institute of Standards and Technology (NIST)。 训练集 (training set) 由来自 250 个不同人手写的数字构成, 其中 50% 是高中学生, 50% 来自人口普查局 (the Censu...原创 2018-11-05 22:13:44 · 1245 阅读 · 2 评论 -
深度学习之PyTorch —— CNN实现MNIST手写数字分类
# 运用CNN分析MNIST手写数字分类import torch import numpy as npfrom torch.utils.data import DataLoaderfrom torchvision.datasets import mnistfrom torch import nnfrom torch.autograd import Variablefrom t...原创 2018-11-07 20:39:45 · 7931 阅读 · 1 评论 -
吴恩达第二周作业 - 具有神经网络思维的Logistic回归
本文所使用的资料已上传到百度网盘-网盘链接,请在开始之前下载好所需资料,然后将文件解压到你的代码文件同一级目录下,请确保你的代码那里有lr_utils.py和datasets文件夹。 做一个识别猫的神经网络,希望可以动手一步一步实现。导入所需的库:numpy :是用Python进行科学计算的基本软件包。 h5py:是与H5文件中存储的数据集进行交互的常用软件包。 matplotl...原创 2018-10-24 11:23:39 · 589 阅读 · 0 评论