Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vision::OCRResult missing necessary fields table_boxes and table_structure #2429

Open
bingoabs opened this issue Apr 10, 2024 · 1 comment
Open
Assignees

Comments

@bingoabs
Copy link

Environment

FastDeploy version: 1.0.7
OS Platform: Windows x64 intel
Hardware: Nvidia GPU 3080Ti CUDA 11.2 CUDNN 8.3
Program Language: . Python 3.10

Problem description

The vision::OCRResult actually include table_boxes and table_structure fields, but the pybing11 part doesn't include them. We can find the both fields in the first code snippet below, but not in the second one.

// FastDeploy\fastdeploy\vision\common\result.h
struct FASTDEPLOY_DECL OCRResult : public BaseResult {
  std::vector<std::array<int, 8>> boxes;

  std::vector<std::string> text;
  std::vector<float> rec_scores;

  std::vector<float> cls_scores;
  std::vector<int32_t> cls_labels;

  std::vector<std::array<int, 8>> table_boxes;
  std::vector<std::string> table_structure;
  std::string table_html;

  ResultType type = ResultType::OCR;

  void Clear();

  std::string Str();
};
  pybind11::class_<vision::OCRResult>(m, "OCRResult")
      .def(pybind11::init())
      .def_readwrite("boxes", &vision::OCRResult::boxes)
      .def_readwrite("text", &vision::OCRResult::text)
      .def_readwrite("rec_scores", &vision::OCRResult::rec_scores)
      .def_readwrite("cls_scores", &vision::OCRResult::cls_scores)
      .def_readwrite("cls_labels", &vision::OCRResult::cls_labels)
      .def("__repr__", &vision::OCRResult::Str)
      .def("__str__", &vision::OCRResult::Str);

Solution

  • The directly way to solve it is to add the two fields to pybind11 part. Or we can derive a TableOCRResult class. Thanks.
@juncaipeng
Copy link
Collaborator

Thank you for raising this issue. We will consider fixing it in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants