I want to create a deep learning model to classify images. My dataset has around 400 classes and the classes have different number of images (15,20,30,40,60... images)
Is there a way to do oversampling using Keras? or any way rather than do it manually?
When should I apply oversampling before or after splitting the images into training, testing, validation sets?
--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/92dc7b28-a2dc-4d67-939c-726f6be74421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/CAO4rxgNYz3AWAh4Z1M-fOspfUhR4KM4%3DadMqi6b_B9ManX_Zeg%40mail.gmail.com.
By oversampling, do you mean you want to roughly sample the same number of images for each class (even if that means repeating some images from time to time)?If so, you can use the fit_geneator function, where you randomly pick a class, and then randomly pick an image from the classFor exampling:assuming "data" is a list of lists where the first dimension is the class, and the second dimension is a list of imagesdef get_data():while True:c = np.random.randint(len(data))i = np.random.randint(len(data[c]))yield data[c][i], labels[c][i]model.fit_generator(get_data(), samples_per_epoch=1000)
On Tue, Jul 17, 2018 at 11:57 AM, Nad <alay...@gmail.com> wrote:
I want to create a deep learning model to classify images. My dataset has around 400 classes and the classes have different number of images (15,20,30,40,60... images)
- so, I will apply oversampling..
Is there a way to do oversampling using Keras? or any way rather than do it manually?
When should I apply oversampling before or after splitting the images into training, testing, validation sets?
Thank you
--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
I work plenty with NN but not a lot with image processing. Does 400 categories strike anyone else as being a lot? Is that common in handling images???ThanksDennis
By oversampling, do you mean you want to roughly sample the same number of images for each class (even if that means repeating some images from time to time)?If so, you can use the fit_geneator function, where you randomly pick a class, and then randomly pick an image from the classFor exampling:assuming "data" is a list of lists where the first dimension is the class, and the second dimension is a list of imagesdef get_data():while True:c = np.random.randint(len(data))i = np.random.randint(len(data[c]))yield data[c][i], labels[c][i]model.fit_generator(get_data(), samples_per_epoch=1000)
On Tue, Jul 17, 2018 at 11:57 AM, Nad <alay...@gmail.com> wrote:
I want to create a deep learning model to classify images. My dataset has around 400 classes and the classes have different number of images (15,20,30,40,60... images)
- so, I will apply oversampling..
Is there a way to do oversampling using Keras? or any way rather than do it manually?
When should I apply oversampling before or after splitting the images into training, testing, validation sets?
Thank you
--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/92dc7b28-a2dc-4d67-939c-726f6be74421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/db4f4cdf-41d5-4f61-8244-5968b10198f9%40googlegroups.com.