Skip to content

Fix hard-coded identity_scores dimensions in identity accuracy tests#3045

Merged
MMathisLab merged 3 commits intomwm/humanbodyfrom
copilot/fix-d03f3e42-9c35-4de4-bce3-4f3206959930
Jul 5, 2025
Merged

Fix hard-coded identity_scores dimensions in identity accuracy tests#3045
MMathisLab merged 3 commits intomwm/humanbodyfrom
copilot/fix-d03f3e42-9c35-4de4-bce3-4f3206959930

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 5, 2025

Problem

The tests in tests/core/metrics/test_meitrcs_identity_accuracy.py were failing due to hard-coded identity_scores arrays that didn't match the number of individuals in the test cases. Specifically, one test case with 3 individuals had identity_scores arrays with only 2 values instead of 3, causing dimension mismatches.

Root Cause

The compute_identity_scores function expects identity_scores with shape (num_assemblies, num_bodyparts, num_individuals), but the test data had:

{
    "individuals": ["i1", "i2", "i3"],  # 3 individuals
    "identity_scores": {
        "img0.png": [
            [[0.7, 0.3], [0.6, 0.2]],  # Only 2 values, should be 3!
            # ...
        ],
    },
}

This created a shape mismatch: (3, 2, 2) instead of the expected (3, 2, 3).

Solution

Fixed the hard-coded test data by adding the missing third value to match the number of individuals:

{
    "individuals": ["i1", "i2", "i3"],  # 3 individuals  
    "identity_scores": {
        "img0.png": [
            [[0.7, 0.3, 0.0], [0.6, 0.2, 0.2]],  # Now has 3 values ✓
            [[0.6, 0.3, 0.1], [0.6, 0.2, 0.2]], 
            [[0.6, 0.3, 0.1], [0.6, 0.2, 0.2]], 
        ],
    },
}

Validation

  • ✅ All 7 test cases in test_meitrcs_identity_accuracy.py now have correct dimensions
  • ✅ Verified that 2-individual test cases remain correct with 2-element arrays
  • ✅ Tested the fix works with 2, 3, and 4 individuals dynamically
  • ✅ Confirmed test_apis_evaluate.py already uses proper dynamic data generation

Impact

  • Tests should now pass without dimension-related failures
  • No functional logic changed, only test data corrected
  • Maintains backward compatibility for all existing functionality
  • Enables proper testing of identity accuracy across different numbers of individuals

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@MMathisLab MMathisLab changed the base branch from main to mwm/humanbody July 5, 2025 19:15
Copilot AI changed the title [WIP] Fix failing tests by removing hard-coded number of individuals Fix hard-coded identity_scores dimensions in identity accuracy tests Jul 5, 2025
Copilot AI requested a review from MMathisLab July 5, 2025 19:26
@MMathisLab MMathisLab marked this pull request as ready for review July 5, 2025 19:34
@MMathisLab
Copy link
Copy Markdown
Member

The file name has a typo: test_meitrcs_identity_accuracy.py ~> metric ... @copilot please fix this

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jul 5, 2025

The file name has a typo: test_meitrcs_identity_accuracy.py ~> metric ... @copilot please fix this

Fixed the typo in the filename: test_meitrcs_identity_accuracy.py → test_metrics_identity_accuracy.py (ba67f83)

Copilot AI requested a review from MMathisLab July 5, 2025 19:38
@MMathisLab MMathisLab merged commit 9286699 into mwm/humanbody Jul 5, 2025
1 check passed
@MMathisLab MMathisLab deleted the copilot/fix-d03f3e42-9c35-4de4-bce3-4f3206959930 branch July 6, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants