countEachLabel
(To be removed) Count number of pixel labels for each class of
bigimageDatastore
object
Since R2020a
The countEachLabel
function of the
bigimageDatastore
object will be removed in a future release. Use
the countEachLabel
function associated with the blockedImageDatastore
object instead. For more information, see Version History.
Description
Examples
Input Arguments
Output Arguments
Tips
You can use the label information returned by countEachLabel
to
calculate class weights for class balancing. For example, for labeled pixel data
information in tbl
:
Uniform class balancing weights each class such that each contains a uniform prior probability:
numClasses = height(tbl) prior = 1/numClasses; classWeights = prior./tbl.PixelCount
Inverse frequency balancing weights each class such that underrepresented classes are given higher weight:
totalNumberOfPixels = sum(tbl.PixelCount) frequency = tbl.PixelCount / totalNumberOfPixels; classWeights = 1./frequency
Median frequency balancing weights each class using the median frequency:
imageFreq = tbl.PixelCount ./ tbl.BlockPixelCount classWeights = median(imageFreq) ./ imageFreq