Answers.Body: <p>You can always adjust <a href="https://www.tensorflow.org/tutorials/structured_data/imbalanced_data#class_weights" rel="nofollow noreferrer">class weights</a> accordingly. I know the reference is not for image data but it shouldn't matter if you are doing classification. <a href="https://datascience.stackexchange.com/questions/13490/how-to-set-class-weights-for-imbalanced-classes-in-keras">Here</a> is another answer more direct to the point.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-25T13:01:14.513Z
Answers.LastActivityDate: 2021-09-25T13:01:14.513Z
Answers.UserDisplayName: serali
Body: <p>I have an image data set on which I am training a CNN. The data set is slightly unbalanced. So, my solution up till now was to delete some images of the majority class.</p>
  <p>But I now realize that there are cleaner ways to deal with this. But I haven't been able to find ways to fix unbalanced <em>image</em> data sets. Only <em>structured</em> data-sets.</p>
  <p>I would like someone to guide me to fix the unbalance, other than deleting data from the majority class.</p>
  
Tags: <machine-learning><convolutional-neural-networks><datasets><imbalanced-datasets>
Title: How do you handle unbalanced image datasets?
UserDisplayName: sahal mulki
ThreadText: # How do you handle unbalanced image datasets?
  
  (Asked by: username_0 on 2021-09-25)
  
  I have an image data set on which I am training a CNN. The data set is slightly unbalanced. So, my solution up till now was to delete some images of the majority class.
  
  But I now realize that there are cleaner ways to deal with this. But I haven't been able to find ways to fix unbalanced *image* data sets. Only *structured* data-sets.
  
  I would like someone to guide me to fix the unbalance, other than deleting data from the majority class.
  
  **Tags:** machine-learning, convolutional-neural-networks, datasets, imbalanced-datasets
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-25. Score: 1 | Accepted answer
  
  You can always adjust [class weights](https://www.tensorflow.org/tutorials/structured_data/imbalanced_data#class_weights) accordingly. I know the reference is not for image data but it shouldn't matter if you are doing classification. [Here](https://datascience.stackexchange.com/questions/13490/how-to-set-class-weights-for-imbalanced-classes-in-keras) is another answer more direct to the point.
  
  
  ---
  
  