#include "../../nodes/vp_file_src_node.h" #include "../../nodes/infers/vp_yunet_face_detector_node.h" #include "../../nodes/infers/vp_sface_feature_encoder_node.h" #include "../../nodes/track/vp_sort_track_node.h" #include "../../nodes/osd/vp_face_osd_node.h" #include "../../nodes/broker/vp_embeddings_socket_broker_node.h" #include "../../nodes/vp_screen_des_node.h" #include "../../nodes/vp_rtmp_des_node.h" #include "../../utils/analysis_board/vp_analysis_board.h" /* * ## face recognize pipeline ## * generate embedding data for faces using VideoPipe, then send them via socket. * note it brokes only 1 time for specific target since track node exist in pipeline. */ int main(int argc, char* argv[]) { // get directory for test video and models assert(argc == 2); std::string data_dir(argv[1]); if (!vp_utils::ends_with(data_dir, "/")) { data_dir += "/"; } VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO); VP_LOGGER_INIT(); // create nodes auto file_src_0 = std::make_shared("file_src_0", 0, data_dir + "vp_data/test_video/face3.mp4", 0.8); auto yunet_face_detector_0 = std::make_shared("face_detector", data_dir + "vp_data/models/face/face_detection_yunet_2022mar.onnx"); auto sface_face_encoder_0 = std::make_shared("face_encoder", data_dir + "vp_data/models/face/face_recognition_sface_2021dec.onnx"); auto track = std::make_shared("tracker", vp_nodes::vp_track_for::FACE); auto broker = std::make_shared("embedding_broker", "192.168.77.68", 5555, "static/cropped_faces", 100, 100, vp_nodes::vp_broke_for::FACE, true); auto osd = std::make_shared("osd"); auto screen_des_0 = std::make_shared("screen_des_0", 0); auto rtmp_des_0 = std::make_shared("rtmp_des_0", 0, "rtmp://192.168.77.60/live/face_recognize"); // construct pipeline yunet_face_detector_0->attach_to({file_src_0}); sface_face_encoder_0->attach_to({yunet_face_detector_0}); track->attach_to({sface_face_encoder_0}); broker->attach_to({track}); osd->attach_to({broker}); screen_des_0->attach_to({osd}); rtmp_des_0->attach_to({osd}); file_src_0->start(); // for debug purpose vp_utils::vp_analysis_board board({file_src_0}); board.display(); }