# AICPU_FaceAlign_OP **Repository Path**: yukming_law/aicpu_facealign_op ## Basic Information - **Project Name**: AICPU_FaceAlign_OP - **Description**: Ascend 3.3.0 aicpu op face align sample - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2021-05-11 - **Last Updated**: 2023-09-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Ascend AICPU Face Align OP ### op description: | node | name | type | format | func | | :------ | ------------------- | -------- | ------ | ------------------------------------------------------------ | | input0 | image | uint8 | NHWC | input src image, N == 1 | | input1 | keypoints | float32 | ND | face keypoint of the input image, N == detected face number, D == 10 define as [left_eye_x, left_eye_y, right_eye_x, right_eye_y, nose_x, nose_y, left_mouth_x, right_mouth_y] | | input2 | face_num | int32 | ND | detected face number of input image | | attr0 | face_size | list_int | [2] | aligned image's size,default:[112,112] | | attr1 | default_keypoints | list_int | [10] | target align keypoint,default:[40,45,72,45,52,65,42,82,72,82] | | output0 | face_aligned_images | uint8 | NHWC | N == detected face number, HW == face_size | ### complie: #### you **must** use the static lib of opencv which complie with aarch64-linux-gnu-gcc-7.5 here comes a complied lib shared with you: 链接: https://pan.baidu.com/s/1Z8sGoSI3eqUfime9aF5wSQ 密码: r80o modify the ./FaceAlign_OP/cpukernel/CMakeLists.txt line 115 with your own opencv's path: ``` set(OpenCV_DIR /usr/local/opencv/lib/cmake/opencv4) ``` then build the project: ``` ./build.sh ``` ### install: found the op install package in build_out: ``` export ASCEND_OPP_PATH=your own ascend-toolkit/latest/opp ./custom_opp_Linux_x86_64.run ``` ### trans single op om model: ``` cd ./verdify_facealign_op/model atc --singleop=FaceAlign.json --output=FaceAlign --soc_version=Ascend310 ``` and you will get an om file ### verdify op: build the verdify project ``` cd ./verdify_facealign_op/ mkdir build cd build cmake .. make ./main ../model/xxx.om ../data/bigbang.jpg ``` input: ![](./verdify_facealign_op/data/bigbang.jpeg) output: | ![](./verdify_facealign_op/data/face_aligned_0.jpg) | ![face_aligned_1](./verdify_facealign_op/data/face_aligned_1.jpg) | ![face_aligned_2](./verdify_facealign_op/data/face_aligned_2.jpg) | ![face_aligned_3](./verdify_facealign_op/data/face_aligned_3.jpg) | | --------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |