Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 1.96 KB

README.md

File metadata and controls

80 lines (58 loc) · 1.96 KB

Example MNIST Tensorflow

This example shows how to:

  • Define a CNN by subclassing the tf.keras.Model class
  • Train the model (from scratch or loading an existing model)
  • Visualize training history
  • Load & use a dataset from Tensorflow & Hugging Face
  • Load & Save models using SavedModel & SafeTensors formats
  • Inference

Index

Virtual Environment & Dependencies

Create Virtual environment & install dependencies

python3.11 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Activate Virtual environment

source venv/bin/activate

Deactivate Virtual environment

deactivate

Training

--save_freq=0 if you don't want to save the model

Training from Scratch

python train.py --epochs=10 --save_freq=10 --batch_size=64

Training loading previous version

python train.py --epochs=10 --save_freq=5 --load --batch_size=64

Inference

Loads all images inside the selected folder and makes predictions.

images inside sample's folder have different sizes

python inference.py --img_folder="samples"

Visualization

Resources