---
name: face-search-automation
description: Use when a person photo must be identified via face search.
---

Use when the owner sends a photo of a person and wants them identified via face search. Runs free face-search systems in order, then verifies hits with local ArcFace before reporting.

## Workflow
1. Copy image to /tmp/face.jpg, confirm a face exists (cv2 Haar cascade via /usr/bin/python3.12).
2. **Yandex first** (yandex.com/images): js-click `.HeaderDesktopActions-CbirButton`, find `input.CbirCore-FileInput` via `cdp('DOM.getDocument', depth=-1, pierce=True)`, set with `cdp('DOM.setFileInputFiles', files=['/tmp/face.jpg'], nodeId=N)`. Yandex fires change natively. Collect tabs „Similar images" + „Sites" (selector `.CbirSites-Item`, links contain img_url and source page).
3. Google Lens: images.google.com → click `.etxtjc` → set `input[name=encoded_image]` (DataTransfer + input/change events). Often blocked by IP-level /sorry/ reCAPTCHA — don't burn time, move on.
4. Search4Faces: drive `assets/php/upload.php` (POST raw file) then `assets/php/detect.php` (POST JSON {query: hidden #query value, source, results, lang, filename, boundings: first 4 values × scale}) via page-context fetch — bypasses their broken uppload UI. >95% = identity, ~87% = lookalike only.
5. PimEyes: file input accepts DataTransfer set + change events, triggers POST /api/face, but the search then needs a Prosopo frictionless captcha that fails under automation (endless provider retry). Expect no results from automated browsers.
6. FaceCheck.id: `input#fileElem` + `handleFiles(inp.files)` global works; also tick `#iagree_main` before clicking #searchButton. Blocks bots with TEMP_BAN for days after a few automated runs.
7. **Verify every candidate hit locally with ArcFace** — key step; image-search engines return lookalikes, not identities:
   - `/usr/bin/python3.12` (has opencv-python-headless + insightface via pip --user --break-system-packages)
   - YuNet detect (yunet.onnx from opencv_zoo, media.githubusercontent.com LFS URL) + SFace `alignCrop` for 112×112 alignment, then `arc.get_feat` from buffalo_l w600k_r50.onnx (skip FaceAnalysis — its own detector misses some faces).
   - Cosine thresholds (calibrated): same person ≥ ~0.40 (typ. 0.45–0.65), lookalike 0.10–0.30, unrelated <0.10. Always calibrate with the hit's own photos cross-compared.
8. Write results to /home/marcel7364/gesicht-identifikation.md; save evidence photos to /home/marcel7364/gesichtssuche-bilder/. Never pay (report costs and wait).

## Pitfalls
- Shared default browser session gets hijacked by other agents' tabs — use a named `session` (e.g. session="gesichtssuche") for browser_exec.
- Site ad scripts auto-redirect tabs; block with `cdp('Network.setBlockedURLs', urls=["*doubleclick.net*", ...])` after `Network.enable`.
- js() can't send >~40 KB strings — push base64 in 40 000-char chunks into window.__b64parts, rebuild with atob.
- DOM.setFileInputFiles works on plain-JS pages (Yandex), but React/Vue dropzones need DataTransfer + input/change events (or calling page globals like handleFiles).