内部接口说明

# 坐姿识别内部接口说明 ## gitlab同步python模型及源码 [gitlab地址](https://gitlab.longbiaochen.com/workspace/sitting-postures) 源码及模型位置sitting-postures/models/posture_classifier ## Install ```shell git clone git@gitlab.longbiaochen.com:workspace/sitting-postures.git cd ./sitting-postures/models/posture_classifier/tf_pose/pafprocess sudo apt install swig swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace pip3 install -r requirements.txt ``` ## 接口说明 调用方式参考run.py ```python net = Net() image_path='./image/t1.jpg' val_image = cv2.imread(image_path, cv2.IMREAD_COLOR) predict_result=net.predict(val_image) ``` 函数接口定义 ```python def predict(self, image_path): ''' :param image: cv2 format image :return: result dictionary 如果成功检出人体: { "result":"success" "human":人体关键点坐标, "feature_image":PIL格式的人体热力图图片, "draw_image":PIL格式的画出人体骨架(火柴人)的图片, "posture_class":坐姿类别,//int 1-6 1:端正、2:后仰、3:前倾、4:左前倾、5:右前倾、6:趴伏、444:无数据 "direction":"front"/"left"/"right" //相机相对人体方向 } 如果失败,即第7类无数据: { "result":"failed" } ''' ``` ### 需求方需要数据 通过predict()函数返回 1. 坐姿分类结果: predict_result["posture_class"] 2. 人体骨架关键点数据: predict_result["human"] 3. 画出人体骨架关键点的图片:predict_result["draw_image"] 4. 人体骨架热力图:predict_result["feature_image"] 5. 相机相对位置:predict_result["direction"]