Add simple matching method as baseline for comparison tests

- Add find_all_matches() method to DetectLogosDETR that returns all
  logos above similarity threshold without any rejection logic
- Add --matching-method simple option to test script
- Update run_comparison_tests.sh to include simple matching as Test 1
- Update documentation to describe simple matching method
This commit is contained in:
Rick McEwen
2025-12-31 17:36:18 -05:00
parent 197e007591
commit 41bc0c701f
5 changed files with 174 additions and 40 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Run logo detection tests with all three matching methods and save results.
# Run logo detection tests with all four matching methods and save results.
#
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ -30,8 +30,22 @@ echo " Min matching refs: $MIN_MATCHING_REFS"
echo " Seed: $SEED"
echo ""
# Test 1: Margin-based matching
echo "=== Test 1: Margin-based matching ===" | tee -a "$OUTPUT_FILE"
# Test 1: Simple matching (baseline - all matches above threshold)
echo "=== Test 1: Simple matching (baseline) ===" | tee -a "$OUTPUT_FILE"
uv run python "$SCRIPT_DIR/test_logo_detection.py" \
--num-logos $NUM_LOGOS \
--refs-per-logo $REFS_PER_LOGO \
--positive-samples $POSITIVE_SAMPLES \
--negative-samples $NEGATIVE_SAMPLES \
--matching-method simple \
--seed $SEED \
2>&1 | tee -a "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
# Test 2: Margin-based matching
echo "=== Test 2: Margin-based matching ===" | tee -a "$OUTPUT_FILE"
uv run python "$SCRIPT_DIR/test_logo_detection.py" \
--num-logos $NUM_LOGOS \
--refs-per-logo $REFS_PER_LOGO \
@ -44,8 +58,8 @@ uv run python "$SCRIPT_DIR/test_logo_detection.py" \
echo "" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
# Test 2: Multi-ref with mean similarity
echo "=== Test 2: Multi-ref matching (mean similarity) ===" | tee -a "$OUTPUT_FILE"
# Test 3: Multi-ref with mean similarity
echo "=== Test 3: Multi-ref matching (mean similarity) ===" | tee -a "$OUTPUT_FILE"
uv run python "$SCRIPT_DIR/test_logo_detection.py" \
--num-logos $NUM_LOGOS \
--refs-per-logo $REFS_PER_LOGO \
@ -59,8 +73,8 @@ uv run python "$SCRIPT_DIR/test_logo_detection.py" \
echo "" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
# Test 3: Multi-ref with max similarity
echo "=== Test 3: Multi-ref matching (max similarity) ===" | tee -a "$OUTPUT_FILE"
# Test 4: Multi-ref with max similarity
echo "=== Test 4: Multi-ref matching (max similarity) ===" | tee -a "$OUTPUT_FILE"
uv run python "$SCRIPT_DIR/test_logo_detection.py" \
--num-logos $NUM_LOGOS \
--refs-per-logo $REFS_PER_LOGO \