| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A convolutional neural network for image recognition using AlexNet architecture implemented with TensorFlow 2.x and Keras API.
This project implements an AlexNet-based CNN for multi-class image classification. The model is designed to classify images into 4 categories: Cat, Tree, Horse, and Dog. It uses TensorFlow 2.x with the Keras API for a modern, efficient implementation.
For detailed documentation, advanced topics, and in-depth guides, please visit the Wiki:
The README below covers the basics to get you started quickly. For comprehensive information, theory, and advanced usage, refer to the Wiki.
The AlexNet model consists of:
pip install tensorflow numpy matplotlib scikit-learnOrganize your dataset in the following directory structure:
ConvNet/
├── dataset/ # Training images
│ ├── Cat/
│ │ ├── image1.jpg
│ │ ├── image2.jpg
│ │ └── ...
│ ├── Tree/
│ ├── Horse/
│ └── Dog/
└── test_dataset/ # Test images
├── Cat/
├── Tree/
├── Horse/
└── Dog/
Image Requirements:
Convert your training images to a compressed pickle format:
python my_alexnet_cnn.py preprocessing_training -f images_dataset.pklShuffle the training dataset (recommended for better training):
python my_alexnet_cnn.py preprocessing_training -f images_dataset.pkl --shuffleThis creates an images_shuffled.pkl file with randomly shuffled training data.
Convert your test images to a compressed pickle format:
python my_alexnet_cnn.py preprocessing_test -t images_test_dataset.pklTrain the model with default parameters:
python my_alexnet_cnn.py trainTraining with custom parameters:
python my_alexnet_cnn.py train \
--learning-rate 0.0001 \
--max_epochs 50 \
--display-step 5 \
--dataset_training images_shuffled.pklAvailable training parameters:
Training outputs:
Run predictions on test data:
python my_alexnet_cnn.py predict --dataset_test images_test_dataset.pklThe prediction will:
# Step 1: Prepare training data
python my_alexnet_cnn.py preprocessing_training -f images_dataset.pkl --shuffle
# Step 2: Prepare test data
python my_alexnet_cnn.py preprocessing_test -t images_test_dataset.pkl
# Step 3: Train the model
python my_alexnet_cnn.py train \
--learning-rate 0.001 \
--max_epochs 100 \
--display-step 10 \
--dataset_training images_shuffled.pkl
# Step 4: Evaluate on test set
python my_alexnet_cnn.py predict --dataset_test images_test_dataset.pklFor a quick test with fewer epochs:
python my_alexnet_cnn.py train --max_epochs 10 --display-step 2After training, the model provides:
Training Metrics:
Classification Report:
Visualizations:
TensorBoard Support:
tensorboard --logdir=ckpt_dir/ConvNet/ ├── my_alexnet_cnn.py # Main script with AlexNet model and training logic ├── Dataset.py # Dataset preprocessing utilities ├── README.md # This file ├── LICENSE # MIT License ├── dataset/ # Training images directory ├── test_dataset/ # Test images directory ├── ckpt_dir/ # Model checkpoints and TensorBoard logs ├── FileLog.log # Training and prediction logs ├── images_dataset.pkl # Preprocessed training data ├── images_shuffled.pkl # Shuffled training data └── images_test_dataset.pkl # Preprocessed test data
The model classifies images into 4 categories:
| Class ID | Label |
|---|---|
| 0 | Cat |
| 1 | Tree |
| 2 | Horse |
| 3 | Dog |
Issue: No model checkpoint found to restore - ERROR
Issue: Memory errors during training
Issue: Images not loading
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2017 Michele Campus
Contributions are welcome! Please feel free to submit a Pull Request.
PayPal: fci1908@gmail.com
| Back | FazBrowse Home | New Git URL |