Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lamping, Christian
chicken_segmentation_dataset
Commits
d4fa2791
Commit
d4fa2791
authored
Oct 18, 2021
by
Lamping, Christian
Browse files
Update utils.py
parent
9d2e3b55
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils.py
View file @
d4fa2791
...
...
@@ -697,25 +697,6 @@ def display_instances(image, boxes, masks, class_ids, class_names,
plt
.
savefig
(
'val_image_%s.jpg'
%
savepath
)
if
auto_show
:
plt
.
show
()
def
pred_images_from_folder
(
directory
):
for
filename
in
os
.
listdir
(
directory
):
if
filename
.
endswith
(
".png"
):
print
(
os
.
path
.
join
(
directory
,
filename
))
path
=
os
.
path
.
join
(
directory
,
filename
)
augs
=
torchvision
.
transforms
.
Compose
([
torchvision
.
transforms
.
ToTensor
()])
img
=
np
.
array
(
Image
.
open
(
path
).
convert
(
"RGB"
))
img
,
window
,
scale
,
padding
,
crop
=
resize_image
(
img
,
[
img
.
shape
[
1
],
img
.
shape
[
0
]],
min_dim
=
None
,
min_scale
=
None
,
max_dim
=
384
)
img
=
augs
(
img
)
pred_mask
,
pred_boxes
,
class_ids
,
pred_score
=
get_prediction
(
model
,
img
,
threshold
)
masked_image
=
display_instances
(
np
.
array
(
img
.
mul
(
255
)).
transpose
(
1
,
2
,
0
),
pred_boxes
,
pred_mask
,
class_ids
,
dataset_train
.
class_names
,
auto_show
=
False
)
continue
else
:
continue
def
extract_bboxes
(
mask
):
"""Compute bounding boxes from masks.
...
...
Write
Preview
Supports
Markdown
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