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
a4371edc
Commit
a4371edc
authored
6 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Merged in smoothing operation that supports binary masks
parent
653252ba
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/process.py
+9
-2
9 additions, 2 deletions
model_server/base/process.py
with
9 additions
and
2 deletions
model_server/base/process.py
+
9
−
2
View file @
a4371edc
...
...
@@ -18,7 +18,7 @@ def is_mask(img):
return
True
elif
img
.
dtype
==
'
uint8
'
:
unique
=
np
.
unique
(
img
)
if
unique
.
shape
[
0
]
=
=
2
and
np
.
all
(
unique
==
[
0
,
255
]):
if
unique
.
shape
[
0
]
<
=
2
and
np
.
all
(
unique
==
[
0
,
255
]):
return
True
return
False
...
...
@@ -136,7 +136,14 @@ def smooth(img: np.ndarray, sig: float) -> np.ndarray:
:param sig: threshold parameter
:return: smoothed image
"""
return
gaussian
(
img
,
sig
)
ga
=
gaussian
(
img
,
sig
,
preserve_range
=
True
)
if
is_mask
(
img
):
if
img
.
dtype
==
'
bool
'
:
return
ga
>
ga
.
mean
()
elif
img
.
dtype
==
'
uint8
'
:
return
(
255
*
(
ga
>
ga
.
mean
())).
astype
(
'
uint8
'
)
else
:
return
ga
class
Error
(
Exception
):
pass
...
...
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