caffe源码阅读4-layer.hpp

关于运行Faster Rcnn 训练出错 按照之前博文 的 Win10 + Matlab2017 + Cuda8.0 +Caffe +faster ,跑demo时没有错误,但是训练出现如下错误: Error using caffe_ glog check error, please check log and clear mex Error in caffe.get_solver (line 7) pSolver = caffe_('... 阅读详情
An interface for the units of computation which can be composed into a Net.

Layer&s must implement a Forward function, in which they take their input (bottom) Blob&s (if any) and compute their output Blob&s (if any). They may also implement a Backward function, in which they compute the error gradients with respect to their input Blob&s, given the error gradients with their output Blob&s.

按照我们对一般卷积神经网络的模型来理解:一个网络(net)包含很多层(layer),而每层里面的东西无外乎数据(前馈的数据和反馈的误差),这些数据在caffe里面已经用blob类来实现了,那么应该可以想到layer中应该包含了很多blob类,或者说是一个blob类型的vector。

1 layer中的数据有哪些?

 protected:
 /** The protobuf that stores the layer parameters */
  LayerParameter layer_param_;
  /** The vector that stores the learnable parameters as a set of blobs. */
  vector<shared_ptr<Blob<Dtype> > > blobs_;
  /** Vector indicating whether to compute the diff of each param blob. */
  vector<bool> param_propagate_down_;

  /** The vector that indicates whether each top blob has a non-zero weight in
   *  the objective function. */
  vector<Dtype> loss_;

在源码中可以看到,确实有一个vector来存储很多blob的变量blobs_;

param_propagate_down_在注释中其实说明了,指示本层中的blob是否需要计算diff;为什么会需要这个东西呢?这里就需要再次强调一下了:net > layer > blob。而一个layer中可能包含多个blob,例如有多个bottom, 多个top。

那么loss_是干嘛的呢?暂时也看不明白。

至于LayerParameter定义在caffe.proto中:

message LayerParameter {
  repeated string bottom = 2; // the name of the bottom blobs
  repeated string top = 3; // the name of the top blobs
  optional string name = 4; // the layer name

  // Rules controlling whether and when a layer is included in the network,
  // based on the current NetState.  You may specify a non-zero number of rules
  // to include OR exclude, but not both.  If no include or exclude rules are
  // specified, the layer is always included.  If the current NetState meets
  // ANY (i.e., one or more) of the specified rules, the layer is
  // included/excluded.
  repeated NetStateRule include = 32;
  repeated NetStateRule exclude = 33;

  // NOTE
  // Add new LayerTypes to the enum below in lexicographical order (other than
  // starting with NONE), starting with the next available ID in the comment
  // line above the enum. Update the next available ID when you add a new
  // LayerType.
  //
  // LayerType next available ID: 38 (last added: CONTRASTIVE_LOSS)
  enum LayerType {
    // "NONE" layer type is 0th enum element so that we don't cause confusion
    // by defaulting to an existent LayerType (instead, should usually error if
    // the type is unspecified).
    NONE = 0;
    ABSVAL = 35;
    ACCURACY = 1;
    ARGMAX = 30;
    BNLL = 2;
    CONCAT = 3;
    CONTRASTIVE_LOSS = 37;
    CONVOLUTION = 4;
    DATA = 5;
    DROPOUT = 6;
    DUMMY_DATA = 32;
    EUCLIDEAN_LOSS = 7;
    ELTWISE = 25;
    FLATTEN = 8;
    HDF5_DATA = 9;
    HDF5_OUTPUT = 10;
    HINGE_LOSS = 28;
    IM2COL = 11;
    IMAGE_DATA = 12;
    INFOGAIN_LOSS = 13;
    INNER_PRODUCT = 14;
    LRN = 15;
    MEMORY_DATA = 29;
    MULTINOMIAL_LOGISTIC_LOSS = 16;
    MVN = 34;
    POOLING = 17;
    POWER = 26;
    RELU = 18;
    SIGMOID = 19;
    SIGMOID_CROSS_ENTROPY_LOSS = 27;
    SILENCE = 36;
    SOFTMAX = 20;
    SOFTMAX_LOSS = 21;
    SPLIT = 22;
    SLICE = 33;
    TANH = 23;
    WINDOW_DATA = 24;
    THRESHOLD = 31;
  }
  optional LayerType type = 5; // the layer type from the enum above

  // The blobs containing the numeric parameters of the layer
  repeated BlobProto blobs = 6;
  // The names of the parameter blobs -- useful for sharing parameters among
  // layers (but never required).
  repeated string param = 1001;
  // Whether to require shared weights to have the same shape, or just the same
  // count -- defaults to STRICT if unspecified.
  repeated DimCheckMode blob_share_mode = 1002;
  enum DimCheckMode {
  // Neil: Disabled for windows
  //  // STRICT (default) requires that num, channels, height, width each match.
  //  STRICT = 0;
    // PERMISSIVE requires only the count (num*channels*height*width) to match.
    PERMISSIVE = 1;
  }
  // The ratio that is multiplied on the global learning rate. If you want to
  // set the learning ratio for one blob, you need to set it for all blobs.
  repeated float blobs_lr = 7;
  // The weight decay that is multiplied on the global weight decay.
  repeated float weight_decay = 8;

  // The amount of weight to assign each top blob in the objective.
  // Each layer assigns a default value, usually of either 0 or 1,
  // to each top blob.
  repeated float loss_weight = 35;

  optional AccuracyParameter accuracy_param = 27;
  optional ArgMaxParameter argmax_param = 23;
  optional ConcatParameter concat_param = 9;
  optional ContrastiveLossParameter contrastive_loss_param = 40;
  optional ConvolutionParameter convolution_param = 10;
  optional DataParameter data_param = 11;
  optional DropoutParameter dropout_param = 12;
  optional DummyDataParameter dummy_data_param = 26;
  optional EltwiseParameter eltwise_param = 24;
  optional HDF5DataParameter hdf5_data_param = 13;
  optional HDF5OutputParameter hdf5_output_param = 14;
  optional HingeLossParameter hinge_loss_param = 29;
  optional ImageDataParameter image_data_param = 15;
  optional InfogainLossParameter infogain_loss_param = 16;
  optional InnerProductParameter inner_product_param = 17;
  optional LRNParameter lrn_param = 18;
  optional MemoryDataParameter memory_data_param = 22;
  optional MVNParameter mvn_param = 34;
  optional PoolingParameter pooling_param = 19;
  optional PowerParameter power_param = 21;
  optional ReLUParameter relu_param = 30;
  optional SigmoidParameter sigmoid_param = 38;
  optional SoftmaxParameter softmax_param = 39;
  optional SliceParameter slice_param = 31;
  optional TanHParameter tanh_param = 37;
  optional ThresholdParameter threshold_param = 25;
  optional WindowDataParameter window_data_param = 20;

  // Parameters for data pre-processing.
  optional TransformationParameter transform_param = 36;

  // Note: certain layers may have more than one computational engine
  // for their implementation. These layers include an Engine type and
  // engine parameter for selecting the implementation.
  // The default for the engine is set by the ENGINE switch at compile-time.

  // DEPRECATED: The layer parameters specified as a V0LayerParameter.
  // This should never be used by any code except to upgrade to the new
  // LayerParameter specification.
  optional V0LayerParameter layer = 1;
}

相当于是对层中各个参数的相信说明,例如该层的名字,该层的上一层下一层是什么,以及学习率等等参数。


继续再看hpp会发现各种虚函数,先来看看protected里面的方法:

2 前馈,反馈函数:

  /** @brief Using the CPU device, compute the layer output. */
  virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) = 0;
  /**
   * @brief Using the GPU device, compute the layer output.
   *        Fall back to Forward_cpu() if unavailable.
   */
  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
    // LOG(WARNING) << "Using CPU code as backup.";
    return Forward_cpu(bottom, top);
  }

  /**
   * @brief Using the CPU device, compute the gradients for any parameters and
   *        for the bottom blobs if propagate_down is true.
   */
  virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down,
      vector<Blob<Dtype>*>* bottom) = 0;
  /**
   * @brief Using the GPU device, compute the gradients for any parameters and
   *        for the bottom blobs if propagate_down is true.
   *        Fall back to Backward_cpu() if unavailable.
   */
  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down,
      vector<Blob<Dtype>*>* bottom) {
    // LOG(WARNING) << "Using CPU code as backup.";
    Backward_cpu(top, propagate_down, bottom);
  }

