Sofortantwort
TensorFlow einfach erklärt
Googles Deep Learning Framework für Produktion und Mobile.
- Kurz gesagt
- Von Google entwickelt, stark in Produktion und Mobile (TensorFlow Lite)
- Typischer Einsatz
- Mobile & Edge, Produktion, ML-Pipelines
- Wichtig zu wissen
- Gute Tooling: TensorBoard, TF Serving, TFX für ML-Pipelines
TensorFlow im Überblick
TensorFlow ist Googles Open-Source-Framework für Deep Learning und das zweite große Framework neben PyTorch. Es wurde 2015 veröffentlicht und war lange der Standard in der Industrie – besonders für Produktions-Deployments. TensorFlow 2.0 hat die API deutlich vereinfacht und Keras als High-Level-Interface integriert. Heute ist PyTorch in der Forschung dominanter, aber TensorFlow bleibt stark in Produktionsumgebungen, besonders bei Google-Cloud-Deployments und TensorFlow Serving.
TensorFlow ist Googles Deep Learning Framework, das besonders stark in Produktion und Mobile Deployment ist. Mit Keras als High-Level-API ist es auch für Einsteiger zugänglich.
TensorFlow heute:
import tensorflow as tf
from tensorflow import keras
# Keras macht TensorFlow einfach
model = keras.Sequential([
keras.layers.Dense(128, activation='relu'),
keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy')
model.fit(x_train, y_train, epochs=5)
Stärken von TensorFlow:
- TensorFlow Lite: Modelle auf Smartphones und IoT
- TensorFlow Serving: Skalierbare Produktion
- TensorBoard: Beste Visualisierung für Training
- TFX: Komplette ML-Pipelines
Technisch betrachtet
TensorFlow Ökosystem
TensorFlow Core
├── Keras (High-Level API)
├── TensorFlow Lite (Mobile/Edge)
├── TensorFlow.js (Browser)
├── TensorFlow Serving (Production)
├── TFX (ML Pipelines)
├── TensorBoard (Visualization)
└── TensorFlow Hub (Pre-trained Models)
Keras Sequential Model
model = keras.Sequential([
keras.layers.Conv2D(32, 3, activation='relu', input_shape=(28, 28, 1)),
keras.layers.MaxPooling2D(),
keras.layers.Flatten(),
keras.layers.Dense(128, activation='relu'),
keras.layers.Dense(10, activation='softmax')
])
model.summary() # Zeigt Architektur
TensorFlow vs. PyTorch
| Aspekt | TensorFlow | PyTorch |
|---|---|---|
| Entwickler | Meta | |
| API | Keras (high-level) | Native Python |
| Forschung | Weniger populär | Dominiert |
| Produktion | Stark (TF Serving) | Aufholend (TorchServe) |
| Mobile | TF Lite (ausgereift) | PyTorch Mobile |
| Visualisierung | TensorBoard (exzellent) | TensorBoard (kompatibel) |
TensorFlow Lite Beispiel
# Modell für Mobile konvertieren
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
# Speichern
with open('model.tflite', 'wb') as f:
f.write(tflite_model)
Wann TensorFlow wählen?
- Mobile/Edge Deployment (TF Lite ist ausgereifter)
- Google Cloud Integration (Vertex AI)
- Bestehende TensorFlow-Codebasis
- TFX für ML-Pipelines
- Keras für schnelles Prototyping