| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
As a deep learning enthusiast, I developed this project to deepen my understanding of TensorFlow/Keras callbacks by applying them to a simple image classification task. This notebook demonstrates practical implementations of various callbacks, showcasing their mechanics and effects on model training. It's designed to highlight my skills in model building, callback customization, and training optimization, even if some runs yield moderate accuracies—intentionally kept to illustrate learning curves and callback behaviors for benchmarking purposes.
The core task is binary image classification: distinguishing between horses and humans using a convolutional neural network (CNN). However, the primary goal is to explore and implement TensorFlow/Keras callbacks to monitor, control, and optimize the training process. This includes handling overfitting, adjusting learning rates, saving checkpoints, and creating custom callbacks for deeper insights into training dynamics.
The 'horses_or_humans' dataset from tensorflow_datasets is used, containing 1027 training examples split into train (80%), validation (20%), and test sets. It has 2 classes (horses and humans), with RGB images originally sized variably but resized to 150x150x3 during preprocessing.
pip install tensorflow tensorflow-datasets matplotlib numpy pandas
jupyter notebook callbacks_me.ipynb
tensorboard --logdir logs --port 6006
These results emphasize callback utility in preventing overfitting and optimizing training, even with moderate initial accuracies to showcase iterative improvements.
Sample training output with EarlyStopping:
Epoch 1/50 26/26 - 1s - 47ms/step - accuracy: 0.6058 - loss: 0.6705 - val_accuracy: 0.5756 - val_loss: 0.6592 ... Epoch 15: early stopping Restoring model weights from the end of the best epoch: 12.
Custom callback logging example:
...Training: start of batch 0; got log keys: [] ...Training: end of batch 0; got log keys: ['accuracy', 'loss'] ... End epoch 0 of training; got log keys: ['accuracy', 'loss', 'val_accuracy', 'val_loss']
(For full logs and TensorBoard visuals, run the notebook interactively.)
Through this project, I gained hands-on experience with callback mechanics, such as using self.model.stop_training for custom stopping logic and accessing logs for real-time metrics. Explanations in the notebook cover tuple concatenation for input shapes (e.g., IMAGE_SIZE + (3,) yielding (150, 150, 3)) and math functions like math.pow and math.floor in schedulers. Some runs with lower accuracies (e.g., ~0.60) were intentional to demonstrate callback interventions, reinforcing my understanding of training pitfalls and optimizations.
This project is licensed under the Apache 2.0 License – see the LICENSE file for details.
💡 Some interactive outputs (e.g., plots, widgets) may not display correctly on GitHub. If so, please view this notebook via nbviewer.org for full rendering.
| Back | FazBrowse Home | New Git URL |