这几个函数理解起来应该很容易。重点是那几个XX_gpu(),为啥里面调用的是XX_cpu()啊??!!如果是所谓的在GPU不可用的情况下,调用XX_cpu()还可以理解,但是什么都没有做直接调用XX_cpu了?不过这是虚函数哈,不要着急,在详细的实现里面应该能够明白所以然。

回答这里的问题(参见:caffe源码简单解析——Layer层),在layer中主要的接口是前馈和反馈函数:

inline Dtype Layer<Dtype>::Forward(const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top)

inline void Layer<Dtype>::Backward(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom)

反馈中的参数propagate_down表明是否需要反馈传递参数。而两个函数会根据caffe: mode来判断在cpu中执行还是在gpu中执行。

注意:有些layer并没有GPU计算的实现,所以封装时加入了CPU的计算作为后备

3 检测blobs的数量是否正确:

  /**
   * Called by the parent Layer's SetUp to check that the number of bottom
   * and top Blobs provided as input match the expected numbers specified by
   * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions.
   */
  virtual void CheckBlobCounts(const vector<Blob<Dtype>*>& bottom,
                               const vector<Blob<Dtype>*>& top) {
    if (ExactNumBottomBlobs() >= 0) {
      CHECK_EQ(ExactNumBottomBlobs(), bottom.size())
          << type_name() << " Layer takes " << ExactNumBottomBlobs()
          << " bottom blob(s) as input.";
    }
    if (MinBottomBlobs() >= 0) {
      CHECK_LE(MinBottomBlobs(), bottom.size())
          << type_name() << " Layer takes at least " << MinBottomBlobs()
          << " bottom blob(s) as input.";
    }
    if (MaxBottomBlobs() >= 0) {
      CHECK_GE(MaxBottomBlobs(), bottom.size())
          << type_name() << " Layer takes at most " << MaxBottomBlobs()
          << " bottom blob(s) as input.";
    }
    if (ExactNumTopBlobs() >= 0) {
      CHECK_EQ(ExactNumTopBlobs(), top.size())
          << type_name() << " Layer produces " << ExactNumTopBlobs()
          << " top blob(s) as output.";
    }
    if (MinTopBlobs() >= 0) {
      CHECK_LE(MinTopBlobs(), top.size())
          << type_name() << " Layer produces at least " << MinTopBlobs()
          << " top blob(s) as output.";
    }
    if (MaxTopBlobs() >= 0) {
      CHECK_GE(MaxTopBlobs(), top.size())
          << type_name() << " Layer produces at most " << MaxTopBlobs()
          << " top blob(s) as output.";
    }
    if (EqualNumBottomTopBlobs()) {
      CHECK_EQ(bottom.size(), top.size())
          << type_name() << " Layer produces one top blob as output for each "
          << "bottom blob input.";
    }
  }
