基于matlab的表情识别代码-GSOC2017:GSOC2017

  • j7_676583
    了解作者
  • 70.7MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-11 03:47
    上传日期
基于matlab的表情识别代码 学生:Laksono kurnianggoro 导师:Delia Passalacqua 链接到提交: 链接到代码: 合并的代码: 用法: 介绍 脸部界标检测是一种有用的算法,具有许多可能的应用程序,包括表情转移,虚拟化妆,脸部木偶,脸部互换等。 该项目旨在为面部标志检测器实现可扩展的API。 此外,它还将实现2种算法,包括主动外观模型(AAM)[1]和回归局部二进制特征(LBF)[2]。 参考[1] G. Tzimiropoulos和M. Pantic,“野外快速AAM拟合的优化问题”,ICCV 2013。 [2] S. Ren等。 ,“通过回归本地二进制特征以3000 fps进行人脸对齐”,CVPR 2014。 项目详情 本项目的工作总结于此。 在提案中,几乎没有要添加到API的功能列表。 但是,在编码期间,为了使所提出的API更加可靠,根据导师和从事类似项目工作的另一位学生的建议,添加了各种新功能。 以下是最初提出的功能列表: API的基类(Facemark类)(完成)。 该基类提供了几种功能,包括read() , write() , setFac
GSOC2017-master.zip
  • GSOC2017-master
  • data
  • LBF.model
    34.9MB
  • facemark_lbf.puml
    3.4KB
  • facemark_api.png
    34.5KB
  • facemark_lbf.png
    106KB
  • facemark_aam.puml
    2KB
  • lbfmodel.yaml
    53.8MB
  • facemark_api.puml
    1.4KB
  • preview_lbf.gif
    999KB
  • facemark_aam.png
    77.4KB
  • README.md
    19.6KB
