Skip to content

Derive the model names from directory names if provided #15708

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timminator
Copy link
Contributor

PaddleOCR 3.0.0/3.0.1 requires specifying the name in addition to the model directory which is not really necessary because they can be derived from the directory name. This improves the user experience by making it easier to use.

If this gets approved, I would appreciate it to be also cherry-picked for the 3.0.2 release.

Fixes #15707

Copy link

paddle-bot bot commented Jun 12, 2025

Thanks for your contribution!

@timminator timminator force-pushed the enhance-model-name-handling branch from 3d73f35 to dc38ef6 Compare June 12, 2025 20:34
@timminator timminator force-pushed the enhance-model-name-handling branch from dc38ef6 to e86450a Compare June 12, 2025 20:36
Comment on lines +123 to +125
text_recognition_model_name = os.path.basename(
text_recognition_model_dir
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the code style check/linter requires this ugly line break, so there is nothing I can do about it. :-/

@Bobholamovic
Copy link
Member

Bobholamovic commented Jun 13, 2025

Although the model directory name and the model name may be the same in some cases, they essentially refer to different things. Therefore, I don't think it's appropriate to use either the model directory name as the model name. Nevertheless, thank you for your contribution! If you have other ideas, feel free to share them with us.

@timminator
Copy link
Contributor Author

But I checked the official models in PaddleX beforehand - when im not mistaken the model name and directory name matched in every instance.
Unless the user renames the folder, I cannot see how this could cause any issues. But even in that case it would result in the same error we are currently seeing in anyway, so it is not a regression and only makes it simpler most of the time.

@Bobholamovic
Copy link
Member

But I checked the official models in PaddleX beforehand - when im not mistaken the model name and directory name matched in every instance. Unless the user renames the folder, I cannot see how this could cause any issues. But even in that case it would result in the same error we are currently seeing in anyway, so it is not a regression and only makes it simpler most of the time.

Yes, for official PaddleX models, the model name usually matches the directory name. However, users are free to rename the directory, so we can’t guarantee consistency there. To be more accurate, I recommend checking the model_name field in the inference.yml file inside the model directory. That’s the most reliable source. Feel free to contribute your code or open a feature request in the PaddleX GitHub repo!

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

Successfully merging this pull request may close these issues.

[Regression] PaddleOCR 3.0.0/3.0.1 requires specifying the model directory and name
2 participants