这里涉及到了有些奇怪的函数,例如:ExactNumBottomBlobs(),但并不会影响阅读,CheckBlobCounts()实现的功能就是检测输入的bottom blob和输出的top blob是否在指定的范围内,既然是指定的范围,自然就会联想到在什么地方指定这个范围的?带着疑问继续阅读源码,在某个地方,总会明白的。

4 最后一个protected函数,SetLossWeight():

  /**
   * Called by SetUp to initialize the weights associated with any top blobs in
   * the loss function. Store non-zero loss weights in the diff blob.
   */
  inline void SetLossWeights(vector<Blob<Dtype>*>* top) {
    const int num_loss_weights = layer_param_.loss_weight_size();
    if (num_loss_weights) {
      CHECK_EQ(top->size(), num_loss_weights) << "loss_weight must be "
          "unspecified or specified once per top blob.";
      for (int top_id = 0; top_id < top->size(); ++top_id) {
        const Dtype loss_weight = layer_param_.loss_weight(top_id);
        if (loss_weight == Dtype(0)) { continue; }
        this->set_loss(top_id, loss_weight);
        const int count = (*top)[top_id]->count();
        Dtype* loss_multiplier = (*top)[top_id]->mutable_cpu_diff();
        caffe_set(count, loss_weight, loss_multiplier);
      }
    }
  }

这里是设置损失值的,一般也只有在损失函数的那层才会计算损失值的,所以这个函数主要还是用在最后一层。大概相当于是把损失值复制过来,所以可以大胆猜测,这是反馈的第一步吧。


接着来看public中的非虚函数部分:

