[LayoutLM] Add clarification to docs (#18716)
* Add clarification * Add another clarification * Apply suggestion Co-authored-by: Niels Rogge <nielsrogge@Nielss-MacBook-Pro.local>
This commit is contained in:
@@ -67,7 +67,8 @@ occurs. Those can be obtained using the Python Image Library (PIL) library for e
|
||||
```python
|
||||
from PIL import Image
|
||||
|
||||
image = Image.open("name_of_your_document - can be a png file, pdf, etc.")
|
||||
# Document can be a png, jpg, etc. PDFs must be converted to images.
|
||||
image = Image.open(name_of_your_document).convert("RGB")
|
||||
|
||||
width, height = image.size
|
||||
```
|
||||
|
||||
@@ -168,7 +168,8 @@ class LayoutLMv2FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
|
||||
>>> from transformers import LayoutLMv2FeatureExtractor
|
||||
>>> from PIL import Image
|
||||
|
||||
>>> image = Image.open("name_of_your_document - can be a png file, pdf, etc.").convert("RGB")
|
||||
>>> # Document can be a png, jpg, etc. PDFs must be converted to images.
|
||||
>>> image = Image.open(name_of_your_document).convert("RGB")
|
||||
|
||||
>>> # option 1: with apply_ocr=True (default)
|
||||
>>> feature_extractor = LayoutLMv2FeatureExtractor()
|
||||
|
||||
@@ -179,7 +179,8 @@ class LayoutLMv3FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
|
||||
>>> from transformers import LayoutLMv3FeatureExtractor
|
||||
>>> from PIL import Image
|
||||
|
||||
>>> image = Image.open("name_of_your_document - can be a png file, pdf, etc.").convert("RGB")
|
||||
>>> # Document can be a png, jpg, etc. PDFs must be converted to images.
|
||||
>>> image = Image.open(name_of_your_document).convert("RGB")
|
||||
|
||||
>>> # option 1: with apply_ocr=True (default)
|
||||
>>> feature_extractor = LayoutLMv3FeatureExtractor()
|
||||
|
||||
Reference in New Issue
Block a user