Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
# =========================================================================
# 1. macOS ARM64 (Apple Silicon: CoreML & CPU)
# 1. macOS ARM64 (Apple Silicon: CPU)
# =========================================================================
build-macos-arm64:
name: macOS (arm64)
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
path: fastdeploy_ppocr-linux-x64.tar.gz

# =========================================================================
# 3. Windows x64 (DirectML & CPU)
# 3. Windows x64 (CPU)
# =========================================================================
build-windows-x64:
name: Windows (x64)
Expand Down
8 changes: 4 additions & 4 deletions bindings/c_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ if(NOT WITH_CAPI)
return()
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fastdeploy_capi/core/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/fastdeploy_capi/core/config.h)
file(GLOB_RECURSE DEPLOY_CAPI_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/fastdeploy_capi/*.cc)
configure_file(${CMAKE_CURRENT_LIST_DIR}/fastdeploy_capi/core/config.h.in ${CMAKE_CURRENT_LIST_DIR}/fastdeploy_capi/core/config.h)
file(GLOB_RECURSE DEPLOY_CAPI_SRCS ${CMAKE_CURRENT_LIST_DIR}/fastdeploy_capi/*.cc)
if(NOT ENABLE_VISION)
file(GLOB_RECURSE DEPLOY_VISION_CAPI_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/fastdeploy_capi/vision/*.cc)
file(GLOB_RECURSE DEPLOY_VISION_CAPI_SRCS ${CMAKE_CURRENT_LIST_DIR}/fastdeploy_capi/vision/*.cc)
list(REMOVE_ITEM DEPLOY_CAPI_SRCS ${DEPLOY_VISION_CAPI_SRCS})
endif()
list(APPEND ALL_DEPLOY_SRCS ${DEPLOY_CAPI_SRCS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_LIST_DIR})
12 changes: 0 additions & 12 deletions bindings/c_api/fastdeploy_capi/vision/types_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ DEFINE_PIPELINE_MODEL_WRAPPER_STRUCT(PPOCRv3, ppocrv3_model);
// PPOCRv4
DEFINE_PIPELINE_MODEL_WRAPPER_STRUCT(PPOCRv4, ppocrv4_model);

// PPOCRv5
DEFINE_PIPELINE_MODEL_WRAPPER_STRUCT(PPOCRv5, ppocrv5_model);

// PPOCRv6
DEFINE_PIPELINE_MODEL_WRAPPER_STRUCT(PPOCRv6, ppocrv6_model);

// PPStructureV2Table
DEFINE_PIPELINE_MODEL_WRAPPER_STRUCT(PPStructureV2Table, ppstructurev2table_model);

Expand Down Expand Up @@ -413,12 +407,6 @@ DECLARE_PIPELINE_MODEL_FUNC_FOR_GET_PTR_FROM_WRAPPER(PPOCRv3, fd_ppocrv3_wrapper
// PPOCRv4
DECLARE_PIPELINE_MODEL_FUNC_FOR_GET_PTR_FROM_WRAPPER(PPOCRv4, fd_ppocrv4_wrapper);

// PPOCRv5
DECLARE_PIPELINE_MODEL_FUNC_FOR_GET_PTR_FROM_WRAPPER(PPOCRv5, fd_ppocrv5_wrapper);

// PPOCRv6
DECLARE_PIPELINE_MODEL_FUNC_FOR_GET_PTR_FROM_WRAPPER(PPOCRv6, fd_ppocrv6_wrapper);

// PPStructureV2Table
DECLARE_PIPELINE_MODEL_FUNC_FOR_GET_PTR_FROM_WRAPPER(PPStructureV2Table, fd_ppstructurev2_table_wrapper);

Expand Down
20 changes: 0 additions & 20 deletions bindings/python/fastdeploy/vision/ocr/ppocr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,16 +937,6 @@ def rec_batch_size(self, value):
self.system_.rec_batch_size = value


class PPOCRSystemv6(PPOCRv6):
def __init__(self, det_model=None, cls_model=None, rec_model=None):
logging.warning(
"DEPRECATED: fd.vision.ocr.PPOCRSystemv6 is deprecated, "
"please use fd.vision.ocr.PPOCRv6 instead.")
super(PPOCRSystemv6, self).__init__(det_model, cls_model, rec_model)

def predict(self, input_image):
return super(PPOCRSystemv6, self).predict(input_image)


class PPOCRv5(FastDeployModel):
def __init__(self, det_model=None, cls_model=None, rec_model=None):
Expand Down Expand Up @@ -1013,16 +1003,6 @@ def rec_batch_size(self, value):
self.system_.rec_batch_size = value


class PPOCRSystemv5(PPOCRv5):
def __init__(self, det_model=None, cls_model=None, rec_model=None):
logging.warning(
"DEPRECATED: fd.vision.ocr.PPOCRSystemv5 is deprecated, "
"please use fd.vision.ocr.PPOCRv5 instead.")
super(PPOCRSystemv5, self).__init__(det_model, cls_model, rec_model)

def predict(self, input_image):
return super(PPOCRSystemv5, self).predict(input_image)


class PPOCRv4(FastDeployModel):
def __init__(self, det_model=None, cls_model=None, rec_model=None):
Expand Down
38 changes: 0 additions & 38 deletions cmake/config_cpack.cmake

This file was deleted.

129 changes: 0 additions & 129 deletions cmake/onnxruntime.cmake

This file was deleted.

7 changes: 7 additions & 0 deletions fastdeploy/runtime/backends/ort/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ struct OrtBackendOption {
ort_disabled_ops_.insert(ort_disabled_ops_.end(), ops.begin(), ops.end());
}

/** \brief Callback to configure raw OrtSessionOptions directly.
* \note Complete Takeover Semantics: If this callback is provided, OrtBackend::BuildOption
* invokes it and returns immediately. All standard configurations in OrtBackendOption
* (e.g., intra/inter op threads, graph optimization level, execution providers like
* DirectML/CoreML/CUDA) will be completely bypassed. The caller is responsible for
* fully configuring the session_options.
*/
bool (*configure_session_callback)(OrtSessionOptions* session_options, void* user_data) = nullptr;
void* configure_session_callback_data = nullptr;
};
Expand Down
40 changes: 40 additions & 0 deletions fastdeploy/vision/ocr/ppocr/ppocr_v5.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "fastdeploy/vision/ocr/ppocr/ppocr_v5.h"

