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
36a0ec66
Commit
36a0ec66
authored
11 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
RoiSet now classifies objects on a patch basis via .label_patch_stack method
parent
98be6bb7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!16
Completed (de)serialization of RoiSet
,
!13
Patch stack one channel
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/models.py
+11
-1
11 additions, 1 deletion
model_server/base/models.py
model_server/base/roiset.py
+1
-1
1 addition, 1 deletion
model_server/base/roiset.py
with
12 additions
and
2 deletions
model_server/base/models.py
+
11
−
1
View file @
36a0ec66
...
...
@@ -3,7 +3,7 @@ from math import floor
import
numpy
as
np
from
model_server.base.accessors
import
GenericImageDataAccessor
,
InMemoryDataAccessor
from
model_server.base.accessors
import
GenericImageDataAccessor
,
InMemoryDataAccessor
,
PatchStack
class
Model
(
ABC
):
...
...
@@ -88,6 +88,16 @@ class InstanceSegmentationModel(ImageToImageModel):
if
not
img
.
shape
==
mask
.
shape
:
raise
InvalidInputImageError
(
'
Expect input image and mask to be the same shape
'
)
def
label_patch_stack
(
self
,
img
:
PatchStack
,
mask
:
PatchStack
,
**
kwargs
):
"""
Iterative over a patch stack, call inference on each patch
:return: PatchStack of same shape in input
"""
res_data
=
np
.
zeros
(
img
.
shape
,
dtype
=
'
uint16
'
)
for
i
in
range
(
0
,
img
.
count
):
# interpret as PYXCZ
res_data
[
i
,
:,
:,
:,
:]
=
self
.
label_instance_class
(
img
.
iat
(
i
),
mask
.
iat
(
i
),
**
kwargs
).
data
return
PatchStack
(
res_data
)
class
DummySemanticSegmentationModel
(
SemanticSegmentationModel
):
...
...
This diff is collapsed.
Click to expand it.
model_server/base/roiset.py
+
1
−
1
View file @
36a0ec66
...
...
@@ -279,7 +279,7 @@ class RoiSet(object):
def
classify_by
(
self
,
name
:
str
,
channel
:
int
,
object_classification_model
:
InstanceSegmentationModel
,
):
# do this on a patch basis, i.e. only one object per frame
obmap_patches
=
object_classification_model
.
label_
instance_class
(
obmap_patches
=
object_classification_model
.
label_
patch_stack
(
self
.
get_raw_patches
(
channel
=
channel
),
self
.
get_patch_masks
()
)
...
...
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