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
65d7b21b
Unverified
Commit
65d7b21b
authored
May 12, 2023
by
hwuebben
Committed by
GitHub
May 12, 2023
Browse files
OR am I crazy? (#23295)
or or and
parent
ef3e25ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/transformers/models/sam/processing_sam.py
src/transformers/models/sam/processing_sam.py
+4
-4
No files found.
src/transformers/models/sam/processing_sam.py
View file @
65d7b21b
...
@@ -207,7 +207,7 @@ class SamProcessor(ProcessorMixin):
...
@@ -207,7 +207,7 @@ class SamProcessor(ProcessorMixin):
if
isinstance
(
input_points
,
torch
.
Tensor
):
if
isinstance
(
input_points
,
torch
.
Tensor
):
input_points
=
input_points
.
numpy
().
tolist
()
input_points
=
input_points
.
numpy
().
tolist
()
if
not
isinstance
(
input_points
,
list
)
and
not
isinstance
(
input_points
[
0
],
list
):
if
not
isinstance
(
input_points
,
list
)
or
not
isinstance
(
input_points
[
0
],
list
):
raise
ValueError
(
"Input points must be a list of list of floating integers."
)
raise
ValueError
(
"Input points must be a list of list of floating integers."
)
input_points
=
[
np
.
array
(
input_point
)
for
input_point
in
input_points
]
input_points
=
[
np
.
array
(
input_point
)
for
input_point
in
input_points
]
else
:
else
:
...
@@ -217,7 +217,7 @@ class SamProcessor(ProcessorMixin):
...
@@ -217,7 +217,7 @@ class SamProcessor(ProcessorMixin):
if
isinstance
(
input_labels
,
torch
.
Tensor
):
if
isinstance
(
input_labels
,
torch
.
Tensor
):
input_labels
=
input_labels
.
numpy
().
tolist
()
input_labels
=
input_labels
.
numpy
().
tolist
()
if
not
isinstance
(
input_labels
,
list
)
and
not
isinstance
(
input_labels
[
0
],
list
):
if
not
isinstance
(
input_labels
,
list
)
or
not
isinstance
(
input_labels
[
0
],
list
):
raise
ValueError
(
"Input labels must be a list of list integers."
)
raise
ValueError
(
"Input labels must be a list of list integers."
)
input_labels
=
[
np
.
array
(
label
)
for
label
in
input_labels
]
input_labels
=
[
np
.
array
(
label
)
for
label
in
input_labels
]
else
:
else
:
...
@@ -229,8 +229,8 @@ class SamProcessor(ProcessorMixin):
...
@@ -229,8 +229,8 @@ class SamProcessor(ProcessorMixin):
if
(
if
(
not
isinstance
(
input_boxes
,
list
)
not
isinstance
(
input_boxes
,
list
)
and
not
isinstance
(
input_boxes
[
0
],
list
)
or
not
isinstance
(
input_boxes
[
0
],
list
)
and
not
isinstance
(
input_boxes
[
0
][
0
],
list
)
or
not
isinstance
(
input_boxes
[
0
][
0
],
list
)
):
):
raise
ValueError
(
"Input boxes must be a list of list of list of floating integers."
)
raise
ValueError
(
"Input boxes must be a list of list of list of floating integers."
)
input_boxes
=
[
np
.
array
(
box
).
astype
(
np
.
float32
)
for
box
in
input_boxes
]
input_boxes
=
[
np
.
array
(
box
).
astype
(
np
.
float32
)
for
box
in
input_boxes
]
...
...
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