# Which Numbers Can I Act On?

Class 16, Chapter 8: Seeing Movement: Video and Pose Estimation. 26 slides, about 33.5 minutes.

## 1. Title

Slide up while people sit down; homework sixteen is due now. On Tuesday we found four places where error enters between a joint and a number. Today we turn that into decisions: which numbers to trust, how to check a clip in two minutes, how to build your own overlay, and what to say to the athlete.

## 2. Tuesday in one slide: four levels of error  (2 min)

A one-slide recap of Tuesday. Error enters at four levels between a real joint and a number in a report. Landmark: the model put the dot in the wrong place. You reduce it with light, framing, clothing, a better model, and by looking at the overlay. Projection: the camera flattens three dimensions into two, and only camera placement fixes it. Event: an event can be a frame early or late, and the wrong capture rate multiplies every time. And interpretation, the only one that a better camera and model leave exactly where it was. Today we sort results by how many of these four levels they inherit.

## 3. Three levels of trust  (3 min)

The four levels do not weigh equally on every result, and that gives a simple ordering. Level one, most trusted: counts, durations and ratios. Cadence needs no scale and does not care how far away the camera is; it only needs the right capture rate. Level two: angles in the plane the camera is square to, like knee flexion from the side. Landmark error enters in full. Level three, least trusted: front-view tilts and anything in metres, which inherit all four levels plus the scale. Read it as a rule for decisions. A level-three number is a trend within one athlete, filmed the same way, checked against a tape before you compare it with anyone else.

## 4. Which result is the most trusted?  (1.5 min)

[Thirty seconds, then hands.] The answer is D, cadence. It is a count of steps over a time. It needs no scale and does not change if the camera is a metre nearer or farther. A, stride length, needs a scale, and a scale from stature carries its own error, so level three. B is a trap: pelvic drop is a front-view tilt, and a side view cannot see it at all. C is a level-two angle, but thirty degrees off square adds a real projection error. Notice that the most trusted number here is also the least glamorous. That is common.

## 5. Five checks, two minutes  (2.5 min)

Before you analyze a clip, or before you believe the report, spend two minutes on five checks. The clock: what rate was it filmed at, and what does the file say? The view: is the camera still and square, is the whole body in frame the whole time? The person: in what share of frames was a person found, and does the confidence stay up through the part you care about? The overlay: step through the key frames with the skeleton on. Is every dot you will use on the right limb, on the right side? That check catches what confidence cannot. And the claim: does the number belong to a level of trust that supports the decision?

## 6. Two clips through the five checks  (2.5 min)

Here are the book's two clips through the five checks. The sketched runner: the clock is right, but one frame is thirty three milliseconds, coarse for foot contact. The view is good. A person is found in nearly every frame. But the overlay shows frame thirty, where the nano model loses both legs at high confidence. Verdict: good for cadence and trunk angles, knee angles only with the small model and after looking. The back flip: every time times a quarter. The legs vanish into the dark exactly at takeoff and landing, the two frames that define flight. Verdict: mark those frames by eye. Notice that both verdicts are partial. That is normal.

## 7. Check the AI: confidence is not an error bar  (2 min)

[Give pairs a minute to find the flaw.] This sentence sounds careful. It has a number, a percentage and a unit. [Click.] The flaw is turning a confidence score into an error bar. Confidence says how sure the model is that a point is visible and where it put it. It says nothing about metres. And stride length is a level-three number: its error comes mostly from the scale, the stature and the reference, and from projection, with swaps at the feet on top. The better sentence gives the number to the precision it deserves and a way to check it with a tape measure. When an assistant attaches a percentage, ask where the percentage came from.

## 8. The canvas app: a measure is an expression  (2 min)

Most apps report a fixed list of measures. The canvas app lets you write your own. A measure is an expression over named keypoints. Angle of a, b, c is the included angle at b. Distance is a length. Line angle is a tilt. Knee flexion is a hundred and eighty minus the included angle at the knee. Each value carries the lowest confidence of its inputs, so a measure is only as trustworthy as its weakest point. And here is the habit to build: the whole set of definitions, with the model, threshold, frame rate and scale, saves to a file. Keep the file. It lets anyone run the same measure on next month's video.

## 9. A knee angle by hand  (2.5 min)

[Ask everyone to sketch the three points on paper first.] These are the small model's hip, knee and ankle in frame thirty. Remember that image y grows downward. Before any arithmetic: is the angle at the knee nearer forty five, ninety or a hundred and thirty five degrees? [Take answers, then click.] The dot product is seven hundred and thirty nine, small compared with the product of the lengths, so the cosine is almost zero and the angle is almost a right angle: eighty nine point three degrees, ninety point seven of flexion. A sketch would have told you that before the calculator. Print Figure 8.3 and lay a protractor on it; you should read the same angle within a degree or two.

## 10. Check it by hand: why the Hip drop app uses a band  (2.5 min)

The pelvis is narrow, and that is the problem. Two points w apart, each with an independent error sigma: the tilt error is root two sigma over w, because variances add. Two hip keypoints a hundred pixels apart with five pixels of error each give four degrees of noise, as big as the pelvic drop a coach is looking for. So the Hip drop app does not use pose keypoints at all. You wear a bright band; the app finds it by color and measures its tilt. Four hundred pixels instead of one hundred cuts the error by four. [Everyone computes the example.] Thirty two over four hundred, arctangent: four point five seven degrees. The price: the app measures the band, not the bones.

## 11. Range of motion: flexion, repetitions, no grades  (1.5 min)

The Range of motion app is the canvas idea with the measures chosen for you. It reports flexion as a hundred and eighty minus the included angle, so a straight knee is zero, and an included angle of fifty five degrees is a hundred and twenty five of flexion. It finds the repetitions and reports the range. It grades nothing, and it is not a clinical test. Its capture instruction: the leg you care about closest to the camera, three slow bends, hold each end about a second. If you did Exercise 8.9 for today, your protractor reading should be within about five degrees of the app's. If it was not, which of the four levels explains the gap?

## 12. Build Lab B-8: your own overlay  (3 min)

This week's build step is the fourth check, in code: a page that plays a video, steps one frame at a time, and draws the keypoints from a results file. These are the two pure functions at its heart, kept free of the page so they can be tested in Node. Frame at turns a time into a frame number. Draw pose draws each bone, and skips any bone with an end below the confidence threshold, exactly as the apps do. Use the usual cycle: specify, including one input that should fail; generate, with an assistant or by hand; verify with the known answers on the right; and defend every line you keep. When it works, frame thirty should match Figure 8.3.

## 13. Two details decide whether the overlay lines up  (1.5 min)

Two details decide whether your overlay lines up with the body. First, step on the stored clock. This is the one place where the stored rate is the right one: the CSV counts frames in the file, so frame k sits at k over the stored rate, whatever the camera recorded at. And seek to the middle of the frame, not its start, because a seek that lands exactly on a boundary can show the previous frame. Second, size the drawing canvas in video pixels and let the page scale it. Then the knee from the CSV lands on the knee on a phone or a projector. Times you report use the capture rate; stepping uses the stored rate.

## 14. Telling the athlete: a good report  (2.5 min)

Your athlete filmed a set of knee bends after a layoff. Left a hundred and eighteen, right a hundred and twenty six. [Read the box aloud, slowly.] Look at what this does. It states the numbers, rounded to what the video supports. It gives the precision: a few degrees each, so the eight-degree gap is probably real but not exact. It says what the numbers do not show, why, and that this is not a medical assessment, with a referral if anything hurts. It gives one action. And it sets the retest: same bends, same camera spot, in two weeks. Five parts, five sentences.

## 15. The poor version, line by line  (1.5 min)

Now the poor version. [Let them read it; ask what is wrong before you go down the table.] One hundred and eighteen point four degrees gives a decimal place the video cannot support; we said each number could be off by a few degrees. Restricted mobility and injury risk turns a measurement into a diagnosis and a prediction. That is the fourth level of error, interpretation, and no camera fixes it. Mobility work at the hip and ankle does not follow from a knee number at all. And it leaves out the precision, the limits, and the retest. It sounds more expert, and it is worse.

## 16. Chapter 8 in five lines  (1.5 min)

Chapter 8 in five lines. A video is a table, and one frame is the finest time step. Keep the two clocks apart: every time and speed uses the capture rate. A pose model returns seventeen dots and a confidence each; the confidence screens out bad frames but does not prove a dot is right, so look at the overlay. A scale lives in one plane. And four levels of error give three levels of trust: timing first, angles in the plane next, front-view tilts and metres last. Next week we use all of this on the movement every app in this course was first built for: running.

## 17. Before Class 17  (1.5 min)

Homework seventeen is due at the start of Tuesday's class. Take two running clips, one from the side and one from behind; the case files have both if you would rather not film anyone. Run the pose model, then check five frames of each by hand, including two hard ones, like a foot contact and the legs crossing. Report the four levels of error and a trust level for each measure. It includes the build step, your overlay. Bring a phone, a tripod, a metronome app, a tape measure and running shoes. And read Chapter 9, sections one to six: gait, and finding the events in a stride.
