【计算机视觉】seetaFace

 

class impl

复制代码
class FaceDetection::Impl {
 public:
  Impl()
      : detector_(new seeta::fd::FuStDetector()),
        slide_wnd_step_x_(4), slide_wnd_step_y_(4),
        min_face_size_(20), max_face_size_(-1),
        cls_thresh_(3.85f) {}

  ~Impl() {}

  inline bool IsLegalImage(const seeta::ImageData & image) {
    return (image.num_channels == 1 && image.width > 0 && image.height > 0 &&
      image.data != nullptr);
  }

 public:
  static const int32_t kWndSize = 40;

  int32_t min_face_size_;
  int32_t max_face_size_;
  int32_t slide_wnd_step_x_;
  int32_t slide_wnd_step_y_;
  float cls_thresh_;

  std::vector<seeta::FaceInfo> pos_wnds_;
  std::unique_ptr<seeta::fd::Detector> detector_;
  seeta::fd::ImagePyramid img_pyramid_;
};
View Code
复制代码

score

impl_->pos_wnds_ = impl_->detector_->Detect(&(impl_->img_pyramid_));

 fust.cpp

std::vector<seeta::FaceInfo> FuStDetector::Detect(
    seeta::fd::ImagePyramid* img_pyramid) {

 score

        for (int32_t i = 0; i < hierarchy_size_[0]; i++) {
          if (model_[i]->Classify(&score)) {
            wnd_info.score = static_cast<double>(score);
            proposals[i].push_back(wnd_info);
          }
        }

2

复制代码
          if (model_[model_idx]->Classify(&score, mlp_predicts.data())) {
            float x = static_cast<float>(bboxes[m].bbox.x);
            float y = static_cast<float>(bboxes[m].bbox.y);
            float w = static_cast<float>(bboxes[m].bbox.width);
            float h = static_cast<float>(bboxes[m].bbox.height);

            bboxes[bbox_idx].bbox.width =
              static_cast<int32_t>((mlp_predicts[3] * 2 - 1) * w + w + 0.5);
            bboxes[bbox_idx].bbox.height = bboxes[bbox_idx].bbox.width;
            bboxes[bbox_idx].bbox.x =
              static_cast<int32_t>((mlp_predicts[1] * 2 - 1) * w + x +
              (w - bboxes[bbox_idx].bbox.width) * 0.5 + 0.5);
            bboxes[bbox_idx].bbox.y =
              static_cast<int32_t>((mlp_predicts[2] * 2 - 1) * h + y +
              (h - bboxes[bbox_idx].bbox.height) * 0.5 + 0.5);
            bboxes[bbox_idx].score = score;
            bbox_idx++;
          }
复制代码

 

posted on   鹅要长大  阅读(354)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示