Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PySegCNN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
earth_observation_public
PySegCNN
Commits
b67b29fe
Commit
b67b29fe
authored
4 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Removed redundant keyword arguments
parent
52f44e91
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pysegcnn/core/graphics.py
+4
-8
4 additions, 8 deletions
pysegcnn/core/graphics.py
with
4 additions
and
8 deletions
pysegcnn/core/graphics.py
+
4
−
8
View file @
b67b29fe
...
...
@@ -24,7 +24,7 @@ from pysegcnn.main.config import HERE
# this function applies percentile stretching at the alpha level
# can be used to increase constrast for visualization
def
contrast_stretching
(
image
,
alpha
=
2
):
def
contrast_stretching
(
image
,
alpha
=
5
):
# compute upper and lower percentiles defining the range of the stretch
inf
,
sup
=
np
.
percentile
(
image
,
(
alpha
,
100
-
alpha
))
...
...
@@ -49,15 +49,11 @@ def running_mean(x, w):
# plot_sample() plots a false color composite of the scene/tile together
# with the model prediction and the corresponding ground truth
def
plot_sample
(
x
,
y
,
use_bands
,
labels
,
y_pred
=
None
,
figsize
=
(
10
,
10
),
bands
=
[
'
nir
'
,
'
red
'
,
'
green
'
],
stretch
=
False
,
state
=
None
,
outpath
=
os
.
path
.
join
(
HERE
,
'
_samples/
'
),
**
kwargs
):
bands
=
[
'
nir
'
,
'
red
'
,
'
green
'
],
state
=
None
,
outpath
=
os
.
path
.
join
(
HERE
,
'
_samples/
'
),
alpha
=
0
):
# check whether to apply constrast stretching
stretch
=
True
if
kwargs
else
stretch
func
=
contrast_stretching
if
stretch
else
lambda
x
:
x
# create an rgb stack
rgb
=
np
.
dstack
([
func
(
x
[
use_bands
.
index
(
band
)],
**
kwargs
)
rgb
=
np
.
dstack
([
contrast_stretching
(
x
[
use_bands
.
index
(
band
)],
alpha
)
for
band
in
bands
])
# get labels and corresponding colors
...
...
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