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
ce87dca1
Unverified
Commit
ce87dca1
authored
May 13, 2024
by
NielsRogge
Committed by
GitHub
May 13, 2024
Browse files
[Object detection pipeline] Lower threshold (#30710)
* Lower threshold * Address comment
parent
69d9bca5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/pipelines/object_detection.py
src/transformers/pipelines/object_detection.py
+2
-2
No files found.
src/transformers/pipelines/object_detection.py
View file @
ce87dca1
...
@@ -83,7 +83,7 @@ class ObjectDetectionPipeline(Pipeline):
...
@@ -83,7 +83,7 @@ class ObjectDetectionPipeline(Pipeline):
The pipeline accepts either a single image or a batch of images. Images in a batch must all be in the
The pipeline accepts either a single image or a batch of images. Images in a batch must all be in the
same format: all as HTTP(S) links, all as local paths, or all as PIL images.
same format: all as HTTP(S) links, all as local paths, or all as PIL images.
threshold (`float`, *optional*, defaults to 0.
9
):
threshold (`float`, *optional*, defaults to 0.
5
):
The probability necessary to make a prediction.
The probability necessary to make a prediction.
timeout (`float`, *optional*, defaults to None):
timeout (`float`, *optional*, defaults to None):
The maximum time in seconds to wait for fetching images from the web. If None, no timeout is set and
The maximum time in seconds to wait for fetching images from the web. If None, no timeout is set and
...
@@ -120,7 +120,7 @@ class ObjectDetectionPipeline(Pipeline):
...
@@ -120,7 +120,7 @@ class ObjectDetectionPipeline(Pipeline):
model_outputs
[
"bbox"
]
=
model_inputs
[
"bbox"
]
model_outputs
[
"bbox"
]
=
model_inputs
[
"bbox"
]
return
model_outputs
return
model_outputs
def
postprocess
(
self
,
model_outputs
,
threshold
=
0.
9
):
def
postprocess
(
self
,
model_outputs
,
threshold
=
0.
5
):
target_size
=
model_outputs
[
"target_size"
]
target_size
=
model_outputs
[
"target_size"
]
if
self
.
tokenizer
is
not
None
:
if
self
.
tokenizer
is
not
None
:
# This is a LayoutLMForTokenClassification variant.
# This is a LayoutLMForTokenClassification variant.
...
...
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