5 构造函数:

  /**
   * You should not implement your own constructor. Any set up code should go
   * to SetUp(), where the dimensions of the bottom blobs are provided to the
   * layer.
   */
  explicit Layer(const LayerParameter& param)
    : layer_param_(param) {
      // The only thing we do is to copy blobs if there are any.
      if (layer_param_.blobs_size() > 0) {
        blobs_.resize(layer_param_.blobs_size());
        for (int i = 0; i < layer_param_.blobs_size(); ++i) {
          blobs_[i].reset(new Blob<Dtype>());
          blobs_[i]->FromProto(layer_param_.blobs(i));
        }
      }
    }

这个构造函数,从注释上可以看到了,似乎基本都没有直接调用这个构造函数,因为在caffe中有各种各样的层。而不同的层都有自己的 SetUp()。那么这里的 Layer()做了什么事情呢?首先我们可以确认的一点是这里的layer.hpp是各种各样的层的一个抽象,也就是说其它的层都会继承这个。从这个构造函数的代码中可以看到,其实它只做了将blobs拷贝过来,但是具体的其它参数,以及方法都是空白的。

6 前馈和反馈函数:

  /**
   * @brief Given the bottom blobs, compute the top blobs and the loss.
   *
   * @param bottom
   *     the input blobs, whose data fields store the input data for this layer
   * @param top
   *     the preshaped output blobs, whose data fields will store this layers'
   *     outputs
   * \return The total loss from the layer.
   *
   * The Forward wrapper calls the relevant device wrapper function
   * (Forward_cpu or Forward_gpu) to compute the top blob values given the
   * bottom blobs.  If the layer has any non-zero loss_weights, the wrapper
   * then computes and returns the loss.
   *
   * Your layer should implement Forward_cpu and (optionally) Forward_gpu.
   */
  inline Dtype Forward(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top);

  /**
   * @brief Given the top blob error gradients, compute the bottom blob error
   *        gradients.
   *
   * @param top
   *     the output blobs, whose diff fields store the gradient of the error
   *     with respect to themselves
   * @param propagate_down
   *     a vector with equal length to bottom, with each index indicating
   *     whether to propagate the error gradients down to the bottom blob at
   *     the corresponding index
   * @param bottom
   *     the input blobs, whose diff fields will store the gradient of the error
   *     with respect to themselves after Backward is run
   *
   * The Backward wrapper calls the relevant device wrapper function
   * (Backward_cpu or Backward_gpu) to compute the bottom blob diffs given the
   * top blob diffs.
   *
   * Your layer should implement Forward_cpu and (optionally) Forward_gpu.
   */
  inline void Backward(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down,
      vector<Blob<Dtype>*>* bottom);

这里的注释很详细,具体的实现也在layer.hpp中:

// Forward and backward wrappers. You should implement the cpu and
// gpu specific implementations instead, and should not change these
// functions.
template <typename Dtype>
inline Dtype Layer<Dtype>::Forward(const vector<Blob<Dtype>*>& bottom,
    vector<Blob<Dtype>*>* top) {
  Dtype loss = 0;
  switch (Caffe::mode()) {
  case Caffe::CPU:
    Forward_cpu(bottom, top);
    for (int top_id = 0; top_id < top->size(); ++top_id) {
      if (!this->loss(top_id)) { continue; }
      const int count = (*top)[top_id]->count();
      const Dtype* data = (*top)[top_id]->cpu_data();
      const Dtype* loss_weights = (*top)[top_id]->cpu_diff();
      loss += caffe_cpu_dot(count, data, loss_weights);
    }
    break;
  case Caffe::GPU:
    Forward_gpu(bottom, top);
#ifndef CPU_ONLY
    for (int top_id = 0; top_id < top->size(); ++top_id) {
      if (!this->loss(top_id)) { continue; }
      const int count = (*top)[top_id]->count();
      const Dtype* data = (*top)[top_id]->gpu_data();
      const Dtype* loss_weights = (*top)[top_id]->gpu_diff();
      Dtype blob_loss = 0;
      caffe_gpu_dot(count, data, loss_weights, &blob_loss);
      loss += blob_loss;
    }
#endif
    break;
  default:
    LOG(FATAL) << "Unknown caffe mode.";
  }
  return loss;
}

template <typename Dtype>
inline void Layer<Dtype>::Backward(const vector<Blob<Dtype>*>& top,
    const vector<bool>& propagate_down,
    vector<Blob<Dtype>*>* bottom) {
  switch (Caffe::mode()) {
  case Caffe::CPU:
    Backward_cpu(top, propagate_down, bottom);
    break;
  case Caffe::GPU:
    Backward_gpu(top, propagate_down, bottom);
    break;
  default:
    LOG(FATAL) << "Unknown caffe mode.";
  }
}

