SDM For Face Alignment流程介绍及Matlab代码实现之测试篇
来源:互联网 发布:mac风扇一直转 编辑:程序博客网 时间:2024/05/27 12:21
测试很简单了,只需要载入数据,然后做正则化处理,使用训练模型产生的
face_alignment.m:用来预测特征点
function shape = face_alignment( ShapeModel, DataVariation,... LearnedCascadedModel, Data, img, shape, options )%% setup the fixed parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%nData = length(Data);shapeDim = size(ShapeModel.MeanShape,1);n_init_randoms_test = options.n_init_randoms_test;MeanShape2 = vec_2_shape(ShapeModel.MeanShape);aligned_shape = zeros(n_init_randoms_test,shapeDim);%% detect the face region using face detectors or ground-truth %%%%%%%%%%%%%% if using ground-truth boxes = detect_face( img , options );%% predict the face box bbox2 = get_correct_region2( boxes, shape,img, 1 );bbox= [];if isempty(bbox) %% if using ground-truth bbox = getbbox(shape);end%% randomize n positions for initial shapes[rbbox] = random_init_position( ... bbox, DataVariation, n_init_randoms_test );[rbbox2] = random_init_position( ... bbox2, DataVariation, n_init_randoms_test );%% randomize which shape is used for initial positionrIdx = randi([1,nData],n_init_randoms_test);%% iterations of n initial points %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%for ir = 1 : n_init_randoms_test %% get random positions and inital shape indexs idx = rIdx(ir); init_shape = Data(idx).shape; %% get randomly shape from others cbbox = rbbox(ir,:); cbbox2 = rbbox2(ir,:); %init_shape = resetshape(cbbox, init_shape); init_shape = resetshape(cbbox, MeanShape2); init_shape2 = resetshape(cbbox2, MeanShape2); %test box between ground-truth and face detector if 0 figure(1); imshow(img); hold on; draw_shape(init_shape(:,1), init_shape(:,2),'r'); draw_shape(init_shape2(:,1), init_shape2(:,2),'g'); hold on; rectangle('Position', cbbox, 'EdgeColor', 'y'); rectangle('Position', cbbox2, 'EdgeColor', 'k'); hold off; pause; end %% detect landmarks using cascaded regression aligned_shape(ir,:) = cascaded_regress( ShapeModel, ... LearnedCascadedModel, img, init_shape, options );endif n_init_randoms_test == 1 shape = vec_2_shape(aligned_shape');else shape = vec_2_shape(mean(aligned_shape)');endend
我们来看一下效果:
0 0
- SDM For Face Alignment流程介绍及Matlab代码实现之测试篇
- SDM For Face Alignment 流程介绍及Matlab代码实现之预处理篇
- SDM For Face Alignment 流程介绍及Matlab代码实现之训练篇
- SDM For Face Alignment 流程介绍及Matlab代码实现之训练篇
- SDM For Face Alignment 流程介绍及Matlab代码实现之训练篇
- SDM for face alignment 人脸对齐相关资料整理
- Supervised Descent Method and its Applications to Face Alignment(SDM)
- Face Alignment by 3000 FPS 代码之二
- Joint Cascade Face Detection and Alignment流程
- Affine-Transformation Parameters Regression for Face Alignment
- 决策树及随机森林在face alignment at 3000fps中的训练和测试
- Face Alignment
- Face Alignment
- Face Alignment
- Face Alignment(Face Landmark)
- POCR-project-out cascaded regression for face alignment
- CNN for Face Alignment 深度神经网络的初次尝试
- Joint Cascade Face detection and Alignment(ECCV2014)介绍
- Notepad++中常用的插件
- UE4信息交互-通过中间变量进行信息交互
- 云存储FSS使用规范
- 二叉树题目
- 机器学习入门-了解相关概念
- SDM For Face Alignment流程介绍及Matlab代码实现之测试篇
- 面向对象笔记
- 使用PullToRefresh实现下拉刷新和上拉加载
- Dijkstra最短路径算法详解
- 双链表:实现基本的增删查改,正反向现实双链表的节点
- 垃圾回收机制与内存分配策略
- 黑马程序员---指向函数的指针与返回指针的函数
- 黑马程序员---c语言基础---数组、指针
- java学习笔记——static关键字