C# Onnx Dense Face 3D人脸重建,人脸Mesh
  yqdtHKhvd9Ja 2023年12月15日 32 0


目录

介绍

效果

模型信息

项目

代码

下载

其他


介绍

github地址:GitHub - cleardusk/3DDFA_V2: The official PyTorch implementation of Towards Fast, Accurate and Stable 3D Dense Face Alignment, ECCV 2020.

Introduction
This work extends 3DDFA, named 3DDFA_V2, titled Towards Fast, Accurate and Stable 3D Dense Face Alignment, accepted by ECCV 2020. The supplementary material is here. The gif above shows a webcam demo of the tracking result, in the scenario of my lab. This repo is the official implementation of 3DDFA_V2.

Compared to 3DDFA, 3DDFA_V2 achieves better performance and stability. Besides, 3DDFA_V2 incorporates the fast face detector FaceBoxes instead of Dlib. A simple 3D render written by c++ and cython is also included. This repo supports the onnxruntime, and the latency of regressing 3DMM parameters using the default backbone is about 1.35ms/image on CPU with a single image as input. If you are interested in this repo, just try it on this google colab! Welcome for valuable issues, PRs and discussions 😄

效果

图片源自网络侵删 

C# Onnx Dense Face 3D人脸重建,人脸Mesh_计算机视觉

C# Onnx Dense Face 3D人脸重建,人脸Mesh_计算机视觉_02

C# Onnx Dense Face 3D人脸重建,人脸Mesh_人工智能_03

C# Onnx Dense Face 3D人脸重建,人脸Mesh_人脸Mesh_04

模型信息

Inputs
-------------------------
name:input
tensor:Float[-1, 3, 120, 120]
---------------------------------------------------------------

Outputs
-------------------------
name:camera_matrix
tensor:Float[-1, 3, 4]
name:landmarks
tensor:Float[-1, 38365, 3]
---------------------------------------------------------------

项目

C# Onnx Dense Face 3D人脸重建,人脸Mesh_3D人脸重建_05

代码

using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace Onnx_Demo
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";

        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;

        Mat image;

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;
            pictureBox2.Image = null;
            textBox1.Text = "";

            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
           
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }
            textBox1.Text = "检测中,请稍等……";
            pictureBox2.Image = null;
            Application.DoEvents();

            image = new Mat(image_path);

            Detect_Face detect_net = new Detect_Face(0.7f);
            Face_Mesh mesh_net = new Face_Mesh("mesh");//choices=["dense", "mesh"]

            dt1 = DateTime.Now;
            List<BoxInfo> bboxes = detect_net.detect(image);

            foreach (var item in bboxes)
            {
                mesh_net.detect(image, new List<BoxInfo>() { item });
            }
            dt2 = DateTime.Now;

            pictureBox2.Image = new Bitmap(image.ToMemoryStream());
            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
        }

        private void pictureBox2_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox2.Image);
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox1.Image);
        }
    }
}

下载

源码下载


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年12月15日 0

暂无评论

推荐阅读
yqdtHKhvd9Ja