Certificate
Final assessment outline for the TensorFlow track: scoring rubric, deliverables, and a worked example submission.
TensorFlow — certificate
EXAMPLE
# ===== Award criteria =====
# Pass: >= 70% across these dimensions
# 1. Data pipeline (tf.data) (15 pts)
# 2. Model architecture (Keras) (20 pts)
# 3. Training loop + callbacks (15 pts)
# 4. Evaluation + metrics (15 pts)
# 5. Export + serving (SavedModel/TFLite)(15 pts)
# 6. Communication (20 pts)
# Distinction: >= 85%
# ===== Project brief =====
# Build, evaluate, and deploy a model on one task:
# - Image classification (any 5-class set, >= 5k images total)
# - Text classification (any 2-class set, >= 20k examples)
# - Time series forecast (single variable, >= 10k points)
#
# Deliver:
# - notebook.ipynb (reproducible)
# - model/ (SavedModel directory)
# - report.md (<= 800 words)
# - inference.py (loads model and predicts on a single sample)
# ===== Sample scaffold (images) =====
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
IMG = 224
BATCH = 32
train_ds = keras.utils.image_dataset_from_directory(
'data/train', image_size=(IMG, IMG), batch_size=BATCH, label_mode='categorical'
)
val_ds = keras.utils.image_dataset_from_directory(
'data/val', image_size=(IMG, IMG), batch_size=BATCH, label_mode='categorical'
)
AUTOTUNE = tf.data.AUTOTUNE
train_ds = train_ds.cache().shuffle(1000).prefetch(AUTOTUNE)
val_ds = val_ds.cache().prefetch(AUTOTUNE)
base = keras.applications.MobileNetV2(
input_shape=(IMG, IMG, 3), include_top=False, weights='imagenet'
)
base.trainable = False
inputs = keras.Input(shape=(IMG, IMG, 3))
x = keras.applications.mobilenet_v2.preprocess_input(inputs)
x = base(x, training=False)
x = layers.GlobalAveragePooling2D()(x)
x = layers.Dropout(0.2)(x)
outputs = layers.Dense(5, activation='softmax')(x)
model = keras.Model(inputs, outputs)
model.compile(
optimizer=keras.optimizers.Adam(1e-3),
loss='categorical_crossentropy',
metrics=['accuracy', keras.metrics.AUC(name='auc')],
)
callbacks = [
keras.callbacks.EarlyStopping(patience=4, restore_best_weights=True),
keras.callbacks.ModelCheckpoint('ckpt.keras', save_best_only=True),
keras.callbacks.TensorBoard(log_dir='logs'),
]
model.fit(train_ds, validation_data=val_ds, epochs=20, callbacks=callbacks)
# Fine-tune the top of the base:
base.trainable = True
for layer in base.layers[:-30]:
layer.trainable = False
model.compile(optimizer=keras.optimizers.Adam(1e-5),
loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(train_ds, validation_data=val_ds, epochs=5, callbacks=callbacks)
# ===== Export =====
model.save('model') # SavedModel directory
# TFLite for mobile:
converter = tf.lite.TFLiteConverter.from_saved_model('model')
converter.optimizations = [tf.lite.Optimize.DEFAULT]
open('model.tflite', 'wb').write(converter.convert())
# ===== Marking sheet (example) =====
# 1. tf.data pipeline 14/15 cache + shuffle + prefetch, no leakage
# 2. Architecture 18/20 transfer learning + fine-tune second pass
# 3. Training 13/15 EarlyStopping + Checkpoint + TensorBoard
# 4. Evaluation 13/15 per-class metrics + confusion matrix
# 5. Export 15/15 SavedModel + TFLite + inference.py
# 6. Communication 18/20 charts, clear takeaway
# Total: 91/100 -> Distinction
# ===== Pitfalls =====
# - Forgetting .cache().prefetch() -> input pipeline becomes the bottleneck
# - Augmenting on val/test sets -> evaluation drifts
# - Training too long without EarlyStopping -> overfit
# - Saving weights only -> hard to re-deploy; save full SavedModel
# - Mixing class labels between train/val splits -> silent leakage
Why it matters
The certificate is the smallest credible project. tf.data + transfer learning + EarlyStopping + SavedModel + a tight report. Hit those and you have not only a paper credential but a reusable scaffold for every TF project you take on next.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Discussion
Loading…