This script is designed to train a simple neural network to classify images as either cats or dogs using a dataset of images. It utilizes TensorFlow and Keras for model creation and training.
- Python 3.x
- TensorFlow
- Keras
- scikit-learn
- NumPy
- matplotlib
- imutils
- OpenCV
-
Clone this repository:
git clone https://github.com/Sebastian352/Simple_Binary_NN
-
Navigate to the directory:
cd repository
-
Install dependencies:
pip install -r requirements.txt
Use the following command to run the script:
python script.py --dataset path/to/dataset --model path/to/model --label-bin path/to/label/binarizer --plot path/to/plot
Replace path/to/dataset
, path/to/model
, path/to/label/binarizer
, and path/to/plot
with relevant file paths.
-d
,--dataset
: Path to the input dataset of images (required).-m
,--model
: Path to the output trained model (required).-l
,--label-bin
: Path to the output label binarizer (required).-p
,--plot
: Path to the output accuracy/loss plot (required).
You can download a relevant dataset from this link.
This script performs the following steps:
- Loads the images from the dataset.
- Preprocesses the images and labels.
- Splits the dataset into training and testing sets.
- Creates a simple neural network model using Keras.
- Trains the model on the training data.
- Evaluates the trained model on the testing data.
- Generates a plot showing training and validation loss/accuracy.
- Saves the trained model, label binarizer, and plot to specified paths.
- This script is adapted from a tutorial on Kaggle.
- The dataset used for training the model can be found on Kaggle.