Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
model_server
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
Christopher Randolph Rhodes
model_server
Commits
691a9fce
Commit
691a9fce
authored
11 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Passes, long warnings that convex hull calcs don't work
parent
8254cad5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!18
Completed (de)serialization of RoiSet
,
!16
Completed (de)serialization of RoiSet
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model_server/base/roiset.py
+8
-6
8 additions, 6 deletions
model_server/base/roiset.py
with
8 additions
and
6 deletions
model_server/base/roiset.py
+
8
−
6
View file @
691a9fce
...
...
@@ -154,18 +154,17 @@ class RoiSet(object):
return
self
.
_df
.
itertuples
(
name
=
'
Roi
'
)
@staticmethod
def
make_df
(
acc_raw
,
acc_obj_ids
,
expand_box_by
,
deproject
=
True
)
->
pd
.
DataFrame
:
def
make_df
(
acc_raw
,
acc_obj_ids
,
expand_box_by
)
->
pd
.
DataFrame
:
"""
Build dataframe associate object IDs with summary stats
:param acc_raw: accessor to raw image data
:param acc_obj_ids: accessor to map of object IDs
:param expand_box_by: number of pixels to expand bounding box in all directions (without exceeding image boundary)
:param deproject: assign object
'
s z-position based on argmax of raw data if True
#
:param deproject: assign object
'
s z-position based on argmax of raw data if True
:return: pd.DataFrame
"""
# build dataframe of objects, assign z index to each object
if
deproject
:
assert
acc_obj_ids
.
nz
==
1
,
'
Can only deproject a 2D object identity map
'
if
acc_obj_ids
.
nz
==
1
:
# deproject objects' z-coordinates from argmax of raw image
argmax
=
acc_raw
.
data
.
argmax
(
axis
=
3
,
keepdims
=
True
)[:,
:,
0
,
0
].
astype
(
'
uint16
'
)
df
=
(
pd
.
DataFrame
(
...
...
@@ -180,7 +179,7 @@ class RoiSet(object):
)
)
df
[
'
zi
'
]
=
df
[
'
intensity_mean
'
].
round
().
astype
(
'
int
'
)
else
:
else
:
# objects' z-coordinates come from arg of max count in object identities map
df
=
(
pd
.
DataFrame
(
regionprops_table
(
...
...
@@ -192,7 +191,10 @@ class RoiSet(object):
columns
=
{
'
bbox-0
'
:
'
y0
'
,
'
bbox-1
'
:
'
x0
'
,
'
bbox-2
'
:
'
y1
'
,
'
bbox-3
'
:
'
x1
'
,
}
)
)
df
[
'
zi
'
]
=
...
# from somewhere in obmap floor of avg z for each label...
def
_get_zi_from_obj_map_counts
(
la
):
return
(
acc_obj_ids
.
data
==
la
).
sum
(
axis
=
(
0
,
1
,
2
)).
argmax
()
df
[
'
zi
'
]
=
df
[
'
label
'
].
apply
(
_get_zi_from_obj_map_counts
)
# compute expanded bounding boxes
...
...
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