fix: 修复OCR参数错误

This commit is contained in:
MistEO
2022-12-08 21:24:59 +08:00
parent ed4e6bcf6a
commit 9a78bfd9cb
2 changed files with 4 additions and 17 deletions

View File

@@ -27,17 +27,13 @@ static std::filesystem::path prepare_paddle_dir(const std::filesystem::path& dir
#endif
asst::OcrPack::OcrPack()
: m_ocr_option(std::make_unique<fastdeploy::RuntimeOption>()), m_det(nullptr), m_rec(nullptr), m_ocr(nullptr),
m_backend(OcrBackend::ONNXRuntime)
{}
: m_ocr_option(std::make_unique<fastdeploy::RuntimeOption>()), m_det(nullptr), m_rec(nullptr), m_ocr(nullptr)
{
m_ocr_option->UseOrtBackend();
}
asst::OcrPack::~OcrPack() {}
void asst::OcrPack::set_backend_before_load(OcrBackend backend)
{
m_backend = backend;
}
bool asst::OcrPack::load(const std::filesystem::path& path)
{
bool use_temp_dir = false;

View File

@@ -30,16 +30,9 @@ namespace asst
{
class OcrPack : public AbstractResource
{
public:
enum class OcrBackend
{
ONNXRuntime,
};
public:
virtual ~OcrPack() override;
void set_backend_before_load(OcrBackend backend);
virtual bool load(const std::filesystem::path& path) override;
std::vector<TextRect> recognize(const cv::Mat& image, const TextRectProc& pred = nullptr,
@@ -54,8 +47,6 @@ namespace asst
std::unique_ptr<fastdeploy::vision::ocr::DBDetector> m_det;
std::unique_ptr<fastdeploy::vision::ocr::Recognizer> m_rec;
std::unique_ptr<fastdeploy::pipeline::PPOCRv3> m_ocr;
OcrBackend m_backend;
};
class WordOcr final : public SingletonHolder<WordOcr>, public OcrPack