Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
pydensecrf
Commits
f182f34d
Commit
f182f34d
authored
Feb 08, 2016
by
Markus Nagel
Browse files
Minor clean up of the utils functions according to comments of the PR.
parent
202ec4e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
utils.py
utils.py
+6
-6
No files found.
utils.py
View file @
f182f34d
...
@@ -59,7 +59,7 @@ def create_pairwise_gaussian(sdims, shape):
...
@@ -59,7 +59,7 @@ def create_pairwise_gaussian(sdims, shape):
# scale mesh accordingly
# scale mesh accordingly
for
i
,
s
in
enumerate
(
sdims
):
for
i
,
s
in
enumerate
(
sdims
):
mesh
[
i
]
=
mesh
[
i
]
/
s
mesh
[
i
]
/
=
s
return
mesh
.
reshape
([
len
(
sdims
),
-
1
])
return
mesh
.
reshape
([
len
(
sdims
),
-
1
])
...
@@ -82,7 +82,7 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
...
@@ -82,7 +82,7 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
chdim: int, optional
chdim: int, optional
This specifies where the channel dimension is in the image. For
This specifies where the channel dimension is in the image. For
example `chdim=2` for a RGB image of size (240, 300, 3). If the
example `chdim=2` for a RGB image of size (240, 300, 3). If the
image has no
w
channel dimension (e.g. it has only one channel) use
image has no channel dimension (e.g. it has only one channel) use
`chdim=-1`.
`chdim=-1`.
"""
"""
...
@@ -96,7 +96,7 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
...
@@ -96,7 +96,7 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
# scale image features per channel
# scale image features per channel
for
i
,
s
in
enumerate
(
schan
):
for
i
,
s
in
enumerate
(
schan
):
im_feat
[
i
]
=
im_feat
[
i
]
/
s
im_feat
[
i
]
/
=
s
# create a mesh
# create a mesh
cord_range
=
[
range
(
s
)
for
s
in
im_feat
.
shape
[
1
:]]
cord_range
=
[
range
(
s
)
for
s
in
im_feat
.
shape
[
1
:]]
...
@@ -104,13 +104,13 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
...
@@ -104,13 +104,13 @@ def create_pairwise_bilateral(sdims, schan, img, chdim=-1):
# scale mesh accordingly
# scale mesh accordingly
for
i
,
s
in
enumerate
(
sdims
):
for
i
,
s
in
enumerate
(
sdims
):
mesh
[
i
]
=
mesh
[
i
]
/
s
mesh
[
i
]
/
=
s
feats
=
np
.
concatenate
([
mesh
,
im_feat
])
feats
=
np
.
concatenate
([
mesh
,
im_feat
])
return
feats
.
reshape
([
feats
.
shape
[
0
],
-
1
])
return
feats
.
reshape
([
feats
.
shape
[
0
],
-
1
])
def
create_pairwise_gaussian_2d
(
sx
,
sy
,
shape
):
def
_
create_pairwise_gaussian_2d
(
sx
,
sy
,
shape
):
"""
"""
A simple reference implementation for the 2D case. The ND implementation
A simple reference implementation for the 2D case. The ND implementation
is faster.
is faster.
...
@@ -124,7 +124,7 @@ def create_pairwise_gaussian_2d(sx, sy, shape):
...
@@ -124,7 +124,7 @@ def create_pairwise_gaussian_2d(sx, sy, shape):
return
feats
.
reshape
([
feat_size
,
-
1
])
return
feats
.
reshape
([
feat_size
,
-
1
])
def
create_pairwise_bilateral_2d
(
sx
,
sy
,
sr
,
sg
,
sb
,
img
):
def
_
create_pairwise_bilateral_2d
(
sx
,
sy
,
sr
,
sg
,
sb
,
img
):
"""
"""
A simple reference implementation for the 2D case. The ND implementation
A simple reference implementation for the 2D case. The ND implementation
is faster.
is faster.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment