C28 · Learned image methods
Trust, limitations and model inspection
An attractive output starts an investigation. Change an irrelevant cue, cover a patch and separate score from reliability.
Theory
A right answer for the wrong reason
If training images of a class often contain a hospital mark, studio background or file-format cue, a model may use it instead of the intended feature. This is a shortcut. Changing camera, lighting or data source creates domain shift: the earlier statistical association may disappear.
The declared rule below depends on object mean and corner-cue brightness. It is not trained: its complete mechanism is deliberately visible. Holding the object fixed and changing the cue gives a controlled dependency test rather than an impression from a colorful heatmap.
Test an irrelevant shortcut
The object is identical in both images; only its corner cue changes. Compare before and after scores. Set cue reliance to 0: does the score difference disappear even though the two images still differ?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The score changes while the object's true category stays fixed. This is an exact robustness counterexample for the declared rule, not output from a hidden trained model.
- Score before
- 0.832
- Score after
- 0.31
- Difference
- -0.522
Parameters and details
Declared hand-written classifier: sigmoid(2·(object mean−0.5)+w·(cue mean−0.5)). It is not trained and does not recognize shape. Its 0…1 score is not a validated probability. The object's true class does not change with an irrelevant cue.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Intervention is useful but limited
Occlusion covers a patch and recomputes the result. A large score change makes that patch important under this intervention. However, the fill creates a new image, and a model may react to the artificial patch itself. Gradient saliency measures local sensitivity; feature visualization seeks an input that increases a feature: these answer different questions.
A structural receptive field says where information may arrive from. Attention describes one mixture. Neither alone guarantees causal interpretation or class correctness. Several consistent tests, counterexamples and baseline comparisons are needed.
Cover a patch and measure the change
Select a location in the image to move the 4×4 occlusion. Cover the corner cue, then the object's center: which changes the score more? Shape and cue play different roles in our declared rule; occlusion is not proof of object understanding.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
A large change reveals this rule's dependence on the patch under this fill value. It alone neither explains semantics nor proves transfer to other data.
- Score before
- 0.832
- Score after
- 0.5062
- Difference
- -0.3258
Parameters and details
Declared hand-written classifier: sigmoid(2·(object mean−0.5)+w·(cue mean−0.5)). It is not trained and does not recognize shape. Its 0…1 score is not a validated probability. The object's true class does not change with an irrelevant cue.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
A new set tests transfer; temperature changes confidence
One counterexample reveals dependence; evaluation needs a series of independently labeled examples. Here 40 pairs use object brightness above 0.5 for class 1 and below 0.5 for class 0. A corner mark is irrelevant information. It helps on the first set and hurts on the second. The evaluation set changes while the selected rule stays fixed.
Accuracy is the fraction of correct class choices. Confidence is the number attached to each choice. Calibration groups similarly confident predictions and compares confidence with the group's correctness frequency. The diagonal means agreement. Temperature divides the logit before sigmoid and preserves its sign, so it cannot repair wrong classes.
Test new data and test confidence
Each cell is a separate example. Initially the cue matches the object's class. Switch sets: objects and true classes stay fixed but cue correlation reverses. Then set cue weight to 0. Change confidence through temperature: does that repair wrong class choices?
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Object and cue produce a logit
- Temperature-scaled score
- Error: predicted class differs from truth
Exact values are in the point inspector
Color denotes a category, not magnitude.
Inspect the selected point
What the plot shows
Group examples by confidence in bins of width 0.2. A point below the diagonal means that group is overconfident. Forty authored examples have little diversity; this explains the calculation, not real-data calibration.
- Confidence equals frequency
- Current-set bins
- Bin 1: 0.7484; 1
- Bin 2: 0.8438; 1
Accuracy checks classes. Calibration compares confidence with observed correctness frequency. Temperature preserves class choice: a less confident wrong answer remains wrong. Do not use the independent final test to tune weights or temperature.
- Correct out of 40
- 40
- Mean confidence
- 0.7961
- Binned calibration error
- 0.2039
Parameters and details
Each cell is one authored scene, not one image pixel. The first set correlates cue and class; the second reverses that relation. Rule and threshold stay fixed. This small test demonstrates distribution shift, not a real network benchmark. Temperature is chosen manually here, not fitted to test labels.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Confidence, data and reproducibility
Softmax or sigmoid returns a number in 0…1, but this is not yet a validated probability. Calibration compares stated confidence with correctness frequencies on independent data. Data ambiguity and model uncertainty are different sources. An unknown original does not permit an honest reference PSNR against that original.
Split by independent people, scenes or time when that matches deployment. Duplicates and nearly identical neighboring frames across train and test create leakage. Record weight version, preprocessing, thresholds, data source and subgroup metrics. An ablation changes one component to test its contribution; a high aggregate score does not remove local failures.
Quantization reduces numerical precision and can reduce size/cost, but needs renewed quality tests and actual memory/latency measurements. Local processing avoids server upload only if the code actually sends no file. Neither watermarking nor synthetic-image detection universally proves the origin of every image.
Practice
Test the idea under another condition. Follow the task above the images; point inspection helps explain the result. This exploration is not scored.
Repair class choice or only change confidence?
Cue correlation is reversed. First change temperature: does the count correct out of 40 change? Then remove cue weight. Explain which action changed the choice rule and which changed only confidence. In an actual project make these choices on validation data and use the independent final test only after fixing the procedure.
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Object and cue produce a logit
- Temperature-scaled score
- Error: predicted class differs from truth
Exact values are in the point inspector
Color denotes a category, not magnitude.
Inspect the selected point
What the plot shows
Group examples by confidence in bins of width 0.2. A point below the diagonal means that group is overconfident. Forty authored examples have little diversity; this explains the calculation, not real-data calibration.
- Confidence equals frequency
- Current-set bins
- Bin 1: 0.5497; 0.1667
- Bin 2: 0.6844; 0
Accuracy checks classes. Calibration compares confidence with observed correctness frequency. Temperature preserves class choice: a less confident wrong answer remains wrong. Do not use the independent final test to tune weights or temperature.
- Correct out of 40
- 2
- Mean confidence
- 0.644
- Binned calibration error
- 0.594
Parameters and details
Each cell is one authored scene, not one image pixel. The first set correlates cue and class; the second reverses that relation. Rule and threshold stay fixed. This small test demonstrates distribution shift, not a real network benchmark. Temperature is chosen manually here, not fitted to test labels.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Games
Test your explanation
Question 1 of 5
Does score 0.99 alone establish a 99% chance of correctness?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Color denotes a category, not magnitude.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Color denotes a category, not magnitude.
Choose one answer. It is checked immediately.
Limitations and references
Limits of this example
The hand-written classifier is a transparent counterexample, not a trained system or real-world accuracy estimate. This lesson is not model certification, a universal forgery detector or a device benchmark.