Working on a segmentation problem, converting single channel categorial coded image label to one hot encoded form in the data loader is taking considerable runtime,
does it make sense to create a one hot encoded label dataset?
→ How to save single channel label image as png with multichannel one hot encoded form?
In general, I don’t think using one-hot encoding with pytorch makes
sense.
I’ve never been able to think of a non-contrived use case (other than
if you’re working with preexisting one-hot encoded data that you don’t
want to bother transforming or with preexisting code that uses one-hot
encoding that you don’t want to modify) where one-hot encoding would
be preferred.
Pytorch’s workhorse loss criterion for classification problems, CrossEntropyLoss, expects categorical integer class labels as its target, so that’s the straightforward choice when using pytorch.