中高级Upper intermediate在线实验室Online lab可打印Printable点子Idea

CNN:带着同一把尺子找横线

CNN: Find a Line with One Shared Ruler

同一张 1 × 3 模板在图上滑动,画出特征图,再找最高分。先手算,再移动图案,看它何时会失效。

Slide one 1 × 3 filter, build a feature map and find its maximum. Calculate first, then move the picture and discover its limits.

试教点子:已提供活动、学习单和双语指南,尚未标为 Verified。可按学生情况分两次完成。

Teaching idea: activities, worksheets and bilingual guides are available. It is not yet marked Verified; split it into two sessions if helpful.

多层网络为三行分别造了三个神经元。如果图片有 100 行,也要造 100 套不同的分数吗?试试让同一张模板去每一处工作。

Our layered network built a detector for each row. For 100 rows, do we need 100 different sets of weights? Try using one filter everywhere.

开始之前Before you start

手算 1 × 3 模板的一个窗口,并区分特征图位置和全局最大值。

Calculate one 1 × 3 window and distinguish feature-map locations from a global maximum.

先做多层网络,理解点积和门槛。

Complete layered networks and understand dot products and thresholds.

一步一步试试看Try it step by step

  1. 先猜:把模板 [1,1,1] 放在一排 111 上,点积是多少?放到 010 上呢?Predict: place filter [1,1,1] over 111 and then 010. What are the dot products?
  2. 动手:在 5 × 5 图上每次横移一格,每行有 3 个合法窗口,总共 15 个位置;逐个记入 5 × 3 特征图。Try: slide one column at a time across a 5 × 5 image. Three valid windows per row give 15 positions, stored in a 5 × 3 feature map.
  3. 观察:取这张特征图的全局最大值,再用 >2.5 判断是否发现三个连续黑格。移动横线,比较位置图和最大值。Observe: take the global maximum and test >2.5 for three consecutive black pixels. Move the line and compare the location map with its maximum.
  4. 挑战:转成竖线、拆断横线、移出边界。共享权重只省参数,不会自动认出所有方向和变形。Challenge: rotate to vertical, break the line or move it off the edge. Shared weights save parameters without guaranteeing all orientations or deformations.

一起算一个例子Work through one example

图的某行为 01110,三个窗口得分 2、3、2。模板只有 3 个共享权重,不是为 15 个位置分别造 45 个权重。

A row 01110 produces window scores 2,3,2. The filter has three shared weights rather than 45 separate weights across 15 positions.

先想一想,再看答案Think first, then check

只知道最高分是 3,能知道横线在第几行吗?整张图全黑也会通过吗?

If you know only that the maximum is three, can you locate the row? Does an all-black image also pass?

查看参考答案Show the expected answer

不能,全局最大池化丢掉了位置;全黑也会通过。学习单:01110→2,3,2;00100→1,1,1;01010→1,2,1。最大值分别 3、1、2,只有第一行达到本课检测条件。

No: global max pooling discards location. An all-black image also passes. Worksheet rows: 01110→2,3,2; 00100→1,1,1; 01010→1,2,1. Maxima are 3,1,2; only the first meets this detector’s criterion.

这个实验说明了什么What this experiment shows

这是手工模板的滑动点积(深度学习中通常实现为互相关),不是训练好的 CNN。无填充、步长 1;边界裁切、旋转、步长和后续层都会影响平移表现。

This hand-set sliding dot product is cross-correlation as commonly used in deep learning, not a trained CNN. It uses no padding and stride one; boundaries, rotation, stride and later layers affect translation behavior.

学习单Worksheets

学习单用英文,可打印给孩子。教师指南随页面语言下载:当前为中文版。

Print the English worksheets for the children. The guide follows the page language: English is selected.

Practice: predict, then try
练习:先猜再试Practice: predict, then try
Challenge: make a puzzle
挑战:出题考一考Challenge: make a puzzle

下载学习单(PDF)Download worksheets (PDF)教师指南(中文 PDF)Teacher guide (English PDF)

视频与文章Videos and reading

接着学Keep going