sample for ML working with two class dataset, it's purpose is to have something for fast experiments
Prepare your dataset, get same size images from two classes and put them into two folders.
-
run the
split.py
with correctly set values forfirstclassfolder, secondclassfolder, train_test_split
-
classifiers are inspired by blog post "Building powerful image classification models using very little data" from blog.keras.io (classifier_1) and by "Using Bottleneck Features for Multi-Class Classification in Keras and TensorFlow" from codesofinterest.com (classifier_2).
-
edit the exact info about your dataset, such as
img_width, img_height, nb_train_samples, nb_validation_samples
and run one of the classifiersclassifier_1.py
- simple CNN modelclassifier_2.py
- load model VGG16 pretrained on ImageNet and attach a simple top CNN model
-
also outputs simple visualization of the loss function over epochs
As an example I took images from dogs and cats Kaggle dataset, 2000 of examples per class for training, 400 examples per class for validation.
Here are the plots from both classifiers:
![]() |
![]() |
---|---|
classifier 1 after 100 epochs | classifier 2 after 50 epochs |