内容介绍
# [Facemark API for OpenCV][pull_request] Student: Laksono kurnianggoro\ Mentor: Delia Passalacqua\ Link to commits: https://github.com/opencv/opencv_contrib/pull/1257/commits \ Link to codes: https://github.com/opencv/opencv_contrib/pull/1257/files \ Merged codes: https://github.com/opencv/opencv_contrib/tree/master/modules/face \ Usage: https://docs.opencv.org/3.4.10/d5/d47/tutorial_table_of_content_facemark.html ## Introduction Facial landmark detection is a useful algorithm with many possible applications including expression transfer, virtual make-up, facial puppetry, faces swap, and many mores. This project aims to implement a scalable API for facial landmark detector. Furthermore, it will also implement 2 kinds of algorithms, including active appearance model (AAM) [1] and regressed local binary features (LBF) [2]. **References**\ [1] G. Tzimiropoulos and M. Pantic, "Optimization problems for fast AAM fitting in-the-wild," ICCV 2013.\ [2] S. Ren, et al. , “Face alignment at 3000 fps via regressing local binary features”, CVPR 2014. [![Facial landmarks detection using FacemarkLBF][preview]][vid_lbf] [See in YouTube][vid_lbf] ## Project Details The works in this project is summarized in this [commits list][commits]. In the proposal, there were few list of functionalities to be added to the API. However, during the coding period, in order to make the proposed API more reliable, various new functionalities were added as suggested by the mentors and another student who works in similar project. #### Here are the list of functionalities that initially proposed: - base class of the API (Facemark class) (*done*).\ This base class provides several functionalities including `read()`, `write()`, `setFaceDetector()`, `getFaces()`, `training()`, `loadModel()`, and `fit()`. - User defined face detector (*done*)\ The configurable face detector is stored in the instance of a landmark detection algorithm and can be set using the `setFaceDetector()` function. This allows the users to use their own face detector in the algorithm. - dataset parser (*done*).\ There are 3 kinds of utility functions that parse the information from dataset: `loadTrainingData()`, `loadDatasetList()`, and `loadFacePoints()`. - documentation (*done*) [see preview][documentation] - Tutorials (*done*) [see preview][tutorials] - sample codes (*done* : 3 programs are available) - 2 algorithms, AAM and LBF (*done*) #### Some new functionalities that are not in original plan but were developed during the coding period: - Extra parameter for the fitting function.\ Each face landmark detector might needs their own parameters in the fitting process. Some parameter are fixed in all the time but some other might changes according to the input data. In the case of fixed parameter, the developer can just add this parameter as the member of `Params`. However, in the case of dynamic parameter, the fitting function should allow extra parameter in the runtime. Hence the optional extra parameter is added to the fitting function by passing it as void parameter (`void* extra_params`) which can holds any types of parameter. - Allows extra parameters in the user defined face detector\ Because of the same reason as the previously explained extra parameter for the fitting function, the user defined face detector also should allow extra parameter. - Test codes\ Test codes are useful to perform automatic assessment to make sure that the implementation is compatible to various devices. - Functionality to add the dataset one by one in the training process\n As the discussion with another student who works on similar project, this functionality should be added since the code developer suggested that the module should not have dependency on `imgcodecs`. Previously, this dependency is needed because the dataset loading function was programmed to loads image inside the API. After this discussion, the image loading was removed from the API and the `addTrainingSample()` function is added to the base class to alleviate this problem. #### Unsubmitted functionalities During the coding period, there are some improvements (not listed in original plan) that were tested but failed to be merged to the OpenCV. 1. Trainer for the LBF algorithm.\ The LBF algorithm utilize liblinear to trains it regressor. During the coding period, there was an initiative to liberate the implementaion of LBF from this dependency as liblinear provides to much functionalities that are not needed. Two kinds of methods were tested to train the regressor including stochastic gradient descent (SGD) and regularized least square (RLS) regression method. However, during the test, SGD cannot produces optimal solution in general since the parameters should be set properly and depends on the characteristic of the dataset. Meanwhile for the RLS, it requires a lot of time and memory due to the needs of inverse matrix computation. Thus this method is not scalabe and will be useless for large-sized dataset. ```cpp Mat FacemarkLBFImpl::Regressor::regressionSGD(Mat x, Mat y, int max_epoch, int batch_sz, double lambda, double eta){ Mat pred; x.convertTo(x, CV_64F); y.convertTo(y, CV_64F); Mat w = Mat::zeros(x.cols, 1, CV_64F); cv::theRNG().state = cv::getTickCount(); randn(w,0.0,1.0); Mat dw = Mat::zeros(x.cols, 1, CV_64F); std::vector<double> E; Mat dE; double gamma = 0.7; int maxIdx; for(int i=0;i<max_epoch;i++){ pred = x*w; double err = norm(pred-y)/x.rows; if(i%10==0 || i==max_epoch-1) printf("%i/%i: %f\n", i, max_epoch, err); dE = Mat::zeros(w.rows, w.cols, CV_64F); for(int j=0;j<x.rows;j+=batch_sz){ if(j+batch_sz>=x.rows){ maxIdx = x.rows; }else{ maxIdx = j+batch_sz; } Mat x_batch = Mat(x,Range(j,maxIdx)); Mat y_batch = Mat(y,Range(j,maxIdx)); dE = dE + x_batch.t()*(x_batch*(w-gamma*dw)-y_batch)+lambda*w; }//batch dw = gamma*dw + eta*dE/norm(dE); w = w - dw; } pred = x*w; std::cout<<sum(abs(pred-y))<<std::endl; std::cout<<Mat(pred-y,Range(0,30)); return Mat(w.t()).clone(); } ``` 2. Custom extra parameters for the default face detector.\ This functionality is failed to be merged and throw compilation error due problems with python wrapper. ``` cpp struct CV_EXPORTS_W CParams{ String cascade; //!< the face detector double scaleFactor; //!< Parameter specifying how much the image size is reduced at each image scale. int minNeighbors; //!< Parameter specifying how many neighbors each candidate rectangle should have to retain it. Size minSize; //!< Minimum possible object size. Size maxSize; //!< Maximum possible object size. CParams( String cascade_model, double sf = 1.1, int minN = 3, Size minSz = Size(30, 30), Size maxSz = Size() ); }; CV_EXPORTS_W bool getFaces( InputArray image, OutputArray faces, void * extra_params ); ``` #### Some possible future improvements and un-executed ideas 1. There many possibilities to use parallelization in both implementation of LBF and AAM algorithms. Currently the parallelization is not implemented for both of them. 2. The AAM algorithm produce big-sized training model since it basically store all the face region from the dataset. An alternative to reduce this trained model size is by limiting the size of the base shape. The faces region are wrapped into the base shape. If the base shape is resized into smaller size, then each wrapped face region will be stored in smaller size. 3. As explained in the previous part, the dependency to libnear can be eliminated. 4. The performance and processing time analysis is not yet provided. It will be useful to provide this information so that the end user could
评论
    相关推荐
    • 数学建模十大回归算法
      数学建模十大回归模型算法,精心整理,有助于提高算法分析能力。
    • 门限回归算法程序代码
      门限回归算法VB程序代码,已通过测试,可直接使用,童叟无欺,欢迎下载,谢谢。
    • Logistic回归算法
      资源包含Logistic回归算法,以及一个应用实例:预测病马死亡率。可直接执行。
    • 关于岭回归算法的论文汇总
      这个包里面涵盖了很多现在主流的一些关于岭回归的论文集合,对算法研究十分全面
    • logistic回归
      logistic回归算法,有数据和说明,程序过程清楚。
    • Logistic回归、最优化理论与算法
      Logistic回归、最优化理论与算法blog对应的代码
    • 回归直线算法
      VB版求解回归直线源码,求解最逼近的直线方程y=kx+b
    • 基于回归算法的离心泵流量控制系统.zip
      基于回归算法的离心泵流量控制系统 本文提出了基本回归模型的离心泵流量控制方案,并应用SAS软件实现了离心泵的数据采集和流量自动控制,绘出了相应曲线。在化工原理实验课的离心泵性能测试实验中证明了SAS软件的...
    • 基于回归算法 用VB生成大树.rar
      基于回归算法 用VB生成大树,曾经让作者花了两年时间才完成,运用大量已优化的回归算法,通过给定的参数,简单的进行设置,可以生成一棵大树,算法值得一看,带全套背景、生成过程中带音乐,很不错。
    • java实现logistic回归算法
      java实现logistic回归算法 java实现logistic回归算法 java实现logistic回归算法