Feature Representations and Model Comparison

English translation

Images with the same brightness may have different structures. How features are represented affects distinguishability.

Before practice

01 Can mean brightness alone distinguish orientation?

Description

If vertical and horizontal patterns have the same mean brightness, another feature is needed to represent their structure.

02 Will shifting an image sideways give the same features?

Description

Position-sensitive features may change. Check this using a shift that preserves the Label.

Practice

Preview practice notebookDownload practice notebook

1. Pixel Representations and Simple Features

Starting conditions

In the 8×8 images, A has 1s only in the middle two columns, and B only in the middle two rows; all other pixels are 0.

Procedure

  1. Plot both images, then calculate the overall mean pixel value and the row and column sums.
  2. Check whether mean brightness alone distinguishes the two images, and choose one additional feature.

Results to retain

Items to record and points to check
Image
Mean brightness
Selected features
Distinguishable

Points to check

  • Did you check that the two images have different array structures despite the same mean brightness?

2. Shifted Inputs

Starting conditions

Calculate the same features on images A and B shifted 1 position to the right.

Procedure

  1. Use np.roll(A,1,axis=1) and np.roll(B,1,axis=1) to shift each image one position to the right. In this example, the rightmost column wraps around to the left.
  2. Calculate the features chosen in the previous activity, overall mean, row sums, and column sums for the shifted images too. For each image, record feature values before and after the shift side by side.
  3. Distinguish features that remain unchanged from those that change, and explain whether your selected features still distinguish the two images.

Results to retain

Items to record and points to check
Images before and after the shift
Mean
Row and column sums
Selected features and distinguishability

Points to check

  • Did you calculate the same features before and after the shift?

3. Checking Other Inputs

Starting conditions

Flip one pixel in each of A and B to examine the robustness of the selected features.

Procedure

  1. Select one pixel in each of A and B and change 0 to 1 or 1 to 0. Record the changed row and column Index and the values before and after the change.
  2. Recalculate the features selected earlier, and record their values before and after the change and whether they distinguish the two images. Explain how changing one pixel affected the features.

Results to retain

Items to record and points to check
Changed pixel index and value
Features before and after the change
Whether the two images are distinguishable
Reasoning

Points to check

  • Did you record the positions and values of the changed pixels?