Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ALMF
SVLT
Commits
8e56b0e6
Commit
8e56b0e6
authored
8 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Need to standardize whether binary_mask is (Y, X, 1, 1) or (Y, X)
parent
3ab56713
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model_server/base/roiset.py
+11
-3
11 additions, 3 deletions
model_server/base/roiset.py
with
11 additions
and
3 deletions
model_server/base/roiset.py
+
11
−
3
View file @
8e56b0e6
...
...
@@ -172,8 +172,15 @@ def _make_df_from_object_ids(acc_raw, acc_obj_ids, expand_box_by) -> pd.DataFram
df
=
_df_insert_slices
(
df
,
acc_raw
.
shape_dict
,
expand_box_by
)
# TODO: make this contingent on whether seg is included
def
_make_binary_mask
(
r
):
acc
=
InMemoryDataAccessor
(
acc_obj_ids
.
data
==
r
.
label
)
acc
.
get_mono
(
0
,
mip
=
True
)
cropped
=
acc
.
crop_hw
((
r
.
y0
,
r
.
x0
,
(
r
.
y1
-
r
.
y0
),
(
r
.
x1
-
r
.
x0
))).
data
return
cropped
df
[
'
binary_mask
'
]
=
df
.
apply
(
lambda
r
:
(
acc_obj_ids
.
data
==
r
.
label
).
max
(
axis
=-
1
)[
r
.
y0
:
r
.
y1
,
r
.
x0
:
r
.
x1
,
0
],
# lambda r: (acc_obj_ids.data == r.label).max(axis=-1)[r.y0: r.y1, r.x0: r.x1, 0],
_make_binary_mask
,
axis
=
1
,
result_type
=
'
reduce
'
,
)
...
...
@@ -327,7 +334,7 @@ class RoiSet(object):
:param params: optional arguments that influence the definition and representation of ROIs
:return: object identities map
"""
return
__class__
.
from_object_ids
(
acc_raw
,
_get_label_ids
(
acc_seg
,
allow_3d
=
allow_3d
,
connect_3d
=
connect_3d
),
params
)
return
RoiSet
.
from_object_ids
(
acc_raw
,
_get_label_ids
(
acc_seg
,
allow_3d
=
allow_3d
,
connect_3d
=
connect_3d
),
params
)
# TODO: generate overlapping RoiSet from multiple masks
...
...
@@ -519,13 +526,14 @@ class RoiSet(object):
patch
[
roi
.
relative_slice
][:,
:,
0
,
0
]
=
roi
.
binary_mask
*
255
else
:
patch
=
np
.
zeros
((
roi
.
y1
-
roi
.
y0
,
roi
.
x1
-
roi
.
x0
,
1
,
1
),
dtype
=
'
uint8
'
)
patch
[:,
:,
0
,
0
]
=
roi
.
binary_mask
*
255
patch
=
roi
.
binary_mask
*
255
if
pad_to
:
patch
=
pad
(
patch
,
pad_to
)
return
patch
dfe
=
self
.
_df
.
copy
()
# TODO: can just pass function handle
dfe
[
'
patch_mask
'
]
=
dfe
.
apply
(
lambda
r
:
_make_patch_mask
(
r
),
axis
=
1
)
return
dfe
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment