Transfer Learning Example - Keras Typing CST Test
Loading…
Transfer Learning Example — Keras Code
Use a pre-trained MobileNetV2 for image classification.
from tensorflow import keras
base_model = keras.applications.MobileNetV2(input_shape=(128,128,3), include_top=False, weights='imagenet')
base_model.trainable = False
model = keras.Sequential([
base_model,
layers.GlobalAveragePooling2D(),
layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])Keras Language Guide
Keras is an open-source, high-level deep learning API written in Python. It provides a user-friendly interface for building and training neural networks, running on top of TensorFlow, Theano, or CNTK backends.
Primary Use Cases
- ▸Image classification and object detection
- ▸Natural language processing (NLP)
- ▸Reinforcement learning prototypes
- ▸Time series forecasting
- ▸Educational purposes and research experiments
Notable Features
- ▸High-level API for deep learning
- ▸Seamless integration with TensorFlow
- ▸Supports Sequential and Functional API models
- ▸Built-in layers, optimizers, loss functions, and metrics
- ▸GPU acceleration via backend frameworks
Origin & Creator
Keras was developed in 2015 by François Chollet, a Google engineer, to simplify deep learning model creation and experimentation.
Industrial Note
Keras is popular in industry and academia for rapid prototyping, experimentation, and deployment of neural networks due to its simplicity, modularity, and integration with TensorFlow.