'Difference between 'multi output' vs 'raw' in keras 'flow_from_dataframe'
I'm not sure about when to use raw
vs multi output
in the keras flow_from_dataframe class_mode
parameter, as by the looks of it, they both provide a way to classifying data with multiple labels. Suppose say I have a dataframe with the image path as well as two columns/classes with labels for each given image, and I would like to create a model which classifies the images based on those classes, which class_mode
would I use, and when would I use the other one?
Edit: attached an image of the dataframe I'm using
Solution 1:[1]
Use class_mode="raw"
when the label column you're using has the actual raw class values that you intend to use as the training label. For example, if you're doing a regression task or ordinal regression and you have floating point numbers or integers as your columns. In that case, you must make sure that the actual numerical values are what you want your final labels to be.
In your case, it looks like you have text labels of different classes, so you have a multi-class, multi-label classification problem, and therefore you must use class_mode="multi_output"
to transform the y-values correctly with multiple labels.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TC Arlen |