MacBook pro commited on
Commit ·
ee8b5b5
1
Parent(s): 9457f1e
feat(pipeline): ensure model dir tracked without weights; update swap pipeline changes
Browse files- models/inswapper/.gitkeep +1 -0
- swap_pipeline.py +14 -14
models/inswapper/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Keeps the inswapper model directory structure without committing large weight files.
|
swap_pipeline.py
CHANGED
|
@@ -82,20 +82,20 @@ class FaceSwapPipeline:
|
|
| 82 |
self.low_brightness_threshold = float(os.getenv('MIRAGE_LOW_BRIGHTNESS_THRESH', '40'))
|
| 83 |
# Similarity threshold for logging (cosine similarity typical range [-1,1])
|
| 84 |
self.similarity_warn_threshold = float(os.getenv('MIRAGE_SIMILARITY_WARN', '0.15'))
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
|
| 100 |
def initialize(self):
|
| 101 |
if self.initialized:
|
|
|
|
| 82 |
self.low_brightness_threshold = float(os.getenv('MIRAGE_LOW_BRIGHTNESS_THRESH', '40'))
|
| 83 |
# Similarity threshold for logging (cosine similarity typical range [-1,1])
|
| 84 |
self.similarity_warn_threshold = float(os.getenv('MIRAGE_SIMILARITY_WARN', '0.15'))
|
| 85 |
+
# Temporal reuse configuration
|
| 86 |
+
self.face_cache_ttl = int(os.getenv('MIRAGE_FACE_CACHE_TTL', '5') or '5') # frames
|
| 87 |
+
self._cached_face = None
|
| 88 |
+
self._cached_face_age = 0
|
| 89 |
+
# Aggressive blend toggle for visibility
|
| 90 |
+
self.aggressive_blend = os.getenv('MIRAGE_AGGRESSIVE_BLEND', '0').lower() in ('1','true','yes','on')
|
| 91 |
+
# Optional face ROI upscaling for tiny faces
|
| 92 |
+
self.face_min_size = int(os.getenv('MIRAGE_FACE_MIN_SIZE', '80') or '80')
|
| 93 |
+
self.face_upscale_factor = float(os.getenv('MIRAGE_FACE_UPSCALE', '1.6'))
|
| 94 |
+
# Detector preprocessing (CLAHE) low light
|
| 95 |
+
self.det_clahe = os.getenv('MIRAGE_DET_CLAHE', '1').lower() in ('1','true','yes','on')
|
| 96 |
+
# End-to-end latency markers
|
| 97 |
+
self._last_e2e_ms = None
|
| 98 |
+
self._e2e_hist: List[float] = []
|
| 99 |
|
| 100 |
def initialize(self):
|
| 101 |
if self.initialized:
|