深度学习
OoFrizyoO
热爱技术
展开
-
cuda学习笔记(6)
目录锁页内存多线程、页锁存的点乘示例 前面基础部分说cpu内存跟gpu内存在各自的函数中不能相互操作。申请主机内存用malloc,释放用free。但其实cuda可以通过DMA(Direct Memory Access)把主机内存地址直接映射到cuda地址,称为锁页内存(pinned memory or page locked memory) 锁页内存 主机端存在虚拟内存,主机内存不足是会将内存数据...原创 2020-02-16 23:29:36 · 539 阅读 · 0 评论 -
cuda学习笔记(5)
目录原子操作(Atomics) 笔记(2)中提到当cuda需要对同一个内存地址中的值进行读写访问时,需要原子操作(Atomics)(类似cpu多线程的互斥锁mutex或原子变量),本章通过一个列子介绍原子操作。 原子操作(Atomics) 有些操作不能被拆分, 多线程要针对同一内存地址进行操作,这时需要对该内存使用原子操作,来保证线程对资源有暂时的”独占性”, 避免计算错误。原子操作是把双刃剑,因...原创 2020-02-10 23:22:19 · 532 阅读 · 0 评论 -
cuda学习笔记(4)
目录1. 纹理内存2. 纹理内存的使用引用 上篇文章介绍cuda常量内存的特点及使用方法。本篇记录cuda纹理内存( texture )的特点及使用方法。 1. 纹理内存 cuda编程经常要对二维或者三维数据进行操作,为了加速内存读写,需要使用纹理内存。纹理内存不能单独使用,必读绑定到全局内存上,纹理内存( texture memory )实质上是全局内存的一个特殊形态,全局内存被绑定为纹理内存,...原创 2020-02-08 20:16:27 · 676 阅读 · 1 评论 -
cuda学习笔记(3)
目录1. cuda 常量内存2. 常量内存的声明与使用 上篇笔记中记录了cuda共享内存及线程同步的方法。本篇将介 cuda 常量内存( __ constant __ ) 的特点及使用方法。 1. cuda 常量内存 cuda编程中,如何核函数要用到的数据从开始到结束一直不需要变化,我们可以把这些数据放到cuda常量内存中,以提升读取数据的速度(有些程序运行速度的瓶颈在内存读取与交换上)。常量内存...原创 2020-02-07 22:19:14 · 258 阅读 · 1 评论 -
cuda学习笔记(2)
目录1. 大维度数组运算核函数的写法2. 线程交互(共享内存)与同步 上篇笔记中记录了cuda核函数的写法及调用的方法,并简单的介绍了grid,block,thread 的概念,即指定多少个线程来执行核函数。上篇例子演示了一个简单的N维数组(N很小)的例子,例子中调用了N个block,每个block分配一个线程,共N个并行的线程执行 c[N] = a[N] + b[N] 运算。 本篇扩展上篇内容,...原创 2020-02-06 22:27:54 · 235 阅读 · 0 评论 -
cuda学习笔记(1)
1.基本流程 cuda代码(.cu)的目的是并行运算。只要在c代码中调用以 __ global__为关键字修饰的函数( __ global __ void function( type *InputArrayA, type *InputArrayB, type *OutputArrayA) ),称为核函数,代码经nvcc编译,识别到核函数就会编译成gpu指令码; 调用该函数时,要在函数名称加上 &...原创 2020-02-05 20:12:00 · 387 阅读 · 1 评论 -
深度学习数据增强:像素值亮度/对比度/噪声/模糊变换
import numpy as np import cv2 import math def flip(img, label, width): dst = cv2.flip(img, 1) label_n = list(label) label_n[0] = width-1-label[2] label_n[2] = width-1-label[0] ret...原创 2019-11-12 10:21:09 · 1150 阅读 · 0 评论 -
深度学习数据增强:旋转图像跟关键点坐标
import numpy as np import cv2 # import scipy.ndimage as ndi def affine_rotation_matrix(angle=(-20, 20)): """Create an affine transform matrix for image rotation. NOTE: In OpenCV, x is width a...原创 2019-11-12 10:09:41 · 929 阅读 · 0 评论 -
pip修改国内镜像,提升install速度
pip国内的一些镜像 阿里云 https://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学...原创 2018-12-23 16:04:09 · 1813 阅读 · 1 评论 -
caffe源码:base_conv_layer
caffe.protomessage ConvolutionParameter { optional uint32 num_output = 1; // The number of outputs for the layer optional bool bias_term = 2 [default = true]; // whether to have bias terms // Pad,原创 2017-01-01 17:15:23 · 813 阅读 · 1 评论 -
caffe源码:Layer
caffe.protoenum Phase { TRAIN = 0; TEST = 1; }message NetState { optional Phase phase = 1 [default = TEST]; optional int32 level = 2 [default = 0]; repeated string stage = 3; }message NetSt原创 2017-01-01 10:49:00 · 642 阅读 · 0 评论 -
caffe源码:Blob
caffe.proto// Specifies the shape (dimensions) of a Blob. message BlobShape { repeated int64 dim = 1 [packed = true]; }message BlobProto { optional BlobShape shape = 7; repeated float data = 5原创 2017-01-01 01:27:12 · 383 阅读 · 1 评论 -
caffe源码:math_functions.cpp
#include <boost/math/special_functions/next.hpp> #include <boost/random.hpp>#include <limits>#include "caffe/common.hpp" #include "caffe/util/math_functions.hpp" #include "caffe/util/rng.hpp"namespace原创 2016-12-31 22:40:54 · 1078 阅读 · 1 评论 -
ubuntu14.04编译caffe
sudo apt-get install git sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no-install-recommendas libboost-all-原创 2017-01-03 22:48:03 · 649 阅读 · 1 评论 -
Ubuntu 14.04 64bit 安装Caffe(GPU版本)--台式机(笔记本请绕道)
参考:http://www.cnblogs.com/zhbzz2007/p/5499180.html一.bios改掉UEIF,禁止快速启动,改掉安全检测等二.u盘安装最新的ubuntu14.04.5三.确定使用nvidiaGPUlspci | grep -i nvidia 我的是GTX 650,然后到http://developer.nvidia.com/cuda-gpus去验证,支持CUDA;转载 2017-01-03 00:06:38 · 440 阅读 · 0 评论 -
浅谈L0,L1,L2范数及其应用
转自: http://t.hengwei.me/post/%E6%B5%85%E8%B0%88l0l1l2%E8%8C%83%E6%95%B0%E5%8F%8A%E5%85%B6%E5%BA%94%E7%94%A8.html#disqus_thread转: 矩阵的条件数(condition number) : http://blog.csdn.net/lanchunhui/article/det转载 2016-11-13 10:21:55 · 437 阅读 · 1 评论