transformers
transformers copied to clipboard
Added option for users to modify config parameter when calling pytess…
What does this PR do?
This is a feature addition to LayoutLMV3, a follow up to the same feature added to LayoutLMV2's feature extractor
Giving user option to set config parameter used by Tesseract when performing feature extraction. Eg. to change psm levels while performing transcription by passing in '--psm 10' to config parameter while invoking image_to_data
It is shown that changing the psm values greatly influences the end result of LayoutLMV2/XLM/LMV3, and the specific psm value is different depending on the document formatting. Refer : PSM
pytesseract.image_to_data(image, lang=lang, output_type="dict", config="--psm 10")
Users can now set the tesseract config parameter during Processor initialization, like so:
processor = AutoProcessor.from_pretrained("microsoft/layoutlmv3-base", ocr_lang="eng", tesseract_config="--psm 5")
Before submitting
- [❌] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [✔️] Did you read the contributor guideline, Pull Request section?
- [✔️] Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
- [✔️] Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
- [❌] Did you write any new necessary tests?
The documentation is not available anymore as the PR was closed or merged.
@NielsRogge Added & tested LayoutLMV3 feature extractor
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Hmm @kelvinAI for some reason I'm seeing "files changed = 0", did something go wrong here?
Hey @NielsRogge , the changes for this branch have already been merged into this pr as discussed earlier. And since that PR have already been merged with main earlier that's probably why it's showing 0 files changed over here. Looking at the autogenerated documentation for main it seems that the changes for both LayoutLMv2 and LayoutLMv3 are already included :). Could you please help to verify?
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Yes, so seems like you can close this PR.
Right, forgot to close this :)