namespace fastdeploy {
namespace pipeline {

PPOCRv5::PPOCRv5(fastdeploy::vision::ocr::DBDetector* det_model,
fastdeploy::vision::ocr::Classifier* cls_model,
fastdeploy::vision::ocr::Recognizer* rec_model)
: PPOCRv4(det_model, cls_model, rec_model) {}

PPOCRv5::PPOCRv5(fastdeploy::vision::ocr::DBDetector* det_model,
fastdeploy::vision::ocr::Recognizer* rec_model)
: PPOCRv4(det_model, rec_model) {}
Comment thread
Aliothmoon marked this conversation as resolved.

std::unique_ptr<PPOCRv5> PPOCRv5::Clone() const {
std::unique_ptr<PPOCRv5> clone_model = utils::make_unique<PPOCRv5>(PPOCRv5(*this));
clone_model->detector_ = detector_->Clone().release();
if (classifier_ != nullptr) {
clone_model->classifier_ = classifier_->Clone().release();
}
clone_model->recognizer_ = recognizer_->Clone().release();
return clone_model;
}

} // namespace pipeline
} // namespace fastdeploy
43 changes: 4 additions & 39 deletions fastdeploy/vision/ocr/ppocr/ppocr_v5.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,23 @@ class FASTDEPLOY_DECL PPOCRv5 : public PPOCRv4 {
*/
PPOCRv5(fastdeploy::vision::ocr::DBDetector* det_model,
fastdeploy::vision::ocr::Classifier* cls_model,
fastdeploy::vision::ocr::Recognizer* rec_model)
: PPOCRv4(det_model, cls_model, rec_model) {
auto preprocess_shape = recognizer_->GetPreprocessor().GetRecImageShape();
preprocess_shape[1] = 48;
recognizer_->GetPreprocessor().SetRecImageShape(preprocess_shape);
if (detector_ != nullptr) {
detector_->GetPostprocessor().SetDetDBThresh(0.3);
detector_->GetPostprocessor().SetDetDBBoxThresh(0.6);
detector_->GetPostprocessor().SetDetDBUnclipRatio(1.5);
detector_->GetPostprocessor().SetDetDBMaxCandidates(1000);
}
}
fastdeploy::vision::ocr::Recognizer* rec_model);
/** \brief Classification model is optional, so this function is set up the detection model path and recognition model path respectively.
*
* \param[in] det_model Path of detection model, e.g ./ch_PP-OCRv5_det_infer
* \param[in] rec_model Path of recognition model, e.g ./ch_PP-OCRv5_rec_infer
*/
PPOCRv5(fastdeploy::vision::ocr::DBDetector* det_model,
fastdeploy::vision::ocr::Recognizer* rec_model)
: PPOCRv4(det_model, rec_model) {
auto preprocess_shape = recognizer_->GetPreprocessor().GetRecImageShape();
preprocess_shape[1] = 48;
recognizer_->GetPreprocessor().SetRecImageShape(preprocess_shape);
if (detector_ != nullptr) {
detector_->GetPostprocessor().SetDetDBThresh(0.3);
detector_->GetPostprocessor().SetDetDBBoxThresh(0.6);
detector_->GetPostprocessor().SetDetDBUnclipRatio(1.5);
detector_->GetPostprocessor().SetDetDBMaxCandidates(1000);
}
}
fastdeploy::vision::ocr::Recognizer* rec_model);

/** \brief Clone a new PPOCRv5 with less memory usage when multiple instances of the same model are created
*
* \return new PPOCRv5* type unique pointer
*/
std::unique_ptr<PPOCRv5> Clone() const {
std::unique_ptr<PPOCRv5> clone_model = utils::make_unique<PPOCRv5>(PPOCRv5(*this));
clone_model->detector_ = detector_->Clone().release();
if (classifier_ != nullptr) {
clone_model->classifier_ = classifier_->Clone().release();
}
clone_model->recognizer_ = recognizer_->Clone().release();
return clone_model;
}
std::unique_ptr<PPOCRv5> Clone() const;
};

} // namespace pipeline

namespace application {
namespace ocrsystem {
typedef pipeline::PPOCRv5 PPOCRSystemv5;
} // namespace ocrsystem
} // namespace application

} // namespace fastdeploy

Loading