-
背景 虽然不太care 训练的过程,但是由于容易看懂的layer都看得差不多了 所以打算看一下这些loss function. Euclidean Loss (L2 loss) 一般用于“real-valued regression tasks” 。 比如之前的项目上用的人脸年龄模型,就是用了这个Loss 这个loss没什么额外的参数,实现也很简单。 1 2template <typename Dtype> 3void EuclideanLossLayer<Dtype>::Reshape( 4 const vector<Blob<Dtype>*>& bottom, const …
Read More -
背景 ocr组那边有个shuffle net 的网络,里面有个pytorch op叫chunk,转成的onnx对应的op是 split 作用是: Split a tensor into a list of tensors, along the specified 'axis'. Lengths of the parts can be specified using argument 'split'. Otherwise, the tensor is split to equal sized parts. 然后发现这个op模型转换里不支持转到caffe的layer,于是想办法支持了一下. 发现是要转到caffe的slice …
Read More -
前几天装驱动把笔记本搞崩溃了..重新装了kde桌面环境的manjaro 首先根据 Configure NVIDIA (non-free) settings and load them on Startup 直接装驱动。 装之后mhwd -li命令会显示新安装的驱动,带有nvidia字样的。 然而发现inxi -G 命令下,nvidia GPU显示的drivier是 N/A 参考Inxi -G in Terminal: Graphics card N/A? 发现需要手动load driver 执行 sudo modprobe nvidia 后发现inxi -G 命令可以找到驱动了,nvidia-smi也可以正常显示了。 接下来是设置开 …
Read More -
背景 最近在魔改 tensorRT 的caffe parser 之前caffe模型转到trt模型时,有一个修改是需要将reshape layer的param末尾补1,比较繁琐,于是看了下caffe的reshape layer的实现. proto 12message ReshapeParameter {3 // Specify the output dimensions. If some of the dimensions are set to 0, 4 // the corresponding dimension from the bottom layer is used (unchanged). 5 // Exactly one …
Read More -
caffe中卷积运算的实现 暴力实现的卷积大概是这样子的 1 2for w in 1..W 3 for h in 1..H 4 for x in 1..K 5 for y in 1..K 6 for m in 1..M 7 for d in 1..D 8 output(w, h, m) += input(w+x, h+y, d) * filter(m, x, y, d) 9 end 10 end 11 end 12 end 13 end 14end 15 这种方式的效率显然很低,不意外地,caffe中并不是这样实现的. 注释里面说: Caffe convolves by reduction to matrix …
Read More -
背景是要把某个caffe model,转换成tensorrt的INT8 模型。 然后遇到如下报错: 1 2E0403 08:54:35.951987 5704 engine.h:62] engine.cpp (572) - Cuda Error in commonEmitTensor: 1 (invalid argument) 3E0403 08:54:35.952157 5704 engine.h:62] Failure while trying to emit debug blob. 4engine.cpp (572) - Cuda Error in commonEmitTensor: 1 (invalid argument) …
Read More -
在看过caffe代码的三个核心部分,blob,layer,net之后,陷入了不知道以什么顺序继续看的困境。 blob,layer,net只是三个最基本的概念,关键还是在于各个layer. 但是layer这么多,要怎么看呢? 想了一下决定把相同作用的layer放在一起分析。 今天打算先分析一下激活函数。 sigmoid 表达式为 f(t) = 1/(1+e^-t) caffe GPU实现,非常直接 1 2template <typename Dtype> 3__global__ void SigmoidForward(const int n, const Dtype* in, Dtype* out) { 4 …
Read More -
背景 2019年对了好几次faster rcnn,第一次是赛事之窗项目和北京的同事,对齐sdk和训练的实现。 第二次是被tensorRT4和tensorRT5之间默认参数不一致的问题坑了一下。 第三次是被caffe proto中roi align 的默认参数坑了。 虽然debug了这么多次,踩了一堆坑,但是一段时间不用,细节就会慢慢不记得了。因此来记录一下。 faster rcnn,是一种"two stage"的目标检测算法。 所谓"two stage",是说在实际进行目标检测之前,先会通过某种"region proposals" algorithm,来获得一定数量 …
Read More -
背景 基于Conv的方法在某年的ImageNet比赛上又重新被人想起之后,大家发现网络堆叠得越深,似乎在cv的各个任务上表现的越好。 然而事情当然没有无脑退跌深度那么简单,人们发现,当网络深到一定程度时,结果还不如浅一些的网络结构。 可能第一反应是,网路那么深,多了那么多参数,有那么多数据吗? overfit了吧 然而情况没有那么简单。如果只是单纯得overfit,那么应该只有test error很高才对。然而现在的情况是training error也很高。 那这是怎么回事呢? Resnet的团队认为,是因为深层的网络在训练的时候很难收敛。 这个想法是有依据的,因为我们可以通过构造一个较深的网络结构,使得后面的layer学成一 …
Read More -
名词说明 CUDA. 一般来说指的是CUDA SDK. 目前经常使用的是CUDA 8.0和CUDA 10.1两个版本. 8.0和10.1都是SDK的版本号. CUDNN. The NVIDIA CUDA® Deep Neural Network library (cuDNN). 是一个可以为神经网络提供GPU加速的库 compute capability. 是GPU的固有参数,可以理解为GPU的版本.越新的显卡该数值往往越高. tensorRT.NVIDIA TensorRT™ is an SDK for high-performance deep learning inference. 是一个深度学习推理库,旨在提供高性能的推理 …
Read More