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
9331b28a
Commit
9331b28a
authored
7 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Corrected Gaussian smoothing in pixel map
parent
019156dd
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/extensions/ilastik/models.py
+6
-4
6 additions, 4 deletions
model_server/extensions/ilastik/models.py
with
6 additions
and
4 deletions
model_server/extensions/ilastik/models.py
+
6
−
4
View file @
9331b28a
...
...
@@ -107,7 +107,7 @@ class IlastikPixelClassifierParams(IlastikParams):
class
IlastikPixelClassifierModel
(
IlastikModel
,
SemanticSegmentationModel
):
model_id
=
'
ilastik_pixel_classification
'
operations
=
[
'
segment
'
,
]
def
__init__
(
self
,
params
:
IlastikPixelClassifierParams
,
**
kwargs
):
super
(
IlastikPixelClassifierModel
,
self
).
__init__
(
params
,
**
kwargs
)
...
...
@@ -169,7 +169,7 @@ class IlastikPixelClassifierModel(IlastikModel, SemanticSegmentationModel):
pxmap
,
_
=
self
.
infer
(
img
)
sig
=
self
.
params
[
'
px_smoothing
'
]
if
sig
>
0.0
:
proc
=
smooth
(
img
.
data
,
sig
)
proc
=
smooth
(
pxmap
.
data
,
sig
)
else
:
proc
=
pxmap
.
data
mask
=
proc
[:,
:,
self
.
params
[
'
px_class
'
],
:]
>
self
.
params
[
'
px_prob_threshold
'
]
...
...
@@ -317,9 +317,11 @@ class IlastikObjectClassifierFromPixelPredictionsModel(IlastikModel, ImageToImag
"""
if
not
img
.
shape
==
pxmap
.
shape
:
raise
InvalidInputImageError
(
'
Expecting input image and pixel probabilities to be the same shape
'
)
if
not
pxmap
.
data
.
min
()
>=
0.0
and
pxmap
.
data
.
max
()
<=
1.0
:
raise
InvalidInputImageError
(
'
Pixel probability values must be between 0.0 and 1.0
'
)
pxch
=
kwargs
.
get
(
'
pixel_classification_channel
'
,
0
)
pxtr
=
kwargs
.
get
(
'
pixel_classification_threshold
'
,
0.5
)
mask
=
pxmap
.
get_
m
on
o
(
pxch
).
apply
(
lambda
x
:
x
>
pxtr
)
pxtr
=
kwargs
(
'
pixel_classification_threshold
'
,
0.5
)
mask
=
InMemoryDataAccessor
(
pxmap
.
get_on
e_channel_data
(
pxch
).
data
>
pxtr
)
obmap
,
_
=
self
.
infer
(
img
,
mask
)
return
obmap
...
...
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