其中具体的计算方式,可以先看看深度学习基础教程。在该代码中会根据不同的caffe::mode来选择不同的函数实现。

每种层的具体实现后面再慢慢分析~


《YOLO26/YOLO11/YOLOv8改进与系统实战》,改进与系统实战专栏目录和介绍 YOLOv8 是目前比较火和比较成熟的深度学习框架,是2023年1月发布的,由 Ultralytics 团队开发。Ultralytics自YOLOv5 开始一直积极维护和更新 YOLO 框架,因此 YOLOv8 也享有持续的维护与升级支持。因此我写下《手把手教你YOLOv8实战》专栏,专门为那些对计算机视觉、深度学习、以及目标检测技术感兴趣的读者设计。通过本专栏,你将深入理解 YOLOv8 的核心原理与实际应用,从0 开始学习并掌握如何使用 YOLOv8 完成各类目标检测任务,帮助你快速上手并掌握 YOLO 阅读详情

相关推荐

物联网定位技术|实验报告|实验一 Wi-Fi指纹定位

全球定位系统是迄今为止应用最为成功的地位系统,具备高精度的定位能力,但在室内和高楼密布的城区等信号遮挡严重的密集环境中,由于接受机捕获不到足够强度的卫星信号,GPS的定位质量难以保证甚至无法完成定位,使其可用性受到严重制约。由于室内环境下都普及了WiFi,因此利用WiFi进行定位无需额外部署硬件设备,是一个非常节省成本的方法。

m0_57656758的博客 3356

使用demo.py测试MobileNet-SSD报错:Check failed: target_blobs.size() == source_layer.blobs_size() (2 vs. 1)

测试使用的网络配置文件和训练时的不一样,因为作者提供的就不一样 把MobileNetSSD_train.prototxt复制一份,根据MobileNetSSD_deploy.prototxt把输入和输出改了就行 最终内容如下 name: "MobileNet-SSD" input: "data" input_shape { dim: 1 dim: 3 dim: 300 dim: 300 } layer { name: "conv0" type: "Convolution" b.

random_repick的专栏 362

基于ASP.NET+SQLServer的美妆网站的设计与实现

通过本次ASP.NET MVC美妆商城项目的开发,我们实现了一个功能完善、性能稳定的在线购物平台。该项目不仅提升了用户的购物体验,也为商家提供了一个高效的商品管理和销售渠道。未来,我们将持续优化系统功能,提升用户体验,以适应不断变化的市场需求。

毕业设计大牛哥 1500

opencv dnn模块 示例(27) 目标检测 object_detection 之 yolov11

YOLO11是Ultralytics实时目标探测器系列中最新的迭代版本,重新定义尖端的精度、速度和效率。在以往具有令人印象深刻进步的yolo版本基础上,YOLO11对架构和训练方法进行了重大改进,使其成为各种计算机视觉任务的多功能选择。

热爱生活,忠于自己 3206

Python实战:3分钟搞定A股K线数据抓取(附东方财富/腾讯API完整代码)

本文为量化交易初学者提供了一份快速获取A股K线数据的实战指南。通过对比东方财富与腾讯财经两大免费API的优劣,并附上可直接运行的完整Python代码,帮助读者在3分钟内搭建起自己的数据抓取管道,为构建量化交易系统奠定坚实的数据基础。

weixin_29062255的博客 2913

RK3568驱动XS9922B:AHD/CVBS双模摄像头兼容性实战

在嵌入式视频开发中,摄像头驱动的稳定性与兼容性往往决定项目交付质量。Linux内核的V4L2框架提供了统一的视频采集抽象,从v4l2_subdev子设备到media controller链路,再到用户态视频节点,每一层都需要精确配置。对于RK3568这类边缘计算平台,其MIPI CSI接口和自研ISP配合RKCIF,构成了完整的多路视频接入通路。当需要接入模拟视频解码芯片时,驱动设计就需同时考虑AHD高清协议与CVBS标清信号的模式切换、格式协商以及寄存器配置。XS9922B作为支持双模输入的解码芯片,可与

weixin_34216614的博客 348

【深度Debug】OpenCV自定义层Unspecified error: Can‘t create layer、Assertion failed) inputs.size() == required

