-
Notifications
You must be signed in to change notification settings - Fork 8.2k
update inference scripts #15043
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
base: main
Are you sure you want to change the base?
update inference scripts #15043
Conversation
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates multiple inference scripts to incorporate TensorRT conversion logic and YAML configuration support while revising file selection for model loading across Python and C++ modules. Key changes include:
- Adding YAML-based configuration loading and TensorRT conversion in utility.py.
- Adjustments in prediction and model loading logic in predict_rec.py and ocr_rec.cpp.
- Updating the C++ header to incorporate YAML and improve label file handling.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tools/infer/utility.py | Added YAML import, TensorRT conversion helper functions, and config update logic. |
tools/infer/predict_rec.py | Revised TextRecognizer initialization to load and process YAML config. |
deploy/cpp_infer/src/ocr_rec.cpp | Changed model file selection logic to prefer inference.json if available. |
deploy/cpp_infer/include/ocr_rec.h | Updated header includes and modified label file reading with YAML config. |
Files not reviewed (1)
- deploy/cpp_infer/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)
tools/infer/utility.py:293
- The variable 'file_name' is used here but not defined in this scope; consider using a defined identifier or passing it as a parameter.
trt_save_path = f"{model_dir}/.cache/trt/{file_name}"
deploy/cpp_infer/include/ocr_rec.h
Outdated
this->label_list_ = Utility::ReadDict(label_path); | ||
std::string new_label_path = label_path; | ||
std::string yaml_file_path = model_dir + "/inference.yml"; | ||
std::ifstream yaml_file(label_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears the YAML file is intended to be loaded using 'yaml_file_path' (constructed as model_dir + "/inference.yml") rather than 'label_path'; switching to 'yaml_file(yaml_file_path)' should correctly open the intended config file.
std::ifstream yaml_file(label_path); | |
std::ifstream yaml_file(yaml_file_path); |
Copilot uses AI. Check for mistakes.
4668c81
to
be61c7c
Compare
No description provided.