Document margin behavior and update model comparison script

- Add section explaining how margin works differently in multi-ref vs
  margin-only matching, with examples showing why margin-only fails
  when using multiple references per logo
- Update run_model_comparison.sh to use optimal threshold (0.70) and
  margin (0.05) based on test results
- Add DINOv2 Large model test to comparison script
- Add threshold optimization test analysis to results document
This commit is contained in:
Rick McEwen
2026-01-02 14:42:53 -05:00
parent 48d9145810
commit 2c41549ae0
3 changed files with 179 additions and 3 deletions

View File

@ -13,8 +13,8 @@ REFS_PER_LOGO=10
POSITIVE_SAMPLES=20
NEGATIVE_SAMPLES=100
MIN_MATCHING_REFS=3
THRESHOLD=0.80
MARGIN=0.10
THRESHOLD=0.70
MARGIN=0.05
SEED=42
# Clear output file and write header
@ -82,11 +82,29 @@ uv run python "$SCRIPT_DIR/test_logo_detection.py" \
--clear-cache \
--output-file "$OUTPUT_FILE"
echo ""
# Test 3: DINOv2 Large
echo "=== Test 3: DINOv2 Large (facebook/dinov2-large) ==="
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 \
--threshold $THRESHOLD \
--margin $MARGIN \
--seed $SEED \
--embedding-model "facebook/dinov2-large" \
--clear-cache \
--output-file "$OUTPUT_FILE"
echo ""
echo "Results saved to: $OUTPUT_FILE"
echo ""
echo "Note: You can also try other models:"
echo " - facebook/dinov2-base"
echo " - facebook/dinov2-large"
echo " - openai/clip-vit-base-patch32"
echo " - openai/clip-vit-large-patch14-336"