人脸检测算法

public unsafe static void GenerateProposal(int inpHeight, int inpWidth, int reg_max, int num_class, float score_threshold, int feat_h, int feat_w, Mat output, List<Rect> position_boxes, List<float> confidences, List<List<Point>> landmarks, int imgh, int imgw, float ratioh, float ratiow, int padh, int padw)

{

int num = (int)Math.Ceiling((double)(inpHeight / feat_h));

int num2 = feat_h * feat_w;

float* ptr = (float*)(void*)output.DataStart;

float* ptr2 = ptr + num2 * reg_max * 4;

float* ptr3 = ptr + num2 * (reg_max * 4 + num_class);

for (int i = 0; i < feat_h; i++)

{

for (int j = 0; j < feat_w; j++)

{

int num3 = -1;

float num4 = -10000f;

int num5 = i * feat_w + j;

for (int k = 0; k < num_class; k++)

{

float num6 = ptr2k \* num2 + num5;

if (num6 > num4)

{

num4 = num6;

num3 = k;

}

}

float num7 = sigmoid_x(num4);

if (!(num7 > score_threshold))

{

continue;

}

float\[\] array = new float4;

float\[\] x = new floatreg_max;

float\[\] y = new floatreg_max;

for (int l = 0; l < 4; l++)

{

for (int m = 0; m < reg_max; m++)

{

xm = ptr(l \* reg_max + m) \* num2 + num5;

}

softmax_(ref x, ref y, reg_max);

float num8 = 0f;

for (int n = 0; n < reg_max; n++)

{

num8 += (float)n * yn;

}

arrayl = num8 * (float)num;

}

float num9 = ((float)j + 0.5f) * (float)num;

float num10 = ((float)i + 0.5f) * (float)num;

float num11 = Math.Max((num9 - array0 - (float)padw) * ratiow, 0f);

float num12 = Math.Max((num10 - array1 - (float)padh) * ratioh, 0f);

float num13 = Math.Min((num9 + array2 - (float)padw) * ratiow, imgw - 1);

float num14 = Math.Min((num10 + array3 - (float)padh) * ratioh, imgh - 1);

Rect item = new Rect((int)num11, (int)num12, (int)(num13 - num11), (int)(num14 - num12));

position_boxes.Add(item);

confidences.Add(num7);

List<Point> list = new List<Point>();

for (int num15 = 0; num15 < 5; num15++)

{

float num16 = ((ptr3num15 \* 3 \* num2 + num5 * 2f + (float)j) * (float)num - (float)padw) * ratiow;

float num17 = ((ptr3(num15 \* 3 + 1) \* num2 + num5 * 2f + (float)i) * (float)num - (float)padh) * ratioh;

list.Add(new Point((int)num16, (int)num17));

}

landmarks.Add(list);

}

}

}

相关推荐
程序喵大人20 分钟前
【C++进阶】STL算法与函数对象 - 02 sort为什么需要随机访问迭代器
开发语言·c++·算法
hanlin0328 分钟前
动态规划专练:力扣第121、122题
笔记·算法·leetcode
To_OC34 分钟前
LC 74 搜索二维矩阵:换皮的二分查找,我居然一开始没看出来
javascript·算法·leetcode
文心快码BaiduComate36 分钟前
文心快码荣获“中国优秀软件产品”,实力再获国家级认可
算法·代码规范
玖玥拾40 分钟前
LeetCode 189 轮转数组
算法·leetcode
ZhangShao06071 小时前
题解:CF2249B
c++·算法
小玮看世界1 小时前
[Python]线段树与二分法
数据结构·算法
Tisfy3 小时前
LeetCode 3345.最小可整除数位乘积 I:暴力枚举(从n开始尝试)
数学·算法·leetcode·题解·枚举
DolphinDB智臾科技4 小时前
告别 TB 级数据搬运:DolphinDB 滤波算法库,重塑物联网数据价值链
物联网·算法
可编程芯片开发4 小时前
基于双PI控制器结构的六步逆变器供电无刷直流电机调速simulink仿真
算法