From d9a3b557519e559798ce0a2af0659a95bf945fa9 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Mon, 10 Aug 2020 16:54:53 +0200
Subject: [PATCH] Added generic label class

---
 pysegcnn/core/constants.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/pysegcnn/core/constants.py b/pysegcnn/core/constants.py
index 2a1a138..b9546a1 100644
--- a/pysegcnn/core/constants.py
+++ b/pysegcnn/core/constants.py
@@ -40,8 +40,20 @@ class Sentinel2(enum.Enum):
     swir2 = 12
 
 
+# generic class label enumeration class
+class Label(enum.Enum):
+
+    @property
+    def id(self):
+        return self.value[0]
+
+    @property
+    def color(self):
+        return self.value[1]
+
+
 # labels of the Sparcs dataset
-class SparcsLabels(enum.Enum):
+class SparcsLabels(Label):
     Shadow = 0, 'grey'
     Shadow_over_water = 1, 'darkblue'
     Water = 2, 'blue'
@@ -52,13 +64,13 @@ class SparcsLabels(enum.Enum):
 
 
 # labels of the Cloud95 dataset
-class Cloud95Labels(enum.Enum):
+class Cloud95Labels(Label):
     Clear = 0, 'skyblue'
     Cloud = 1, 'white'
 
 
 # labels of the ProSnow dataset
-class ProSnowLabels(enum.Enum):
+class ProSnowLabels(Label):
     Cloud = 0, 'white'
     Snow = 1, 'lightblue'
     Snow_free = 2, 'sienna'
-- 
GitLab