Bird
Raised Fist0
Computer Visionml~8 mins

Action recognition basics in Computer Vision - Model Metrics & Evaluation

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Metrics & Evaluation - Action recognition basics
Which metric matters for Action Recognition and WHY

In action recognition, we want to know how well the model identifies the correct action from videos or image sequences. The main metric is accuracy, which tells us the percentage of correctly predicted actions out of all attempts.

However, accuracy alone can be misleading if some actions happen more often than others. So, we also use precision and recall for each action class to understand if the model is good at finding the right actions without too many mistakes.

Precision tells us: When the model says an action happened, how often is it right?

Recall tells us: Out of all times an action actually happened, how many did the model find?

Finally, the F1 score balances precision and recall, giving a single number to compare models.

Confusion Matrix Example

Imagine a model recognizing three actions: Walking, Running, and Jumping. Here is a confusion matrix showing predictions vs actual actions:

          Predicted
          W   R   J
    A  W 50  2   3
    c  R  4 45   1
    t  J  2  3  40
    u
    a
    l
    

Explanation:

  • 50 times the model correctly predicted Walking (True Positives for Walking)
  • 2 times it predicted Running when it was actually Walking (False Positives for Running)
  • 3 times it predicted Jumping when it was actually Walking (False Positives for Jumping)
  • And so on for other actions.
Precision vs Recall Tradeoff with Examples

In action recognition, sometimes we want to catch every instance of an action (high recall). For example, in security, missing a suspicious action is bad.

Other times, we want to be sure the detected action is really correct (high precision). For example, in sports analysis, wrongly labeling a move can confuse coaches.

Improving recall may lower precision because the model guesses more actions, including wrong ones. Improving precision may lower recall because the model is more careful and misses some actions.

Choosing which to prioritize depends on the use case.

What Good vs Bad Metric Values Look Like

Good metrics:

  • Accuracy above 85% means the model is mostly correct.
  • Precision and recall above 80% for each action means the model finds actions well and is usually right.
  • F1 scores close to precision and recall show balance.

Bad metrics:

  • Accuracy below 60% means many wrong predictions.
  • Precision very low (e.g., 40%) means many false alarms.
  • Recall very low (e.g., 30%) means many missed actions.
  • Big gaps between precision and recall show the model is biased toward guessing or being too cautious.
Common Pitfalls in Metrics for Action Recognition
  • Accuracy paradox: If one action is very common, a model guessing only that action can have high accuracy but poor usefulness.
  • Data leakage: If training and test videos overlap, metrics look better but the model won't work well on new videos.
  • Overfitting: Very high training accuracy but low test accuracy means the model memorized training videos, not learned actions.
  • Ignoring class imbalance: Not checking precision and recall per action hides poor performance on rare actions.
Self Check

Your action recognition model has 98% accuracy but only 12% recall on the action "Running." Is it good for production?

Answer: No, it is not good. The model misses most "Running" actions (low recall), even if overall accuracy is high. This means it often fails to detect "Running," which could be critical depending on the application.

Key Result
In action recognition, balanced precision and recall per action class are key to reliable performance beyond overall accuracy.

Practice

(1/5)
1. What is the main goal of action recognition in computer vision?
easy
A. To generate captions for images
B. To detect objects in images
C. To enhance image resolution
D. To identify human movements in videos

Solution

  1. Step 1: Understand the purpose of action recognition

    Action recognition focuses on understanding what actions or movements humans perform in videos.
  2. Step 2: Compare with other tasks

    Detecting objects, generating captions, or enhancing resolution are different tasks unrelated to recognizing actions.
  3. Final Answer:

    To identify human movements in videos -> Option D
  4. Quick Check:

    Action recognition = Identify human movements [OK]
Hint: Action recognition = understanding human movements in videos [OK]
Common Mistakes:
  • Confusing action recognition with object detection
  • Thinking it generates image captions
  • Assuming it improves image quality
2. Which of the following is the correct way to represent a video input for an action recognition model?
easy
A. A sequence of image frames
B. A single grayscale image
C. A text description of the action
D. A 1D audio signal

Solution

  1. Step 1: Identify video data format

    Videos are made of many image frames shown in order, so a sequence of frames is the correct input.
  2. Step 2: Eliminate incorrect options

    A single image or text or audio does not represent the full video needed for action recognition.
  3. Final Answer:

    A sequence of image frames -> Option A
  4. Quick Check:

    Video input = sequence of frames [OK]
Hint: Videos = many frames in order, not single images [OK]
Common Mistakes:
  • Using a single image instead of multiple frames
  • Confusing video input with text or audio
  • Ignoring the temporal sequence of frames
3. Consider this Python snippet for extracting features from video frames for action recognition:
features = []
for frame in video_frames:
    feat = extract_features(frame)
    features.append(feat)
print(len(features))
If video_frames contains 10 frames, what will be the output?
medium
A. 10
B. 9
C. 0
D. Error

Solution

  1. Step 1: Understand the loop over frames

    The loop runs once for each frame in video_frames, which has 10 frames.
  2. Step 2: Count how many features are appended

    Each iteration appends one feature, so after 10 iterations, features has length 10.
  3. Final Answer:

    10 -> Option A
  4. Quick Check:

    Number of frames = features length = 10 [OK]
Hint: One feature per frame means length equals number of frames [OK]
Common Mistakes:
  • Off-by-one errors counting features
  • Assuming extract_features returns multiple items
  • Thinking the list is empty before print
4. You have this code snippet for action recognition training:
for video, label in dataset:
    features = extract_features(video)
    prediction = model.predict(features)
    loss = loss_function(prediction, label)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
The training loss does not decrease after many epochs. What is a likely error?
medium
A. Optimizer step is missing
B. Loss function is not called
C. Features are extracted frame-by-frame but model expects video clips
D. Labels are not used in prediction

Solution

  1. Step 1: Analyze feature extraction and model input

    If features are extracted frame-by-frame but the model expects a clip (multiple frames together), the input shape mismatch can cause poor learning.
  2. Step 2: Check other training steps

    Loss function is called, optimizer steps are present, and labels are used in loss, so these are correct.
  3. Final Answer:

    Features are extracted frame-by-frame but model expects video clips -> Option C
  4. Quick Check:

    Input shape mismatch = training loss stuck [OK]
Hint: Check if model input matches feature extraction format [OK]
Common Mistakes:
  • Ignoring input shape mismatch
  • Assuming loss or optimizer calls are missing
  • Not verifying label usage in loss
5. You want to improve an action recognition model that uses only spatial features from single frames. Which approach is best to capture motion information?
hard
A. Train on grayscale frames instead of color
B. Use 3D convolutional neural networks on video clips
C. Add dropout layers to the model
D. Increase image resolution of single frames

Solution

  1. Step 1: Understand spatial vs temporal features

    Spatial features come from single frames; motion requires temporal features across frames.
  2. Step 2: Identify model type capturing motion

    3D CNNs process multiple frames together, capturing motion and temporal info effectively.
  3. Step 3: Evaluate other options

    Increasing resolution, dropout, or grayscale do not add motion info.
  4. Final Answer:

    Use 3D convolutional neural networks on video clips -> Option B
  5. Quick Check:

    3D CNNs capture motion = better action recognition [OK]
Hint: Motion needs temporal models like 3D CNNs, not just images [OK]
Common Mistakes:
  • Thinking higher resolution adds motion info
  • Confusing regular CNNs with 3D CNNs
  • Ignoring temporal dimension in videos