Commit 0241284082d943b8023ba8960fae113a587d5e74
1 parent
0f45059b
pre-load an instance of the landmarker, whitespace fixes
Showing
1 changed file
with
3 additions
and
3 deletions
openbr/plugins/classification/dlib.cpp
| @@ -35,21 +35,21 @@ class DLandmarkerTransform : public UntrainableTransform | @@ -35,21 +35,21 @@ class DLandmarkerTransform : public UntrainableTransform | ||
| 35 | Q_OBJECT | 35 | Q_OBJECT |
| 36 | 36 | ||
| 37 | private: | 37 | private: |
| 38 | - | ||
| 39 | Resource<shape_predictor> shapeResource; | 38 | Resource<shape_predictor> shapeResource; |
| 40 | 39 | ||
| 41 | void init() | 40 | void init() |
| 42 | { | 41 | { |
| 43 | shapeResource.setResourceMaker(new DLibShapeResourceMaker()); | 42 | shapeResource.setResourceMaker(new DLibShapeResourceMaker()); |
| 43 | + shapeResource.release(shapeResource.acquire()); // Pre-load one instance of the model | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | QPointF averagePoints(const QList<QPointF> &points, int rangeBegin, int rangeEnd) const | 46 | QPointF averagePoints(const QList<QPointF> &points, int rangeBegin, int rangeEnd) const |
| 47 | { | 47 | { |
| 48 | - QPointF point; | 48 | + QPointF point; |
| 49 | for (int i=rangeBegin; i<rangeEnd; i++) | 49 | for (int i=rangeBegin; i<rangeEnd; i++) |
| 50 | point += points[i]; | 50 | point += points[i]; |
| 51 | point /= (rangeEnd-rangeBegin); | 51 | point /= (rangeEnd-rangeBegin); |
| 52 | - return point; | 52 | + return point; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | void setFacePoints(Template &dst) const | 55 | void setFacePoints(Template &dst) const |