Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
earth_observation_public
PySegCNN
Commits
3f9a7790
Commit
3f9a7790
authored
Aug 16, 2021
by
Frisinghelli Daniel
Browse files
Implemented support for multi-label cases.
parent
04d2ca58
Changes
1
Hide whitespace changes
Inline
Side-by-side
pysegcnn/core/constants.py
View file @
3f9a7790
...
@@ -16,6 +16,7 @@ License
...
@@ -16,6 +16,7 @@ License
# builtins
# builtins
import
enum
import
enum
from
collections.abc
import
Iterable
# externals
# externals
import
numpy
as
np
import
numpy
as
np
...
@@ -116,7 +117,17 @@ class LabelMapping(dict):
...
@@ -116,7 +117,17 @@ class LabelMapping(dict):
def
to_numpy
(
self
):
def
to_numpy
(
self
):
"""Return the label mapping dictionary as :py:class:`numpy.ndarray`."""
"""Return the label mapping dictionary as :py:class:`numpy.ndarray`."""
return
np
.
array
(
list
(
self
.
items
()))
# check for multiple labels
mapping
=
{}
for
k
,
v
in
self
.
items
():
if
isinstance
(
k
,
Iterable
):
for
label
in
k
:
mapping
[
label
]
=
v
else
:
mapping
[
k
]
=
v
return
np
.
array
(
list
(
mapping
.
items
()))
class
SparcsLabels
(
Label
):
class
SparcsLabels
(
Label
):
...
...
Write
Preview
Supports
Markdown
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