资源简介
基于 MXNet C 框架的 CPU 实时人脸识别 pipeline
代码片段和文件信息
#pragma once
#include “mtcnn.hpp“
#include “comm_lib.hpp“
#include
void nms_boxes(std::vector& input float threshold int type std::vector&output)
{
std::sort(input.begin() input.end()
[](const face_box& a const face_box&b)
{
return a.score > b.score;
});
int box_num = input.size();
std::vector merged(box_num 0);
for (int i = 0;i {
if (merged[i])
continue;
output.push_back(input[i]);
float h0 = input[i].y1 - input[i].y0 + 1;
float w0 = input[i].x1 - input[i].x0 + 1;
float area0 = h0*w0;
for (int j = i + 1;j {
if (merged[j])
continue;
float inner_x0 = std::max(input[i].x0 input[j].x0);
float inner_y0 = std::max(input[i].y0 input[j].y0);
float inner_x1 = std::min(input[i].x1 input[j].x1);
float inner_y1 = std::min(input[i].y1 input[j].y1);
float inner_h = inner_y1 - inner_y0 + 1;
float inner_w = inner_x1 - inner_x0 + 1;
if (inner_h <= 0 || inner_w <= 0)
continue;
float inner_area = inner_h*inner_w;
float h1 = input[j].y1 - input[j].y0 + 1;
float w1 = input[j].x1 - input[j].x0 + 1;
float area1 = h1*w1;
float score;
if (type == NMS_UNION)
{
score = inner_area / (area0 + area1 - inner_area);
}
else
{
score = inner_area / std::min(area0 area1);
}
if (score>threshold)
merged[j] = 1;
}
}
}
void regress_boxes(std::vector& rects)
{
for (unsigned int i = 0;i {
face_box& box = rects[i];
float h = box.y1 - box.y0 + 1;
float w = box.x1 - box.x0 + 1;
box.x0 = box.x0 + w*box.regress[0];
box.y0 = box.y0 + h*box.regress[1];
box.x1 = box.x1 + w*box.regress[2];
box.y1 = box.y1 + h*box.regress[3];
}
}
void square_boxes(std::vector& rects)
{
for (unsigned int i = 0;i {
float h = rects[i].y1 - rects[i].y0 + 1;
float w = rects[i].x1 - rects[i].x0 + 1;
float l = std::max(h w);
rects[i].x0 = rects[i].x0 + (w - l)*0.5;
rects[i].y0 = rects[i].y0 + (h - l)*0.5;
rects[i].x1 = rects[i].x0 + l - 1;
rects[i].y1 = rects[i].y0 + l - 1;
}
}
void padding(int img_h int img_w std::vector& rects)
{
for (unsigned int i = 0; i {
rects[i].px0 = std::max(rects[i].x0 1.0f);
rects[i].py0 = std::max(rects[i].y0 1.0f);
rects[i].px1 = std::min(rects[i].x1 (float)img_w);
rects[i].py1 = std::min(rects[i].y1 (float)img_h);
}
}
void process_boxes(std::vector& input int img_h int img_w std::vector& rects)
{
nms_boxes(input 0.7 NMS_UNION rects);
regress_boxes(rects);
square_boxes(rects);
padding(img_h img_w rects);
}
int make_round(float num)
{
int a = int(num);
float b = num - a;
if (int(10 * b) != 5)
{
return round(num);
}
else
{
if (a % 2 == 0)
return a;
else
return a + 1;
}
}
void generate_bounding_box(const float * confidence_data int confidence_size
const float * reg_data float scale
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\
文件 754 2019-06-23 16:42 mxnet-insightface-cpp-master\CMakeLists.txt
文件 4365 2019-06-23 16:42 mxnet-insightface-cpp-master\README.md
文件 4311 2019-06-23 16:42 mxnet-insightface-cpp-master\README_zh.md
文件 586684 2019-06-23 16:42 mxnet-insightface-cpp-master\demo.jpg
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\feature_model\
文件 4115182 2019-06-23 16:42 mxnet-insightface-cpp-master\feature_model\model-0000.params
文件 107943 2019-06-23 16:42 mxnet-insightface-cpp-master\feature_model\model-symbol.json
文件 25885 2019-06-23 16:42 mxnet-insightface-cpp-master\features.xm
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\image\
文件 22062 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Howard.jpg
文件 10026 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Leonard.jpg
文件 58652 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Pacino.jpg
文件 46066 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Penny.jpg
文件 29099 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Rajesh.jpg
文件 16849 2019-06-23 16:42 mxnet-insightface-cpp-master\image\Sheldon.jpg
文件 28869 2019-06-23 16:42 mxnet-insightface-cpp-master\image\daliu.jpg
文件 40810 2019-06-23 16:42 mxnet-insightface-cpp-master\image\duanyihong.jpg
文件 34977 2019-06-23 16:42 mxnet-insightface-cpp-master\image\fanye.jpg
文件 67052 2019-06-23 16:42 mxnet-insightface-cpp-master\image\stephanie-sun.jpg
文件 51787 2019-06-23 16:42 mxnet-insightface-cpp-master\image\yanzi_1.jpg
文件 28700 2019-06-23 16:42 mxnet-insightface-cpp-master\image\yanzi_2.jpg
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\include\
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\
目录 0 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\
文件 11286 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\any.h
文件 3262 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\array_view.h
文件 6862 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\ba
文件 33014 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\blockingconcurrentqueue.h
文件 1144 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\build_config.h
文件 2069 2019-06-23 16:42 mxnet-insightface-cpp-master\include\include\dmlc\common.h
............此处省略132个文件信息
相关资源
- gsl-2.6.7z
- 《编译原理第二版》完整版
- vim配置成强大的IDE
- K66_逐飞.zip
- 山东大学软件学院_操作系统实验1
- mingw-w64压缩包
- ImageFusion.zip
- STM32Cube_fw_F4_V1.24.1 CubeMX的F4系列的封装
- 未来教育考试系统.zip
- 西安科技大学 程序设计大赛总决赛原
- 矩阵乘法及两种求逆方法
- VC 开发的MIPS五级整数流水线模拟程序
- cpp-基于ArduinoMEGA2560的智能物流小车工
- 华南农业大学数据结构上机题目答案
- Proteus8.9 仿真STM32407ZGT6系列基础模板
- 经典的背包问题九讲,必看
- 最新的libssh2库源码
- 信息学奥赛一本通课后练习答案汇总
- 操作系统实验生产者与消费者实验报
- 学生管理系统 根据数据结构的链表知
- VC使用jmail.dll编写电子邮件发送和接受
- 哈工程本科算法实验-0-1背包动态规划
- linux 下c实现简单的网络嗅探器
- 计算机图形学四面体几何变换.doc
- SWMM51014代码编译及扩展案例182387
- conio.h头文件
- 利用栈求表达式的值
- LINUX 下的超声波驱动
- 五子棋 Linux make
- 基于单片机的正弦波设计程序幅度和
评论
共有 条评论