#!/bin/bash # # Run logo detection tests with all four matching methods and save results. # SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" OUTPUT_FILE="${SCRIPT_DIR}/comparison_results.txt" # Common parameters NUM_LOGOS=20 REFS_PER_LOGO=10 POSITIVE_SAMPLES=20 NEGATIVE_SAMPLES=100 MIN_MATCHING_REFS=3 # Use a fixed seed for reproducibility across methods SEED=42 echo "Logo Detection Comparison Tests" > "$OUTPUT_FILE" echo "================================" >> "$OUTPUT_FILE" echo "Date: $(date)" >> "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" echo "Running tests with:" echo " Reference logos: $NUM_LOGOS" echo " Refs per logo: $REFS_PER_LOGO" echo " Positive samples: $POSITIVE_SAMPLES" echo " Negative samples: $NEGATIVE_SAMPLES" echo " Min matching refs: $MIN_MATCHING_REFS" echo " Seed: $SEED" echo "" # 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 \ --positive-samples $POSITIVE_SAMPLES \ --negative-samples $NEGATIVE_SAMPLES \ --matching-method margin \ --seed $SEED \ 2>&1 | tee -a "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" echo "" >> "$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 \ --positive-samples $POSITIVE_SAMPLES \ --negative-samples $NEGATIVE_SAMPLES \ --matching-method multi-ref \ --min-matching-refs $MIN_MATCHING_REFS \ --seed $SEED \ 2>&1 | tee -a "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" echo "" >> "$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 \ --positive-samples $POSITIVE_SAMPLES \ --negative-samples $NEGATIVE_SAMPLES \ --matching-method multi-ref \ --min-matching-refs $MIN_MATCHING_REFS \ --use-max-similarity \ --seed $SEED \ 2>&1 | tee -a "$OUTPUT_FILE" echo "" echo "Results saved to: $OUTPUT_FILE"