深度Debug、模型执行全过程,OpenCV自定义层Unspecified error: Can't create layer、Assertion failed) inputs.size() == required

CC&UU的博客 1020

HALCON卡尺模型实战:5分钟搞定工件尺寸测量(附完整代码)

本文详细介绍了HALCON卡尺模型在工件尺寸测量中的实战应用,通过5分钟快速搭建测量系统的完整指南,包括基础配置、高级参数调优和完整代码示例。卡尺模型能自动识别边缘并计算精确尺寸,显著提升工业视觉检测的效率和一致性,特别适用于实时测量场景。

weixin_42570296的博客 463

使用OpenCV的ANN_MLP神经网络实现数字识别

前言 1.OpenCV中的ML模块实现了前馈人工神经网络,具体地说是多层感知器(MLP),是最常用的神经网络类型。 MLP由输入层,输出层和一个或多个隐藏层组成。 MLP的每一层包括一个或多个与来自上一层和下一层的神经元定向连接的神经元。关于ANN_MLP的具体说明可以看opencv的官方文档。 2.我这里要是使用ANN_MLP神经网络来实现0到9的印刷数字识别,使用的OpenCV版本是3.30,...

知来者逆的博客 4893

深度学习在传感器数据分析中的创新应用

传感器是物理世界与数字世界的“接口”,其生成的高维、时序、多源数据蕴含着设备状态、环境变化、用户行为等关键信息。传统传感器数据分析依赖手工特征工程与简单机器学习模型,难以应对复杂场景下的非线性、长程依赖与实时性需求。深度学习通过自动特征提取非线性建模与端到端学习,成为传感器数据处理的革命性工具。本文从概念基础理论框架架构设计实现机制到实际应用,系统拆解深度学习与传感器数据的融合逻辑,结合工业预测维护医疗健康监测智能交通等场景,揭示其技术边界与未来演化方向。

大数据洞察的博客 568

Ollama系列---【ollama使用gpu运行大模型】

一、安装CudaToolkit 使用控制台命令查看当前显卡驱动中的cuda版本 nvidia-smi 二、下载CudaToolkit 注意:CudaToolkit版本要低于上面的显卡Cuda版本。 Cuda各版本下载地址:https://developer.nvidia.com/cuda-toolkit-archive 下载好之后,一路下一步,一直默认即可。 如果安装到了自定义的位置,记得加环...

-少年-的博客 7983

Caffe源码阅读流水帐-01

Caffe源码阅读流水帐-01 源码阅读方法论:从src/caffe/proto/caffe.proto中获得灵感。 这个proto文件长达1971行,如何阅读呢(待定)? 在Caffe中,一个CNN模型使用Net表示,而一个Net是由多个Layer堆叠而成的, 今天,介绍下Blob. Layer. Net的基本概念。 Blob——砖石:基本存储单元 这是一个四维的数组,用于存储和交换...

但为君故的博客 168

cdk&java | 分子sdf文件生成

sdf

ASKCOS博客 1089

从零开始的CAFFE代码阅读

CAFFE 源码阅读1前言源码阅读顺序Protobuffer是什么?caffe.proto做了啥?protobuffer示例: 前言   作为一个小白,以前只是傻乎乎的用tensorflow啊,caffe之类的框架,别人给啥我用啥,别人写了自定义层我就按照教程插入一蛤。现在看来,这种拿来主义很限制威猛的我向上发展啊,所以打算借用课余时光,好好阅读一下caffe的源码,也不说一定有用,了解了解大佬们...

qq_37639537的博客 358

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Caffe17天攻坚战之Blob、Layer、Net源码阅读(倒数第14天)

Blob类中syncedmen.hpp源码阅读: 位置:caffe/include/caffe/syncedmem.hpp #ifndef CAFFE_SYNCEDMEM_HPP_ #define CAFFE_SYNCEDMEM_HPP_ #include <cstdlib> #ifdef USE_MKL #include "mkl.h" #endif #include "caffe/common.hpp" namespace caffe { // If CUDA is avail

qq_42910179的博客 289

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Caffe源码导读

1.前言 目前的图像和自然语言处理很多地方用到了神经网络/深度学习相关的知识,神奇的效果让广大身处IT一线的程序猿GG们跃跃欲试,不过看到深度学习相关一大串公式之后头皮发麻,又大有放弃的想法。 从工业使用的角度来说,不打算做最前沿的研究,只是用已有的方法或者成型的框架来完成一些任务,也不用一上来就死啃理论,倒不如先把神经网络看得简单一点,视作一个搭积木的过程,所谓的卷积神经网络(CNN)或者循...

