diff --git a/CMakeLists.txt b/CMakeLists.txt index e79e253a32..96e205dedc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,13 @@ if(ENABLE_PADDLE_BACKEND) add_definitions(-DENABLE_PADDLE_BACKEND) list(APPEND ALL_DEPLOY_SRCS ${DEPLOY_PADDLE_SRCS}) include(external/paddle_inference.cmake) - list(APPEND DEPEND_LIBS external_paddle_inference external_dnnl external_omp) + if(NOT APPLE) + list(APPEND DEPEND_LIBS external_paddle_inference external_dnnl external_omp) + else() + # no third parties libs(mkldnn and omp) need to + # link into paddle_inference on MacOS OSX. + list(APPEND DEPEND_LIBS external_paddle_inference) + endif() endif() if(WITH_GPU) diff --git a/FastDeploy.cmake.in b/FastDeploy.cmake.in index ccd1039be2..6ee4f490ee 100644 --- a/FastDeploy.cmake.in +++ b/FastDeploy.cmake.in @@ -33,13 +33,16 @@ if(ENABLE_PADDLE_BACKEND) set(DNNL_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mkldnn/lib/mkldnn.lib") set(IOMP_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mklml/lib/libiomp5md.lib") elseif(APPLE) - set(DNNL_LIB "") - set(IOMP_LIB "") + message(STATUS "No third parties libs(mkldnn and omp) need to link into paddle_inference on MacOS OSX.") else() set(DNNL_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0") set(IOMP_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mklml/lib/libiomp5.so") endif() - list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB} ${DNNL_LIB} ${IOMP_LIB}) + if(NOT APPLE) + list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB} ${DNNL_LIB} ${IOMP_LIB}) + else() + list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB}) + endif() endif() if(WITH_GPU) diff --git a/README.md b/README.md index 8c77cdf684..c9b23b6a15 100644 --- a/README.md +++ b/README.md @@ -36,54 +36,53 @@
-符号说明: (1) ✅: 已经支持; (2) ❔: 计划未来支持; (3) ❌: 暂不支持; (4) contrib: 外部模型 -| 任务场景 | 模型 | API | Linux | Linux | Windows | Windows | MacOS | MacOS | Linux | -| :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | -| --- | --- | --- | X86 CPU | NVIDIA GPU | Intel CPU | NVIDIA GPU | Intel CPU | Arm CPU | NVIDIA Jetson | -| Classification | [PaddleClas/ResNet50](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/PPLCNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/PPLCNetv2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/EfficientNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/GhostNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/MobileNetV1](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/MobileNetV2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/MobileNetV3](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/ShuffleNetV2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/SqueeezeNetV1.1](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/Inceptionv3](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/PPHGNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Classification | [PaddleClas/SwinTransformer](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/PPYOLOE](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/PicoDet](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/YOLOX](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/YOLOv3](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/PPYOLO](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/PPYOLOv2](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [PaddleDetection/FasterRCNN](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOX](./examples/vision/detection/yolox) | [Python](./examples/vision/detection/yolox/python)/[C++](./examples/vision/detection/yolox/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOv7](./examples/vision/detection/yolov7) | [Python](./examples/vision/detection/yolov7/python)/[C++](./examples/vision/detection/yolov7/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOv6](./examples/vision/detection/yolov6) | [Python](./examples/vision/detection/yolov6/python)/[C++](./examples/vision/detection/yolov6/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOv5](./examples/vision/detection/yolov5) | [Python](./examples/vision/detection/yolov5/python)/[C++](./examples/vision/detection/yolov5/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOR](./examples/vision/detection/yolor) | [Python](./examples/vision/detection/yolor/python)/[C++](./examples/vision/detection/yolor/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/ScaledYOLOv4](./examples/vision/detection/scaledyolov4) | [Python](./examples/vision/detection/scaledyolov4/python)/[C++](./examples/vision/detection/scaledyolov4/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/YOLOv5Lite](./examples/vision/detection/yolov5lite) | [Python](./examples/vision/detection/yolov5lite/python)/[C++](./examples/vision/detection/yolov5lite/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Detection | [Contrib/NanoDetPlus](./examples/vision/detection/nanodet_plus) | [Python](./examples/vision/detection/nanodet_plus/python)/[C++](./examples/vision/detection/nanodet_plus/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/PPLiteSeg](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/PPHumanSegLite](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/HRNet](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/PPHumanSegServer](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/Unet](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Segmentation | [PaddleSeg/Deeplabv3](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceDetection | [Contrib/RetinaFace](./examples/vision/facedet/retinaface) | [Python](./examples/vision/facedet/retinaface/python)/[C++](./examples/vision/facedet/retinaface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceDetection | [Contrib/UltraFace](./examples/vision/facedet/utltraface) | [ Python](./examples/vision/facedet/utltraface/python)/[C++](./examples/vision/facedet/utltraface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceDetection | [Contrib/YOLOv5Face](./examples/vision/facedet/yolov5face) | [Python](./examples/vision/facedet/yolov5face/python)/[C++](./examples/vision/facedet/yolov5face/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceDetection | [Contrib/SCRFD](./examples/vision/facedet/scrfd) | [Python](./examples/vision/facedet/scrfd/python)/[C++](./examples/vision/facedet/scrfd/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceRecognition | [Contrib/ArcFace](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceRecognition | [Contrib/CosFace](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceRecognition | [Contrib/PartialFC](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| FaceRecognition | [Contrib/VPL](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | -| Matting | [Contrib/MODNet](./examples/vision/matting/modnet) | [Python](./examples/vision/matting/modnet/python)/[C++](./examples/vision/matting/modnet/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | - +符号说明: (1) ✅: 已经支持; (2) ❔: 计划未来支持; (3) ❌: 暂不支持; (4) contrib: 外部模型 +| 任务场景 | 模型 | API | Linux | Linux | Win | Win | Mac | Mac | Linux | Linux | +| :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | +| --- | --- | --- | X86 CPU | NVIDIA GPU | Intel CPU | NVIDIA GPU | Intel CPU | Arm CPU | AArch64 CPU | NVIDIA Jetson | +| Classification | [PaddleClas/ResNet50](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/PPLCNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/PPLCNetv2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/EfficientNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/GhostNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/MobileNetV1](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/MobileNetV2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/MobileNetV3](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/ShuffleNetV2](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/SqueeezeNetV1.1](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/Inceptionv3](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/PPHGNet](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Classification | [PaddleClas/SwinTransformer](./examples/vision/classification/paddleclas) | [Python](./examples/vision/classification/paddleclas/python)/[C++](./examples/vision/classification/paddleclas/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [PaddleDetection/PPYOLOE](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [PaddleDetection/PicoDet](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [PaddleDetection/YOLOX](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [PaddleDetection/YOLOv3](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [PaddleDetection/PPYOLO](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❔ | +| Detection | [PaddleDetection/PPYOLOv2](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❔ | +| Detection | [PaddleDetection/FasterRCNN](./examples/vision/detection/paddledetection) | [Python](./examples/vision/detection/paddledetection/python)/[C++](./examples/vision/detection/paddledetection/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❔ | +| Detection | [Contrib/YOLOX](./examples/vision/detection/yolox) | [Python](./examples/vision/detection/yolox/python)/[C++](./examples/vision/detection/yolox/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/YOLOv7](./examples/vision/detection/yolov7) | [Python](./examples/vision/detection/yolov7/python)/[C++](./examples/vision/detection/yolov7/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/YOLOv6](./examples/vision/detection/yolov6) | [Python](./examples/vision/detection/yolov6/python)/[C++](./examples/vision/detection/yolov6/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/YOLOv5](./examples/vision/detection/yolov5) | [Python](./examples/vision/detection/yolov5/python)/[C++](./examples/vision/detection/yolov5/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/YOLOR](./examples/vision/detection/yolor) | [Python](./examples/vision/detection/yolor/python)/[C++](./examples/vision/detection/yolor/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/ScaledYOLOv4](./examples/vision/detection/scaledyolov4) | [Python](./examples/vision/detection/scaledyolov4/python)/[C++](./examples/vision/detection/scaledyolov4/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/YOLOv5Lite](./examples/vision/detection/yolov5lite) | [Python](./examples/vision/detection/yolov5lite/python)/[C++](./examples/vision/detection/yolov5lite/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Detection | [Contrib/NanoDetPlus](./examples/vision/detection/nanodet_plus) | [Python](./examples/vision/detection/nanodet_plus/python)/[C++](./examples/vision/detection/nanodet_plus/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/PPLiteSeg](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/PPHumanSegLite](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/HRNet](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/PPHumanSegServer](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/Unet](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Segmentation | [PaddleSeg/Deeplabv3](./examples/vision/segmentation/paddleseg) | [Python](./examples/vision/segmentation/paddleseg/python)/[C++](./examples/vision/segmentation/paddleseg/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceDetection | [Contrib/RetinaFace](./examples/vision/facedet/retinaface) | [Python](./examples/vision/facedet/retinaface/python)/[C++](./examples/vision/facedet/retinaface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceDetection | [Contrib/UltraFace](./examples/vision/facedet/utltraface) | [ Python](./examples/vision/facedet/utltraface/python)/[C++](./examples/vision/facedet/utltraface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceDetection | [Contrib/YOLOv5Face](./examples/vision/facedet/yolov5face) | [Python](./examples/vision/facedet/yolov5face/python)/[C++](./examples/vision/facedet/yolov5face/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceDetection | [Contrib/SCRFD](./examples/vision/facedet/scrfd) | [Python](./examples/vision/facedet/scrfd/python)/[C++](./examples/vision/facedet/scrfd/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceRecognition | [Contrib/ArcFace](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceRecognition | [Contrib/CosFace](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceRecognition | [Contrib/PartialFC](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| FaceRecognition | [Contrib/VPL](./examples/vision/faceid/insightface) | [Python](./examples/vision/faceid/insightface/python)/[C++](./examples/vision/faceid/insightface/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | +| Matting | [Contrib/MODNet](./examples/vision/matting/modnet) | [Python](./examples/vision/matting/modnet/python)/[C++](./examples/vision/matting/modnet/cpp) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❔ | ## 2. 服务端快速开始
@@ -146,43 +145,44 @@ int main(int argc, char* argv[]) { ## 3. 轻量化SDK快速实现端侧AI推理部署 📱
-| 场景 | 模型 | 大小(MB) | Linux | Android | iOS | Linux | Linux | Linux | 扩展中... | -| :--------: | :--------: | :--------: | :--------: | :--------: | :--------: |:--------: | :--------: | :--------: | :--------: | -| --- | --- | --- | ARM CPU | ARM CPU | ARM CPU| 瑞芯微NPU RV1109/RV1126/RK1808 | 晶晨NPU A311D/S905D3/C308X | 恩智浦NPU i.MX 8M Plus |扩展中... | -| Detection | PP-PicoDet_s_320_coco | 4.1 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | PP-PicoDet_s_320_lcnet | 4.9 | ✅ | ✅ | ✅ |✅ | ✅ | ✅ | -| Detection | CenterNet | 4.8 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | YOLOv3_MobileNetV3 | 94.6 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | PP-YOLO_tiny_650e_coco | 4.4 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | SSD_MobileNetV1_300_120e_voc | 23.3 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | PP-YOLO_ResNet50vd | 188.5 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | PP-YOLOv2_ResNet50vd | 218.7 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | PP-YOLO_crn_l_300e_coco | 209.1 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Detection | YOLOv5s | 29.3 | ✅ | ✅ | ✅ | \ | \ | \ | | -| FaceDetection | BlazeFace | 1.5 | ✅ | ✅ | ✅ | \ | \ | \ | | -| FaceDetection | RetinaFace | 1.7 | ✅ | ❌ | ❌ | \ | \ | \ | | -| Classification | PP-LCNet | 11.9 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | PP-LCNetv2 | 26.6 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | EfficientNet | 31.4 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | GhostNet | 20.8 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | MobileNetV1 | 17 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | MobileNetV2 | 14.2 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | MobileNetV3 | 22 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | ShuffleNetV2 | 9.2 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | SqueezeNetV1.1 | 5 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | Inceptionv3 | 95.5 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | PP-HGNet | 59 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Classification | SwinTransformer_224_win7 | 352.7 | ✅ | ✅ | ✅ | \ | \ | \ | | -| KeypointsDetection | PP-TinyPose | 5.5 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Segmentation | PP-LiteSeg(STDC1) | 32.2 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Segmentation | PP-HumanSeg-Lite | 0.556 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Segmentation | HRNet-w18 | 38.7 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Segmentation | PP-HumanSeg-Server | 107.2 | ✅ | ✅ | ✅ | \ | \ | \ | | -| Segmentation | Unet | 53.7 | ❌ | ✅ | ❌ | \ | \ | \ | | -| OCR | PP-OCRv1 | 2.3+4.4 | ✅ | ✅ | ✅ | \ | \ | \ | | -| OCR | PP-OCRv2 | 2.3+4.4 | ✅ | ✅ | ✅ | \ | \ | \ | | -| OCR | PP-OCRv3 | 2.4+10.6 | ✅ | ✅ | ✅ | \ | \ | \ | | -| OCR | PP-OCRv3-tiny | 2.4+10.7 | ✅ | ✅ | ✅ | \ | \ | \ | | +| 任务场景 | 模型 | 大小(MB) | 边缘端 | 移动端 | 移动端 | +| :--------: | :--------: | :--------: | :--------: | :--------: | :--------: | +| --- | --- | --- | Linux | Android | iOS | +| --- | --- | --- | ARM CPU | ARM CPU | ARM CPU | +| Classification | PP-LCNet | 11.9 | ✅ | ✅ | ✅ | +| Classification | PP-LCNetv2 | 26.6 | ✅ | ✅ | ✅ | +| Classification | EfficientNet | 31.4 | ✅ | ✅ | ✅ | +| Classification | GhostNet | 20.8 | ✅ | ✅ | ✅ | +| Classification | MobileNetV1 | 17 | ✅ | ✅ | ✅ | +| Classification | MobileNetV2 | 14.2 | ✅ | ✅ | ✅ | +| Classification | MobileNetV3 | 22 | ✅ | ✅ | ✅ | +| Classification | ShuffleNetV2 | 9.2 | ✅ | ✅ | ✅ | +| Classification | SqueezeNetV1.1 | 5 | ✅ | ✅ | ✅ | +| Classification | Inceptionv3 | 95.5 | ✅ | ✅ | ✅ | +| Classification | PP-HGNet | 59 | ✅ | ✅ | ✅ | +| Classification | SwinTransformer_224_win7 | 352.7 | ✅ | ✅ | ✅ | +| Detection | PP-PicoDet_s_320_coco | 4.1 | ✅ | ✅ | ✅ | +| Detection | PP-PicoDet_s_320_lcnet | 4.9 | ✅ | ✅ | ✅ | +| Detection | CenterNet | 4.8 | ✅ | ✅ | ✅ | +| Detection | YOLOv3_MobileNetV3 | 94.6 | ✅ | ✅ | ✅ | +| Detection | PP-YOLO_tiny_650e_coco | 4.4 | ✅ | ✅ | ✅ | +| Detection | SSD_MobileNetV1_300_120e_voc | 23.3 | ✅ | ✅ | ✅ | +| Detection | PP-YOLO_ResNet50vd | 188.5 | ✅ | ✅ | ✅ | +| Detection | PP-YOLOv2_ResNet50vd | 218.7 | ✅ | ✅ | ✅ | +| Detection | PP-YOLO_crn_l_300e_coco | 209.1 | ✅ | ✅ | ✅ | +| Detection | YOLOv5s | 29.3 | ✅ | ✅ | ✅ | +| FaceDetection | BlazeFace | 1.5 | ✅ | ✅ | ✅ | +| FaceDetection | RetinaFace | 1.7 | ✅ | ❌ | ❌ | +| KeypointsDetection | PP-TinyPose | 5.5 | ✅ | ✅ | ✅ | +| Segmentation | PP-LiteSeg(STDC1) | 32.2 | ✅ | ✅ | ✅ | +| Segmentation | PP-HumanSeg-Lite | 0.556 | ✅ | ✅ | ✅ | +| Segmentation | HRNet-w18 | 38.7 | ✅ | ✅ | ✅ | +| Segmentation | PP-HumanSeg-Server | 107.2 | ✅ | ✅ | ✅ | +| Segmentation | Unet | 53.7 | ❌ | ✅ | ❌ | +| OCR | PP-OCRv1 | 2.3+4.4 | ✅ | ✅ | ✅ | +| OCR | PP-OCRv2 | 2.3+4.4 | ✅ | ✅ | ✅ | +| OCR | PP-OCRv3 | 2.4+10.6 | ✅ | ✅ | ✅ | +| OCR | PP-OCRv3-tiny | 2.4+10.7 | ✅ | ✅ | ✅ | ### 3.1 边缘侧部署
diff --git a/csrc/fastdeploy/backends/common/multiclass_nms.cc b/csrc/fastdeploy/backends/common/multiclass_nms.cc index c3d65ec7df..db98e8c7e1 100644 --- a/csrc/fastdeploy/backends/common/multiclass_nms.cc +++ b/csrc/fastdeploy/backends/common/multiclass_nms.cc @@ -162,11 +162,11 @@ void MultiClassNMS::Compute(const float* boxes_data, const float* scores_data, int64_t out_dim = box_dim + 2; int num_nmsed_out = 0; - FDASSERT(score_size == 3, "Require rank of input scores be 3, but now it's " + - std::to_string(score_size) + "."); + FDASSERT(score_size == 3, + "Require rank of input scores be 3, but now it's %d.", score_size); FDASSERT(boxes_dim[2] == 4, - "Require the 3-dimension of input boxes be 4, but now it's " + - std::to_string(boxes_dim[2]) + "."); + "Require the 3-dimension of input boxes be 4, but now it's %lld.", + box_dim); out_num_rois_data.resize(batch_size); std::vector>> all_indices; diff --git a/csrc/fastdeploy/backends/ort/ops/multiclass_nms.cc b/csrc/fastdeploy/backends/ort/ops/multiclass_nms.cc index a132dbffc3..36bc5dadfc 100644 --- a/csrc/fastdeploy/backends/ort/ops/multiclass_nms.cc +++ b/csrc/fastdeploy/backends/ort/ops/multiclass_nms.cc @@ -178,11 +178,11 @@ void MultiClassNmsKernel::Compute(OrtKernelContext* context) { int64_t out_dim = box_dim + 2; int num_nmsed_out = 0; - FDASSERT(score_size == 3, "Require rank of input scores be 3, but now it's " + - std::to_string(score_size) + "."); + FDASSERT(score_size == 3, + "Require rank of input scores be 3, but now it's %d.", score_size); FDASSERT(boxes_dim[2] == 4, - "Require the 3-dimension of input boxes be 4, but now it's " + - std::to_string(boxes_dim[2]) + "."); + "Require the 3-dimension of input boxes be 4, but now it's %lld.", + box_dim); std::vector out_num_rois_dims = {batch_size}; OrtValue* out_num_rois = ort_.KernelContext_GetOutput( context, 2, out_num_rois_dims.data(), out_num_rois_dims.size()); diff --git a/csrc/fastdeploy/backends/ort/ort_backend.cc b/csrc/fastdeploy/backends/ort/ort_backend.cc index 5aa14448c4..a296c6b2b8 100644 --- a/csrc/fastdeploy/backends/ort/ort_backend.cc +++ b/csrc/fastdeploy/backends/ort/ort_backend.cc @@ -191,8 +191,10 @@ void OrtBackend::CopyToCpu(const Ort::Value& value, FDTensor* tensor) { numel * sizeof(double)); tensor->dtype = FDDataType::FP64; } else { - FDASSERT(false, "Unrecognized data type of " + std::to_string(data_type) + - " while calling OrtBackend::CopyToCpu()."); + FDASSERT( + false, + "Unrecognized data type of %d while calling OrtBackend::CopyToCpu().", + data_type); } } @@ -237,9 +239,9 @@ bool OrtBackend::Infer(std::vector& inputs, } TensorInfo OrtBackend::GetInputInfo(int index) { - FDASSERT(index < NumInputs(), "The index:" + std::to_string(index) + - " should less than the number of inputs:" + - std::to_string(NumInputs()) + "."); + FDASSERT(index < NumInputs(), + "The index: %d should less than the number of inputs: %d.", index, + NumInputs()); TensorInfo info; info.name = inputs_desc_[index].name; info.shape.assign(inputs_desc_[index].shape.begin(), @@ -250,9 +252,8 @@ TensorInfo OrtBackend::GetInputInfo(int index) { TensorInfo OrtBackend::GetOutputInfo(int index) { FDASSERT(index < NumOutputs(), - "The index:" + std::to_string(index) + - " should less than the number of outputs:" + - std::to_string(NumOutputs()) + "."); + "The index: %d should less than the number of outputs: %d.", index, + NumOutputs()); TensorInfo info; info.name = outputs_desc_[index].name; info.shape.assign(outputs_desc_[index].shape.begin(), diff --git a/csrc/fastdeploy/core/fd_type.cc b/csrc/fastdeploy/core/fd_type.cc index ae70fa6e53..ccba7e2324 100644 --- a/csrc/fastdeploy/core/fd_type.cc +++ b/csrc/fastdeploy/core/fd_type.cc @@ -34,7 +34,7 @@ int FDDataTypeSize(const FDDataType& data_type) { } else if (data_type == FDDataType::UINT8) { return sizeof(uint8_t); } else { - FDASSERT(false, "Unexpected data type: " + Str(data_type)); + FDASSERT(false, "Unexpected data type: %s", Str(data_type).c_str()); } return -1; } diff --git a/csrc/fastdeploy/fastdeploy_model.cc b/csrc/fastdeploy/fastdeploy_model.cc index a60d7cae5b..d1d296c6cd 100644 --- a/csrc/fastdeploy/fastdeploy_model.cc +++ b/csrc/fastdeploy/fastdeploy_model.cc @@ -89,12 +89,12 @@ bool FastDeployModel::InitRuntime() { << Str(runtime_option.backend) << "." << std::endl; if (use_gpu) { FDASSERT(valid_gpu_backends.size() > 0, - "There's no valid gpu backend for " + ModelName() + "."); + "There's no valid gpu backend for %s.", ModelName().c_str()); FDWARNING << "FastDeploy will choose " << Str(valid_gpu_backends[0]) << " for model inference." << std::endl; } else { FDASSERT(valid_gpu_backends.size() > 0, - "There's no valid cpu backend for " + ModelName() + "."); + "There's no valid cpu backend for %s.", ModelName().c_str()); FDWARNING << "FastDeploy will choose " << Str(valid_cpu_backends[0]) << " for model inference." << std::endl; } diff --git a/csrc/fastdeploy/function/reduce.cc b/csrc/fastdeploy/function/reduce.cc index 388a6be33b..6ff35fe280 100644 --- a/csrc/fastdeploy/function/reduce.cc +++ b/csrc/fastdeploy/function/reduce.cc @@ -310,15 +310,16 @@ void ArgMinMax(const FDTensor& x, FDTensor* out, int64_t axis, const auto& x_dims = x.shape; int64_t x_rank = x_dims.size(); FDASSERT(axis >= -x_rank, - "'axis'(%d) must be greater than or equal to -Rank(X)(%d).", axis, - -x_rank); + "'axis'(%lld) must be greater than or equal to -Rank(X)(%lld).", + axis, -x_rank); FDASSERT(axis < x_rank, - "'axis'(%d) must be less than or equal to Rank(X)(%d).", axis, + "'axis'(%lld) must be less than or equal to Rank(X)(%lld).", axis, x_rank); FDASSERT(output_dtype == FDDataType::INT32 || FDDataType::INT64, "The attribute of dtype in argmin/argmax must be [%s] or [%s], but " "received [%s].", - Str(FDDataType::INT32), Str(FDDataType::INT64), Str(output_dtype)); + Str(FDDataType::INT32).c_str(), Str(FDDataType::INT64).c_str(), + Str(output_dtype).c_str()); if (axis < 0) axis += x_rank; if (output_dtype == FDDataType::INT32) { int64_t all_element_num = 0; @@ -330,7 +331,7 @@ void ArgMinMax(const FDTensor& x, FDTensor* out, int64_t axis, } FDASSERT(all_element_num <= std::numeric_limits::max(), "The element num of the argmin/argmax input at axis is " - "%d, is larger than int32 maximum value:%d, you must " + "%lld, is larger than int32 maximum value:%d, you must " "set the dtype of argmin/argmax to 'int64'.", all_element_num, std::numeric_limits::max()); } diff --git a/csrc/fastdeploy/function/softmax.cc b/csrc/fastdeploy/function/softmax.cc index 3e89a019fa..83b110200c 100644 --- a/csrc/fastdeploy/function/softmax.cc +++ b/csrc/fastdeploy/function/softmax.cc @@ -117,7 +117,7 @@ void Softmax(const FDTensor& x, FDTensor* out, int axis) { FDASSERT( std::abs(axis) < x.shape.size(), "The absolute given axis should be smaller than the input's " - "dimension. Expected absolute axis is smaller than %d, but receive %d.", + "dimension. Expected absolute axis is smaller than %lu, but receive %d.", x.shape.size(), std::abs(axis)); FD_VISIT_FLOAT_TYPES(x.dtype, "SoftmaxKernel", ([&] { SoftmaxKernel(x, out, axis); })); diff --git a/csrc/fastdeploy/function/transpose.cc b/csrc/fastdeploy/function/transpose.cc index 2759932078..6f276e8865 100644 --- a/csrc/fastdeploy/function/transpose.cc +++ b/csrc/fastdeploy/function/transpose.cc @@ -95,12 +95,12 @@ void Transpose(const FDTensor& x, FDTensor* out, size_t dims_size = dims.size(); FDASSERT(dims_size == x.shape.size(), "The input tensor's dimension should be equal to the dims's size. " - "Expect dims size is %d, but receive %d.", + "Expect dims size is %lu, but receive %lu.", x.shape.size(), dims_size); std::vector count(dims_size, 0); for (size_t i = 0; i < dims_size; i++) { FDASSERT(dims[i] >= 0, - "The dims should be greater than or equal to 0, but receive %d.", + "The dims should be greater than or equal to 0, but receive %lld.", dims[i]); FDASSERT(dims[i] < static_cast(dims_size) && ++count[dims[i]] == 1, "Each element of Attribute axis should be a unique value range " diff --git a/csrc/fastdeploy/pybind/main.cc b/csrc/fastdeploy/pybind/main.cc index 14ff03ef7d..77fd2c240b 100644 --- a/csrc/fastdeploy/pybind/main.cc +++ b/csrc/fastdeploy/pybind/main.cc @@ -33,8 +33,8 @@ pybind11::dtype FDDataTypeToNumpyDataType(const FDDataType& fd_dtype) { } else if (fd_dtype == FDDataType::UINT8) { dt = pybind11::dtype::of(); } else { - FDASSERT(false, "The function doesn't support data type of " + - Str(fd_dtype) + "."); + FDASSERT(false, "The function doesn't support data type of %s.", + Str(fd_dtype).c_str()); } return dt; } @@ -73,7 +73,8 @@ void PyArrayToTensor(pybind11::array& pyarray, FDTensor* tensor, pybind11::array TensorToPyArray(const FDTensor& tensor) { auto numpy_dtype = FDDataTypeToNumpyDataType(tensor.dtype); auto out = pybind11::array(numpy_dtype, tensor.shape); - memcpy(out.mutable_data(), tensor.Data(), tensor.Numel() * FDDataTypeSize(tensor.dtype)); + memcpy(out.mutable_data(), tensor.Data(), + tensor.Numel() * FDDataTypeSize(tensor.dtype)); return out; } diff --git a/csrc/fastdeploy/pybind/main.cc.in b/csrc/fastdeploy/pybind/main.cc.in index 13e0a31c4f..c070a5a697 100644 --- a/csrc/fastdeploy/pybind/main.cc.in +++ b/csrc/fastdeploy/pybind/main.cc.in @@ -33,8 +33,8 @@ pybind11::dtype FDDataTypeToNumpyDataType(const FDDataType& fd_dtype) { } else if (fd_dtype == FDDataType::UINT8) { dt = pybind11::dtype::of(); } else { - FDASSERT(false, "The function doesn't support data type of " + - Str(fd_dtype) + "."); + FDASSERT(false, "The function doesn't support data type of %s.", + Str(fd_dtype).c_str()); } return dt; } diff --git a/csrc/fastdeploy/utils/utils.h b/csrc/fastdeploy/utils/utils.h index 96f5c64cdf..2c72697634 100644 --- a/csrc/fastdeploy/utils/utils.h +++ b/csrc/fastdeploy/utils/utils.h @@ -86,14 +86,13 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file, FDLogger(true, "[INFO]") << __REL_FILE__ << "(" << __LINE__ \ << ")::" << __FUNCTION__ << "\t" -#define FDASSERT(condition, format, ...) \ - if (!(condition)) { \ - std::string format_string(format); \ - int n = std::snprintf(nullptr, 0, format_string.data(), ##__VA_ARGS__); \ - std::vector buffer(n + 1); \ - std::snprintf(buffer.data(), n + 1, format_string.data(), ##__VA_ARGS__); \ - FDERROR << buffer.data() << std::endl; \ - std::abort(); \ +#define FDASSERT(condition, format, ...) \ + if (!(condition)) { \ + int n = std::snprintf(nullptr, 0, format, ##__VA_ARGS__); \ + std::vector buffer(n + 1); \ + std::snprintf(buffer.data(), n + 1, format, ##__VA_ARGS__); \ + FDERROR << buffer.data() << std::endl; \ + std::abort(); \ } ///////// Basic Marco /////////// @@ -128,7 +127,7 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file, false, \ "Invalid enum data type. Expect to accept data type BOOL, INT32, " \ "INT64, FP32, FP64, but receive type %s.", \ - Str(__dtype__)); \ + Str(__dtype__).c_str()); \ } \ }() @@ -148,7 +147,7 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file, FDASSERT(false, \ "Invalid enum data type. Expect to accept data type INT32, " \ "INT64, FP32, FP64, but receive type %s.", \ - Str(__dtype__)); \ + Str(__dtype__).c_str()); \ } \ }() @@ -164,7 +163,7 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file, FDASSERT(false, \ "Invalid enum data type. Expect to accept data type FP32, " \ "FP64, but receive type %s.", \ - Str(__dtype__)); \ + Str(__dtype__).c_str()); \ } \ }() @@ -180,7 +179,7 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file, FDASSERT(false, \ "Invalid enum data type. Expect to accept data type INT32, " \ "INT64, but receive type %s.", \ - Str(__dtype__)); \ + Str(__dtype__).c_str()); \ } \ }() diff --git a/csrc/fastdeploy/vision/common/processors/mat.cc b/csrc/fastdeploy/vision/common/processors/mat.cc index 2afffa416e..580066229e 100644 --- a/csrc/fastdeploy/vision/common/processors/mat.cc +++ b/csrc/fastdeploy/vision/common/processors/mat.cc @@ -97,8 +97,9 @@ FDDataType Mat::Type() { } else if (type == 1) { return FDDataType::INT8; } else if (type == 2) { - FDASSERT(false, "While calling Mat::Type(), get UINT16 type which is not " - "supported now."); + FDASSERT(false, + "While calling Mat::Type(), get UINT16 type which is not " + "supported now."); } else if (type == 3) { return FDDataType::INT16; } else if (type == 4) { @@ -108,10 +109,12 @@ FDDataType Mat::Type() { } else if (type == 6) { return FDDataType::FP64; } else { - FDASSERT(false, "While calling Mat::Type(), get type = " + - std::to_string(type) + ", which is not expected!."); + FDASSERT( + false, + "While calling Mat::Type(), get type = %d, which is not expected!.", + type); } } -} // namespace vision -} // namespace fastdeploy +} // namespace vision +} // namespace fastdeploy diff --git a/csrc/fastdeploy/vision/detection/ppdet/ppyoloe.cc b/csrc/fastdeploy/vision/detection/ppdet/ppyoloe.cc index 12786a08a4..0b675ebc6a 100644 --- a/csrc/fastdeploy/vision/detection/ppdet/ppyoloe.cc +++ b/csrc/fastdeploy/vision/detection/ppdet/ppyoloe.cc @@ -99,8 +99,8 @@ bool PPYOLOE::BuildPreprocessPipelineFromConfig() { auto target_size = op["target_size"].as>(); int interp = op["interp"].as(); FDASSERT(target_size.size(), - "Require size of target_size be 2, but now it's " + - std::to_string(target_size.size()) + "."); + "Require size of target_size be 2, but now it's %lu.", + target_size.size()); if (!keep_ratio) { int width = target_size[1]; int height = target_size[0]; diff --git a/csrc/fastdeploy/vision/segmentation/ppseg/model.cc b/csrc/fastdeploy/vision/segmentation/ppseg/model.cc index 9604d665c1..95dce669ad 100644 --- a/csrc/fastdeploy/vision/segmentation/ppseg/model.cc +++ b/csrc/fastdeploy/vision/segmentation/ppseg/model.cc @@ -127,8 +127,8 @@ bool PaddleSegModel::Postprocess( // 3. shape: 2-D HW FDASSERT(infer_result.dtype == FDDataType::INT64 || infer_result.dtype == FDDataType::FP32, - "Require the data type of output is int64 or fp32, but now it's " + - Str(infer_result.dtype) + "."); + "Require the data type of output is int64 or fp32, but now it's %s.", + Str(infer_result.dtype).c_str()); result->Clear(); if (infer_result.shape.size() == 4) { diff --git a/docs/compile/prebuilt_libraries.md b/docs/compile/prebuilt_libraries.md index 905eb6d529..451b4fd092 100644 --- a/docs/compile/prebuilt_libraries.md +++ b/docs/compile/prebuilt_libraries.md @@ -14,15 +14,15 @@ FastDeploy提供了在Windows/Linux/Mac上的预先编译CPP部署库,开发 | 部署库下载地址 | 硬件 | 说明 | | :------------- | :--- | :--- | -| [fastdeploy-linux-x64-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-linux-x64-0.2.0.tgz) | CPU | g++ 8.2编译产出 | -| [fastdeploy-linux-x64-gpu-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-linux-x64-gpu-0.2.0.tgz) | CPU/GPU | g++ 8.2, cuda 11.2, cudnn 8.2编译产出 | +| [fastdeploy-linux-x64-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-linux-x64-0.2.0.tgz) | CPU | g++ 8.2编译产出 | +| [fastdeploy-linux-x64-gpu-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-linux-x64-gpu-0.2.0.tgz) | CPU/GPU | g++ 8.2, cuda 11.2, cudnn 8.2编译产出 | ### Windows 10 x64平台 | 部署库下载地址 | 硬件 | 说明 | | :------------- | :--- | :--- | -| [fastdeploy-win-x64-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-0.2.0.zip) | CPU | Visual Studio 16 2019 编译产出 | -| [fastdeploy-win-x64-gpu-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-gpu-0.2.0.zip) | CPU/GPU | Visual Studio 16 2019,cuda 11.2, cudnn 8.2编译产出 | +| [fastdeploy-win-x64-0.2.0.zip](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-0.2.0.zip) | CPU | Visual Studio 16 2019 编译产出 | +| [fastdeploy-win-x64-gpu-0.2.0.zip](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-gpu-0.2.0.zip) | CPU/GPU | Visual Studio 16 2019,cuda 11.2, cudnn 8.2编译产出 | ### Linux aarch64平台 @@ -35,8 +35,8 @@ FastDeploy提供了在Windows/Linux/Mac上的预先编译CPP部署库,开发 | 部署库下载地址 | 架构 |硬件 | | :---- | :-- | :------ | -| [comming...] | x86 | CPU | -| [comming...] | arm64 | CPU | +| [fastdeploy-osx-x86_64-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-osx-x86_64-0.2.0.tgz) | x86 | CPU | +| [fastdeploy-osx-arm64-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-osx-arm64-0.2.0.tgz) | arm64 | CPU | ## 其它文档 diff --git a/docs/compile/prebuilt_wheels.md b/docs/compile/prebuilt_wheels.md index e3ada892e1..3ccae79b3b 100644 --- a/docs/compile/prebuilt_wheels.md +++ b/docs/compile/prebuilt_wheels.md @@ -50,16 +50,21 @@ python -m pip install fastdeploy_python-0.2.0-cp38-cp38-manylinux1_x86_64.whl | 安装包 | 硬件 | Python版本 | | :---- | :-- | :------ | -| [comming...] | CPU | 3.7 | -| [comming...] | CPU | 3.8 | -| [comming...] | CPU | 3.9 | +| [fastdeploy_python-0.2.0-cp36-cp36m-manylinux_2_17_aarch64.whl](https://bj.bcebos.com/paddle2onnx/libs/wheels/fastdeploy_python-0.2.0-cp36-cp36m-manylinux_2_17_aarch64.whl) | CPU | 3.6 | +| [fastdeploy_python-0.2.0-cp37-cp37m-manylinux_2_17_aarch64.whl](https://bj.bcebos.com/paddle2onnx/libs/wheels/fastdeploy_python-0.2.0-cp37-cp37m-manylinux_2_17_aarch64.whl) | CPU | 3.7 | +| [fastdeploy_python-0.2.0-cp38-cp38-manylinux_2_17_aarch64.whl](https://bj.bcebos.com/paddle2onnx/libs/wheels/fastdeploy_python-0.2.0-cp38-cp38-manylinux_2_17_aarch64.whl) | CPU | 3.8 | +| [fastdeploy_python-0.2.0-cp39-cp39-manylinux_2_17_aarch64.whl](https://bj.bcebos.com/paddle2onnx/libs/wheels/fastdeploy_python-0.2.0-cp39-cp39-manylinux_2_17_aarch64.whl) | CPU | 3.9 | ### Mac OSX平台 | 架构 | 硬件 | 安装包 | Python版本 | | :---- | :-- | :------ | :----- | -| x86_64 | CPU | [comming...] | 3.9 | -| arm64 | CPU | [comming...] | 3.9 | +| x86_64 | CPU | [fastdeploy_python-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl) | 3.6 | +| x86_64 | CPU | [fastdeploy_python-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl) | 3.7 | +| x86_64 | CPU | [fastdeploy_python-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl) | 3.8 | +| x86_64 | CPU | [fastdeploy_python-0.2.0-cp39-cp39-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp39-cp39-macosx_10_14_x86_64.whl) | 3.9 | +| arm64 | CPU | [fastdeploy_python-0.2.0-cp38-cp38-macosx_11_0_arm64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp38-cp38-macosx_11_0_arm64.whl) | 3.8 | +| arm64 | CPU | [fastdeploy_python-0.2.0-cp39-cp39-macosx_11_0_arm64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp39-cp39-macosx_11_0_arm64.whl) | 3.9 | ## 其它文档 diff --git a/examples/vision/detection/scaledyolov4/README.md b/examples/vision/detection/scaledyolov4/README.md index e4bf41a7a8..d54e04d4cf 100644 --- a/examples/vision/detection/scaledyolov4/README.md +++ b/examples/vision/detection/scaledyolov4/README.md @@ -25,11 +25,16 @@ 为了方便开发者的测试,下面提供了ScaledYOLOv4导出的各系列模型,开发者可直接下载使用。(下表中模型的精度来源于源官方库) | 模型 | 大小 | 精度 | |:---------------------------------------------------------------- |:----- |:----- | -| [ScaledYOLOv4-P5](https://bj.bcebos.com/paddlehub/fastdeploy/yolov4-p5.onnx) | 271MB | 51.2% | -| [ScaledYOLOv4-P5+BoF](https://bj.bcebos.com/paddlehub/fastdeploy/yolov4-p5_.onnx) | 271MB | 51.7% | -| [ScaledYOLOv4-P6](https://bj.bcebos.com/paddlehub/fastdeploy/yolov4-p6.onnx) | 487MB | 53.9% | -| [ScaledYOLOv4-P6+BoF](https://bj.bcebos.com/paddlehub/fastdeploy/yolov4-p6_.onnx) | 487MB | 54.4% | -| [ScaledYOLOv4-P7](https://bj.bcebos.com/paddlehub/fastdeploy/yolov4-p7.onnx) | 1.1GB | 55.0% | +| [ScaledYOLOv4-P5-896](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p5-896.onnx) | 271MB | 51.2% | +| [ScaledYOLOv4-P5+BoF-896](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p5_-896.onnx) | 271MB | 51.7% | +| [ScaledYOLOv4-P6-1280](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p6-1280.onnx) | 487MB | 53.9% | +| [ScaledYOLOv4-P6+BoF-1280](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p6_-1280.onnx) | 487MB | 54.4% | +| [ScaledYOLOv4-P7-1536](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p7-1536.onnx) | 1.1GB | 55.0% | +| [ScaledYOLOv4-P5](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p5.onnx) | 271MB | - | +| [ScaledYOLOv4-P5+BoF](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p5_.onnx) | 271MB | -| +| [ScaledYOLOv4-P6](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p6.onnx) | 487MB | - | +| [ScaledYOLOv4-P6+BoF](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p6_.onnx) | 487MB | - | +| [ScaledYOLOv4-P7](https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p7.onnx) | 1.1GB | - | diff --git a/external/paddle_inference.cmake b/external/paddle_inference.cmake index 0cc395496e..f466518052 100644 --- a/external/paddle_inference.cmake +++ b/external/paddle_inference.cmake @@ -38,8 +38,6 @@ elseif(APPLE) set(PADDLEINFERENCE_COMPILE_LIB "${PADDLEINFERENCE_INSTALL_DIR}/paddle/lib/libpaddle_inference.dylib" CACHE FILEPATH "paddle_inference compile library." FORCE) - set(DNNL_LIB "") - set(OMP_LIB "") else() set(PADDLEINFERENCE_COMPILE_LIB "${PADDLEINFERENCE_INSTALL_DIR}/paddle/lib/libpaddle_inference.so" @@ -57,8 +55,8 @@ if(WIN32) set(PADDLEINFERENCE_FILE "paddle_inference-win-x64-${PADDLEINFERENCE_VERSION}.zip") endif() elseif(APPLE) - message(FATAL_ERROR "Paddle Backend doesn't support Mac OSX now.") if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") + message(FATAL_ERROR "Paddle Backend doesn't support Mac OSX with Arm64 now.") set(PADDLEINFERENCE_FILE "paddle_inference-osx-arm64-${PADDLEINFERENCE_VERSION}.tgz") else() set(PADDLEINFERENCE_FILE "paddle_inference-osx-x86_64-${PADDLEINFERENCE_VERSION}.tgz") @@ -94,12 +92,16 @@ set_property(TARGET external_paddle_inference PROPERTY IMPORTED_LOCATION ${PADDLEINFERENCE_COMPILE_LIB}) add_dependencies(external_paddle_inference ${PADDLEINFERENCE_PROJECT}) -add_library(external_dnnl STATIC IMPORTED GLOBAL) -set_property(TARGET external_dnnl PROPERTY IMPORTED_LOCATION - ${DNNL_LIB}) -add_dependencies(external_dnnl ${PADDLEINFERENCE_PROJECT}) +if (NOT APPLE) + # no third parties libs(mkldnn and omp) need to + # link into paddle_inference on MacOS OSX. + add_library(external_dnnl STATIC IMPORTED GLOBAL) + set_property(TARGET external_dnnl PROPERTY IMPORTED_LOCATION + ${DNNL_LIB}) + add_dependencies(external_dnnl ${PADDLEINFERENCE_PROJECT}) -add_library(external_omp STATIC IMPORTED GLOBAL) -set_property(TARGET external_omp PROPERTY IMPORTED_LOCATION - ${OMP_LIB}) -add_dependencies(external_omp ${PADDLEINFERENCE_PROJECT}) + add_library(external_omp STATIC IMPORTED GLOBAL) + set_property(TARGET external_omp PROPERTY IMPORTED_LOCATION + ${OMP_LIB}) + add_dependencies(external_omp ${PADDLEINFERENCE_PROJECT}) +endif() \ No newline at end of file diff --git a/setup.py b/setup.py index 1eeff3d1ad..4d5cd70911 100644 --- a/setup.py +++ b/setup.py @@ -463,12 +463,13 @@ def run(self): for f in all_files: # remove un-need ocv samples files to avoid too long file path # in windows which can make building process failed. - if f.find(".vcxproj.") > 0: - continue - if f.find("opencv") > 0 and (f.find("samples") > 0 or - f.find("java") > 0 or - f.find(".png") > 0 or f.find(".jpg")): - continue + if platform.system().lower() == "windows": + if f.find(".vcxproj.") > 0: + continue + if f.find("opencv") > 0 and any( + (f.find("samples") > 0, f.find("java") > 0, f.find(".png") > 0, + f.find(".jpg") > 0)): + continue package_data[PACKAGE_NAME].append(os.path.relpath(f, PACKAGE_NAME)) setuptools.setup( diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1a1d35fb4e..96674ed7ad 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,9 +25,11 @@ function(cc_test_build TARGET_NAME) target_link_libraries(${TARGET_NAME} PUBLIC ${PYTHON_LIBRARIES}) endif() set(EXTERNAL_LIB "") - else(WIN32) + elseif(APPLE) + set(EXTERNAL_LIB "-ldl -lpthread") + else() set(EXTERNAL_LIB "-lrt -ldl -lpthread") - endif(WIN32) + endif() get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES) target_link_libraries(${TARGET_NAME} PUBLIC ${cc_test_DEPS} ${os_dependency_modules} fastdeploy_gtest_main gtest glog ${EXTERNAL_LIB}) add_dependencies(${TARGET_NAME} ${cc_test_DEPS} gtest)