【创作纪念日】512天

机缘

  1. 由于不是计算机专业,刚开始出来工作都是从csdn博客学习,配置环境,安装教程都是参考各位大佬们的博客

  2. 后面自己学习了一些心得,也想着分享给后来人。


收获

  1. 发布了12篇原创文章,收获了14871访问量,总排名6w+,周排名8k+,粉丝37

  2. 通过博客提升了自己的语言组织能力,熟悉了markdown编辑,排版。也收获了许多赞美与鼓励


日常

  1. 在工作中,想到好的trick,都会记录下来,在空闲时间写成博客分享

  2. 博客也可以记录自己学习的过程。一段时间后回顾之前的博客和学习历程,也是挺有意思。


成就

  1. 从第一篇博客到如今,成就颇丰。

    举一个例子。优化目标检测后处理(yolov3)耗时从20ms优化到1ms,且结果99%一致

    // 得到所有的候选框

    std::vector<std::shared_ptr<ObjectInfo>> YoloLayer::getCandidateBoxes(const std::vector<void*>& outputPointers)

    {

      std::vector<std::shared_ptr<ObjectInfo>> result;

      std::vector<ObjectType> types = mYoloLayerParam->getObjectType();

      // For yolov3 there are three output bindings. The outputs returned (flat array) have data in the following shape and order

      // mentioned in OUTPUT_SHAPE

      std::vector<std::vector<std::vector<int>>> anchorDims = mYoloLayerParam->getAnchorDims();

      std::vector<std::vector<int>> outputShapes = mYoloLayerParam->getOutputShape();

      for(int i = 0; i < outputPointers.size(); ++i)

      {

    ​    auto gridWidth = outputShapes[i][3];

    ​    auto gridHeight = outputShapes[i][2];

    ​    auto numAnchors = mYoloLayerParam->getAnchorCount();

    ​    float* pOutput = (float* )outputPointers[i];

    ​    for (uint32_t a = 0; a < numAnchors; ++a)

    ​    {

    ​      uint32_t obStart = getIndex(a, 4, gridWidth, gridHeight, gridWidth, gridHeight); // 循环开始的值

    ​      // uint32_t obEnd = getIndex(a, 5, gridWidth, gridHeight, gridWidth, gridHeight);   // 循环结束的值

    ​      for (uint32_t ob = obStart; ob < obStart+gridWidth*gridHeight; ++ob)

    ​      {

    ​        float to = pOutput[ob];

    ​        float bo = sigmoid(to);

    ​        uint32_t indexBo = ob - obStart;

    ​        uint32_t y = indexBo / gridHeight;

    ​        uint32_t x = indexBo % gridHeight;

    ​        float maxProb = 0.0f;

    ​        uint32_t maxIndex = 0;

    ​        for (uint32_t c = 0; c < mYoloLayerParam->getClassesCount() ; ++c)

    ​        {

    ​          uint32_t index = getIndex(a, 5 + c, y, x, gridWidth, gridHeight);

    ​          float prob = sigmoid(pOutput[index]);

    ​          if (prob > maxProb)

    ​          {

    ​            maxProb = prob;

    ​            maxIndex = c;

    ​          }

    ​        }

    ​        maxProb *= bo;

    ​        if (maxProb >= mYoloLayerParam->getConfidenceThreshold())

    ​        {

    ​          auto currAnchorDim = anchorDims[i][a];

    ​          float tx, ty, tw, th, bx, by, bw, bh;

    ​          tx = pOutput[getIndex(a, 0, y, x, gridWidth, gridHeight)];

    ​          ty = pOutput[getIndex(a, 1, y, x, gridWidth, gridHeight)];

    ​          tw = pOutput[getIndex(a, 2, y, x, gridWidth, gridHeight)];

    ​          th = pOutput[getIndex(a, 3, y, x, gridWidth, gridHeight)];

    ​          bw = (currAnchorDim[0] * exp(tw)); // box width

    ​          bh = (currAnchorDim[1] * exp(th)); // box height

    ​          // Coordinates are relative to the grid. Scale to detector dimension.

    ​          // Later scale up by input resolution.

    ​          bx = (((sigmoid(tx) + x) * mYoloLayerParam->getImageSize().width()) / gridWidth) - (bw / 2);   // top left x coordinate

    ​          by = (((sigmoid(ty) + y) * mYoloLayerParam->getImageSize().height()) / gridHeight) - (bh / 2);   // top left y coordinate

    ​          //  根据maxIndex获取目标类型

    ​          ObjectType type = (maxIndex < types.size()) ? types[maxIndex] : types[0];

    ​          QRect position(bx, by, bw, bh);

    ​          std::shared_ptr<ObjectInfo> object = std::make_shared<ObjectInfo>(type, position, maxProb);

    ​          result.push_back(object);

    ​        }

    ​      }

    ​    }

      }

      return result;

    }


憧憬

  1. 坚持创作。

  2. 坚持看书,无论上班还是休假,每天看书1h。

  3. 在非程序员领域也有成绩。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

读书猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值