GithubHelp home page GithubHelp logo

facetest's Introduction

这是个maven 项目,直接部署就可以了,或者你改成web也行,因为里面不涉及其他的东西,仅仅是js和html而已。我的博文地址

最近闲时一直在尝试好玩的东西,百度AI开发平台也玩过还几次了,之前有尝试做文字转语音,挺好的,用在小程序播放新闻阅读,美滋滋,这次就用他们的人脸检测,其实我有在做实时检测的,但是还没完善又想发博客,所以,写在页面的请求是最快速的。

在此感谢一下js调用本地摄像头截图并用ajax上传至后台服务器完成交互这篇博客,省去了我写前端的痛苦。这评分还是挺准的,因为我丑 哈哈哈。我就不放上我的链接了,毕竟写在前端,暴露出来了,被知道就不好了,项目地址

实现思路

  • 去百度IA开发平台申请应用,拿到你appid、秘钥等,这里是简单的操作,可以直接拿两要素去生成access_token,我会将我代码中的这部分删除掉,补上你即可看到实现效果
  $.ajax({
            type: 'POST',
            url: 'https://aip.baidubce.com/rest/2.0/face/v3/detect?access_token=这里填写你生成的东西',
            data: {
                "image" : imgdata,
                "face_field" : "face_shape,face_type,age,beauty,gender",
                "image_type" : "BASE64"
            },
            dataType: 'json',
            contentType: 'application/x-www-form-urlencoded',
            success: function(res){
                var age = res.result.face_list[0].age;
                var beauty = res.result.face_list[0].beauty;
                var sex = res.result.face_list[0].gender.type==="male"?"男":"女";
                var probability = res.result.face_list[0].gender.probability * 100;
                probability = probability + "%";
                alert("检测成功");
                jQuery("#age").val(age);
                jQuery("#beauty").val(beauty);
                jQuery("#sex").val(sex);
                jQuery("#maybe").val(probability);

            },

百度开发平台

百度Ai开发平台的文档

效果图如下 在这里插入图片描述 我觉得很正确,因为我丑哈哈哈

真的要好好学会看文档,十分重要

以下就是我做的密谋东西,主要是在后台,更加安全,也更好,用到了OpenCV等,还在完善中。。。。 在这里插入图片描述

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.