C++ Face Detector Example¶
Initialize face detector model
oneML::face::FaceDetector detector;
Initialize face detector model with licensing
oneML::LicenseManager license_manager;
license_manager.set_key("LICENSE_KEY_VALUE_HERE");
license_manager.activate_key();
oneML::face::FaceDetector detector(license_manager);
Initialize oneML’s Utils
oneML::Utils utils;
Initialize oneML’s Utils with licensing
oneML::Utils utils(license_manager);
Create oneML’s MultiImage input and outputs object
oneML::MultiImage inputs{img1, img2, ... img4};
std::vector<oneML::face::FaceDetectorResult> outputs;
Create oneML’s Image input and output object
oneML::Image img;
utils.read_image_cv(path, img);
oneML::face::FaceDetectorResult output;
Run the model
detector.detect(inputs, outputs);
or
detector.detect(img, output);
And get the output
std::vector<float> scores{};
std::vector<oneML::face::BBox> bboxes{};
std::vector<oneML::face::FaceLandmark5> landmarks;
std::vector<oneML::face::Pose> poses{};
output.get_scores(scores);
output.get_bboxes(bboxes);
output.get_landmarks(landmarks);
output.get_poses(poses);
int size = output.get_size();
std::vector<int> statuses = output.get_return_status();