From AI History to Hands‑On TensorFlow: Build Your First Fashion‑MNIST Classifier
This article surveys the evolution of artificial intelligence, clarifies weak versus strong AI, explains when machine learning is appropriate, and provides a step‑by‑step TensorFlow tutorial that trains a fashion‑MNIST image classifier using Docker and Python.
AI gives computers visual and auditory perception, language understanding, reasoning, and problem‑solving abilities; for engineers, learning AI is a natural progression.
AI Brief History
Artificial Intelligence has been discussed for over 60 years, experiencing cycles of hype and disappointment until recent breakthroughs driven by massive data and powerful hardware. Government initiatives now promote AI education from primary school to university.
Key milestones include:
1950 – Alan Turing proposes the Turing Test.
1958 – Rosenblatt introduces the Perceptron, the first artificial neural network.
1969 – Minsky and Papert identify limitations of early perceptrons.
2006 – Geoffrey Hinton popularizes deep learning.
2012 – Hinton’s team wins ImageNet, sparking the deep‑learning boom.
2019 – The Turing Award is jointly awarded to Yoshua Bengio, Geoffrey Hinton, and Yann LeCun.
What Do We Mean When We Talk About AI?
Two main concepts:
Weak AI : Systems designed for specific tasks (e.g., AlphaGo excels at Go but cannot solve elementary math problems).
Strong AI : Human‑level, general intelligence; still unattained and often portrayed as sci‑fi threats.
In practice, most engineers work with weak AI, i.e., machine‑learning algorithms.
When Should You Use Machine Learning?
Consider ML when a problem exhibits a learnable pattern, has sufficient data, and cannot be solved easily with explicit programming rules.
Problem shows regularities that can be learned.
Relevant data is available.
Traditional coding is difficult or infeasible.
ML has limits: data quality, algorithm suitability, computational cost, and convergence issues can cause failures.
Machine Learning vs. Traditional Programming
Traditional programming applies hard‑coded rules to input data to produce output. Machine learning lets a model learn the mapping from data to output.
ML learns directly from raw data without handcrafted rules.
Developers code models to learn tasks rather than to perform them directly.
ML focuses on prediction; traditional algorithms often extract statistics.
Many ML models lack interpretability.
ML performance is highly data‑dependent.
ML complements, not replaces, traditional software engineering.
Getting Started: A Small Hands‑On Example
Typical ML workflow:
Understand the problem and data.
Collect and preprocess data.
Develop a model.
Train the model.
Deploy the trained model.
We will use TensorFlow to train a fashion‑MNIST classifier.
Prepare Data
Download the four Fashion‑MNIST files and place them in ~/fashion-mnist.
Set Up the Environment
$ docker pull tensorflow/tensorflow:latest-py3-jupyter</code><code>$ docker run -it -v ~/fashion-mnist:/root/.keras/datasets/fashion-mnist -p 28888:8888 tensorflow/tensorflow:latest-py3-jupyterAccess Jupyter at
http://localhost:28888/notebooks/tensorflow-tutorials/basic_classification.ipynband run the cells.
from __future__ import absolute_import, division, print_function, unicode_literals
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
print(tf.__version__)Load the Fashion‑MNIST dataset (70,000 grayscale 28×28 images, 10 classes) and visualize a sample:
plt.figure()
plt.imshow(train_images[0])
plt.colorbar()
plt.grid(False)
plt.show()Build the Model
model = keras.Sequential([
keras.layers.Flatten(input_shape=(28, 28)),
keras.layers.Dense(128, activation=tf.nn.relu),
keras.layers.Dense(10, activation=tf.nn.softmax)
])Train the Model
model.fit(train_images, train_labels, epochs=5)After training, evaluate on the test set:
test_loss, test_acc = model.evaluate(test_images, test_labels)
print('Test accuracy:', test_acc)The model achieves about 87% accuracy, with a slight gap between training and test performance indicating mild overfitting.
Machine Learning Engineer’s Daily Work
ML engineers must understand business scenarios, assess data quality, perform preprocessing, and iterate on model design. Unlike traditional developers, they also need to quantify model impact and balance accuracy against computational cost.
Conclusion
We demonstrated a basic TensorFlow workflow for image classification and discussed the broader context of AI, machine learning fundamentals, and the roles of ML engineers.
References
[1] 《人工智能史》 https://zh.wikipedia.org/wiki/人工智能史
[2] A Complete History of Artificial Intelligence https://learn.g2.com/history-of-artificial-intelligence
[3] 2019图灵奖,拯救AI的英雄 https://huanqiukexue.com/a/qianyan/More_than_Science/2019/0328/28219.html
[4] How Do Machine Learning Algorithms Differ From Traditional Algorithms? https://www.analyticsindiamag.com/how-do-machine-learning-algorithms-differ-from-traditional-algorithms
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
