Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e8efaecb
Unverified
Commit
e8efaecb
authored
Mar 04, 2022
by
NielsRogge
Committed by
GitHub
Mar 04, 2022
Browse files
Move dependency to call method (#15941)
parent
5c6f57ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
src/transformers/models/layoutlmv2/feature_extraction_layoutlmv2.py
...ormers/models/layoutlmv2/feature_extraction_layoutlmv2.py
+1
-2
No files found.
src/transformers/models/layoutlmv2/feature_extraction_layoutlmv2.py
View file @
e8efaecb
...
@@ -120,8 +120,6 @@ class LayoutLMv2FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
...
@@ -120,8 +120,6 @@ class LayoutLMv2FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
self
.
resample
=
resample
self
.
resample
=
resample
self
.
apply_ocr
=
apply_ocr
self
.
apply_ocr
=
apply_ocr
self
.
ocr_lang
=
ocr_lang
self
.
ocr_lang
=
ocr_lang
if
apply_ocr
:
requires_backends
(
self
,
"pytesseract"
)
def
__call__
(
def
__call__
(
self
,
images
:
ImageInput
,
return_tensors
:
Optional
[
Union
[
str
,
TensorType
]]
=
None
,
**
kwargs
self
,
images
:
ImageInput
,
return_tensors
:
Optional
[
Union
[
str
,
TensorType
]]
=
None
,
**
kwargs
...
@@ -200,6 +198,7 @@ class LayoutLMv2FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
...
@@ -200,6 +198,7 @@ class LayoutLMv2FeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionM
# Tesseract OCR to get words + normalized bounding boxes
# Tesseract OCR to get words + normalized bounding boxes
if
self
.
apply_ocr
:
if
self
.
apply_ocr
:
requires_backends
(
self
,
"pytesseract"
)
words_batch
=
[]
words_batch
=
[]
boxes_batch
=
[]
boxes_batch
=
[]
for
image
in
images
:
for
image
in
images
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment