Skip to content

Commit

Permalink
added function names for decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
madhavkhoslaa committed Oct 13, 2019
1 parent c5407fb commit c8a5a5e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/one_hot_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def PerPixelClassMatrix(self, Image):
class_map[x][y]= self.color[clr]
return class_map
def HotEncode(self, class_map):
"""Returns an n channel one hot encoded matrix of the same size as the Image"""
assert isinstance(class_map, np.ndarray), "Class map has to be an ndarray and not {}".format(type(class_map))
shape_= class_map.shape
encoded= np.zeros(shape= (shape_[0], shape_[1], len(self.color)), dtype=float)
Expand All @@ -62,4 +63,10 @@ def HotEncode(self, class_map):
def channelSplit(self,Nch_Hot_encoded):
"""The hot encoded Image is stored as stack of Hot encoded ndarrays
this function returns a list of cll the channels"""
return np.dsplit(Nch_Hot_encoded,Nch_Hot_encoded.shape[-1])
return np.dsplit(Nch_Hot_encoded,Nch_Hot_encoded.shape[-1])
def onehot2classmap(self, one_hot):
"""Method that takes one hot encoded matrix and outputs a classmap generated off the color dictionary"""
pass
def classmap2img(self, class_map):
"""Method that takes class_map matrix and gives a matrix like the image"""
pass

0 comments on commit c8a5a5e

Please sign in to comment.