Comments (2)
Hi @mousomer,
yeah, sure it is possible. Actually, this is how it is done in the MATLAB and Python interfaces - the CFLandmark and CFeaturePool classes are initialized only once and reused each time new image is provided.
So, the fastest solution is to use the interfaces. Or you can rewrite the code such that it processes a list of images. I have some example for the video stream, which is doing exactly that. However, I probably won't be able to upload it sooner than in 2 weeks.
from clandmark.
Well, yes, it certainly works:
` // initialization of C2F-DPM
string MODEL_CDPM = GetRunPath () + "../../" +modelDir + "/CDPM.xml";
string MODEL_FDPM = GetRunPath () + "../../" +modelDir + "/FDPM.xml";
string MODEL_AFLW_N_PROF = GetRunPath () + "../../" +modelDir + "PART_fixed_JOINTMV_-PROFILE.xml";
string MODEL_AFLW_HN_PROF = GetRunPath () + "../../" +modelDir + "PART_fixed_JOINTMV_-HALF-PROFILE.xml";
string MODEL_AFLW_FRONT = GetRunPath () + "../../" +modelDir + "PART_fixed_JOINTMV_FRONTAL.xml";
string MODEL_AFLW_HP_PROF = GetRunPath () + "../../" +modelDir + "PART_fixed_JOINTMV_HALF-PROFILE.xml";
string MODEL_AFLW_P_PROF = GetRunPath () + "../../" +modelDir + "PART_fixed_JOINTMV_PROFILE.xml";
string AFLW_extentions[5] = {
"NegProf",
"NegHProf",
"Frontal",
"PosHProf",
"PosProf" };
Flandmark *CDPM = Flandmark::getInstanceOf (MODEL_CDPM.c_str ());
Flandmark *FDPM = Flandmark::getInstanceOf (MODEL_FDPM.c_str ());
Flandmark *AFLW_NP = Flandmark::getInstanceOf (MODEL_AFLW_N_PROF.c_str ());
Flandmark *AFLW_PP = Flandmark::getInstanceOf (MODEL_AFLW_P_PROF.c_str ());
Flandmark *AFLW_NHP = Flandmark::getInstanceOf (MODEL_AFLW_HN_PROF.c_str ());
Flandmark *AFLW_PHP = Flandmark::getInstanceOf (MODEL_AFLW_HP_PROF.c_str ());
Flandmark *AFLW_F = Flandmark::getInstanceOf (MODEL_AFLW_FRONT.c_str ());
c_prof.Start(pf_classesC);
const int * bw_sizeC = CDPM->getBaseWindowSize();
CFeaturePool * featuresPoolCDPM = new CFeaturePool(bw_sizeC[0], bw_sizeC[1]);
featuresPoolCDPM->addFeaturesToPool( new CSparseLBPFeatures(featuresPoolCDPM->getWidth(), featuresPoolCDPM->getHeight(),
featuresPoolCDPM->getPyramidLevels(), featuresPoolCDPM->getCumulativeWidths()));
CDPM->setNFfeaturesPool(featuresPoolCDPM);
printf("init Coarse DPM %d x %d \n", bw_sizeC[0], bw_sizeC[1] );
const int * bw_sizeF = FDPM->getBaseWindowSize();
CFeaturePool * featuresPoolFDPM = new CFeaturePool(bw_sizeF[0], bw_sizeF[1]);
featuresPoolFDPM->addFeaturesToPool(new CSparseLBPFeatures( featuresPoolFDPM->getWidth(), featuresPoolFDPM->getHeight(),
featuresPoolFDPM->getPyramidLevels(), featuresPoolFDPM->getCumulativeWidths()));
FDPM->setNFfeaturesPool(featuresPoolFDPM);
printf("init Fine DPM %d x %d \n", bw_sizeF[0], bw_sizeF[1] );
const int * bw_size = AFLW_F->getBaseWindowSize();
CFeaturePool * featuresPoolAFLW = new CFeaturePool(bw_size[0], bw_size[1]);
featuresPoolAFLW->addFeaturesToPool(new CSparseLBPFeatures( featuresPoolAFLW->getWidth(), featuresPoolAFLW->getHeight(),
featuresPoolAFLW->getPyramidLevels(), featuresPoolAFLW->getCumulativeWidths()));
AFLW_NP->setNFfeaturesPool(featuresPoolAFLW);
AFLW_PP->setNFfeaturesPool(featuresPoolAFLW);
AFLW_NHP->setNFfeaturesPool(featuresPoolAFLW);
AFLW_PHP->setNFfeaturesPool(featuresPoolAFLW);
AFLW_F->setNFfeaturesPool(featuresPoolAFLW);
Flandmark* FL_JA[5] = {AFLW_NP, AFLW_NHP, AFLW_F, AFLW_PHP, AFLW_PP};`
And then a call to the detect function with the model pointer array. Runtime is much better.
from clandmark.
Related Issues (20)
- Running Clandmark webcam example HOT 15
- Truecaller_api
- Tru
- Truecaller_api HOT 1
- matlab interface HOT 2
- matlab interface HOT 5
- missing -lopencv_imgcodecs for libopencv 3.1.0 HOT 3
- Using code in video processing,how can I speed up it? HOT 2
- Error in `./video_input': double free or corruption (out): 0x0000000000b56020 ***Aborted (core dumped) HOT 1
- Face Rectangle size HOT 11
- Relocation error when compiling Python interface on Ubuntu HOT 23
- cannot openfile CDPM.xml HOT 9
- Building python_binding HOT 2
- Ask some questions for using "C2F-DPM.xml" HOT 5
- How to build a new face model based on Rhesus monkey ?
- Matlab interface on linux
- Can I use this lib to detect smile ? HOT 2
- Using clandmark in Android app with native c++ HOT 6
- Question for unstable landmark points according to new input frames.
- Multi-view face landmark extraction in Python HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clandmark.