weixin_42730667的博客 887

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

caffe学习笔记1源码阅读步骤

caffe学习笔记1:源码阅读步骤 本文系转载,原文地址 https://ymgd.github.io/codereader/201...

flying_ant2018的博客 247

caffe源码阅读

参考网址:https://www.cnblogs.com/louyihang-loves-baiyan/p/5149628.html1、caffe代码层次熟悉blob,layer,net,solver几类,blob:作为数据输出的媒介,无论是网络权重参数,还是输入数据,都是转化为blob数据结构来存储。layer:作为网络的基础单元,神经网络中层与层间的数据节点、前后传递都在数据结构中被实现,ne...

weixin_30339969的博客 123

caffe学习笔记10:源码阅读步骤

caffe学习笔记10:源码阅读步骤 本文系转载,原文地址 https://ymgd.github.io/codereader/2016/10/20/caffe_sourcecode_analysis/ caffe学习笔记10:源码阅读步骤 1.Caffe代码结构 1.1总体概述 1.2代码阅读顺序建议 1.3源码主线结构图 1.4代码细节 1.4.1caffe.proto 1....

博客 692

零基础学caffe源码 ReLU激活函数

1、如何有效阅读caffe源码     1、caffe源码阅读路线最好是从src/cafffe/proto/caffe.proto开始,了解基本数据结构内存对象和磁盘文件的一一映射关系,中间过程都由ProtoBuffer工具自动完成。     2、看include/目录中.hpp头文件,通过头文件类申明理解整个框架。从基类向派生类,掌握这些类。     3、看src/目录中.

XZZPPP的博客 6659

caffe源码阅读5-各种layer概述

工厂模式:一个工厂可以生产N种产品,那么就需要N种磨具。 因为从来没有玩过设计模式,而layer是采用工厂模式的,就临时看了一下,大概可以用上面的那一句话来描述吧。 基本可以说caffe中的所有层都是继承了layer类的,那么在caffe中,一共有哪些层呢?可以在caffe.proto中看到: enum LayerType { // "NONE" layer type is

thy_2014的专栏 2633

NVcaffe源码阅读——Layer

nvcaffe的Layer.hpp/cpp在功能上与以前的caffe相比有一些明显改变。nvcaffe对Layer.hpp的代码进行了拓展,提供了很多便利的新特性。

KFXW的专栏 2282

caffe源码剖析(一)--整体目录结构

从今天开始,我们来细致的分析一下caffe的源代码。(此系列仅分析caffe原始版本,对于caffe2不涉及,并且只分析各类实现的cpu版,对于gpu实现笔者精力和能力有限,暂不作分析) 分析源码之前,我们需要对caffe的代码结构有一定的了解,只有充分了解了源码的组织层次,我们才能有的放矢的阅读我们需要研究的部分。笔者之前也尝试过阅读caffe源码,但是那时候对于目录结构不甚了解,读起来犹如无头苍蝇,效果十分不好。直到最近先把代码的结构层次弄清楚了以后读起来才比较顺利,因此我先给大家详细的介绍一下caf

Terence--吴哲楠的博客 1103

【caffe】Layer解读之:Reshape

2018年08月11日 17:36:14yuanCruise阅读数:793更多 所属专栏:Caffe源码学习 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qiu931110/article/details/81588956 Layer type: Reshape 头文件位置:./include/caffe/layers/r...

zhuiqiuk的专栏 2230

零基础学caffe源码 ReLU激活函数

零基础学caffe源码 ReLU激活函数 原创 2016年08月03日 17:30:19 ...

jacke121的专栏 2661

caffe 重新用Python编译tripletloss、fine turning

Caffe通过Boost中的Boost.Python模块来支持使用Python定义Layer: 使用C++增加新的Layer繁琐、耗时而且很容易出错 开发速度与执行速度之间的trade-off 编译支持Python Layer的Caffe如果是首次编译,修改Caffe根目录下的Makefile.cinfig,uncommentWITH_PYTHON_LAYER:=1如果已经编译过: 进入caffe

lemonaha的博客 1473
上一篇: caffe源码阅读3-blob.cpp
下一篇: caffe源码阅读5-各种layer概述
thy_2014
博客等级 码龄12年 37粉丝 26原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值