Spaces:
Runtime error
Runtime error
Upload 142 files
Browse filesThis view is limited to 50 files because it contains too many changes. 聽
See raw diff
- .gitattributes +7 -0
- __pycache__/audio.cpython-311.pyc +0 -0
- audio_processing/__init__.py +1 -0
- audio_processing/__pycache__/__init__.cpython-311.pyc +0 -0
- audio_processing/__pycache__/audio.cpython-311.pyc +0 -0
- audio_processing/audio.py +96 -0
- checkpoints/wav2lip_gan.pth +3 -0
- face_detection/__init__.py +1 -0
- face_detection/__pycache__/__init__.cpython-311.pyc +0 -0
- face_detection/__pycache__/api.cpython-311.pyc +0 -0
- face_detection/__pycache__/utils.cpython-311.pyc +0 -0
- face_detection/api.py +163 -0
- face_detection/detection/__init__.py +1 -0
- face_detection/detection/__pycache__/__init__.cpython-311.pyc +0 -0
- face_detection/detection/sfd/__init__.py +2 -0
- face_detection/detection/sfd/__pycache__/__init__.cpython-311.pyc +0 -0
- face_detection/detection/sfd/__pycache__/net_s3fd.cpython-311.pyc +0 -0
- face_detection/detection/sfd/__pycache__/s3fd.cpython-311.pyc +0 -0
- face_detection/detection/sfd/__pycache__/sfd_detector.cpython-311.pyc +0 -0
- face_detection/detection/sfd/net_s3fd.py +135 -0
- face_detection/detection/sfd/s3fd.pth +3 -0
- face_detection/detection/sfd/s3fd.py +135 -0
- face_detection/detection/sfd/sfd_detector.py +190 -0
- face_detection/utils.py +22 -0
- input/face.png +3 -0
- logs/app_20250226_094827.log +3 -0
- logs/app_20250226_094841.log +3 -0
- logs/app_20250226_094858.log +3 -0
- logs/app_20250226_094922.log +6 -0
- logs/app_20250226_094927.log +4 -0
- logs/app_20250226_094932.log +2 -0
- logs/app_20250226_095219.log +3 -0
- logs/app_20250226_095243.log +3 -0
- logs/app_20250226_095311.log +3 -0
- logs/app_20250226_095318.log +13 -0
- logs/app_20250226_095510.log +3 -0
- logs/app_20250226_095531.log +3 -0
- logs/app_20250226_095539.log +2 -0
- logs/app_20250226_095541.log +34 -0
- logs/app_20250226_095546.log +6 -0
- logs/app_20250226_095743.log +3 -0
- logs/app_20250226_095816.log +3 -0
- logs/app_20250226_095822.log +3 -0
- logs/app_20250226_095846.log +3 -0
- logs/app_20250226_095939.log +26 -0
- logs/app_20250226_100233.log +4 -0
- logs/app_20250226_100252.log +9 -0
- logs/app_20250226_100301.log +72 -0
- logs/app_20250226_100306.log +3 -0
- logs/app_20250226_100438.log +6 -0
.gitattributes
CHANGED
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
input/face.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
static/female.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
static/male.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
temp/result.avi filter=lfs diff=lfs merge=lfs -text
|
40 |
+
temp/temp.wav filter=lfs diff=lfs merge=lfs -text
|
41 |
+
uploads/b79f48b7-26cb-4b71-8bde-f373643576c9.png filter=lfs diff=lfs merge=lfs -text
|
42 |
+
uploads/male.png filter=lfs diff=lfs merge=lfs -text
|
__pycache__/audio.cpython-311.pyc
ADDED
Binary file (6.97 kB). View file
|
|
audio_processing/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .audio import *
|
audio_processing/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (202 Bytes). View file
|
|
audio_processing/__pycache__/audio.cpython-311.pyc
ADDED
Binary file (6.07 kB). View file
|
|
audio_processing/audio.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import librosa
|
2 |
+
import librosa.filters
|
3 |
+
import numpy as np
|
4 |
+
import scipy
|
5 |
+
from scipy.io import wavfile
|
6 |
+
import soundfile as sf
|
7 |
+
import logging
|
8 |
+
|
9 |
+
logger = logging.getLogger(__name__)
|
10 |
+
|
11 |
+
def load_wav(path, sr):
|
12 |
+
try:
|
13 |
+
wav, _ = librosa.core.load(path, sr=sr)
|
14 |
+
return wav
|
15 |
+
except Exception as e:
|
16 |
+
logger.error(f"Error al cargar audio {path}: {str(e)}")
|
17 |
+
raise
|
18 |
+
|
19 |
+
def save_wav(wav, path, sr):
|
20 |
+
try:
|
21 |
+
wav *= 32767 / max(0.01, np.max(np.abs(wav)))
|
22 |
+
wavfile.write(path, sr, wav.astype(np.int16))
|
23 |
+
except Exception as e:
|
24 |
+
logger.error(f"Error al guardar audio {path}: {str(e)}")
|
25 |
+
raise
|
26 |
+
|
27 |
+
def save_wavenet_wav(wav, path, sr):
|
28 |
+
try:
|
29 |
+
sf.write(path, wav.astype(np.float32), sr)
|
30 |
+
except Exception as e:
|
31 |
+
logger.error(f"Error al guardar audio wavenet {path}: {str(e)}")
|
32 |
+
raise
|
33 |
+
|
34 |
+
def preemphasis(wav, k, preemphasize=True):
|
35 |
+
if preemphasize:
|
36 |
+
return scipy.signal.lfilter([1, -k], [1], wav)
|
37 |
+
return wav
|
38 |
+
|
39 |
+
def inv_preemphasis(wav, k, inv_preemphasize=True):
|
40 |
+
if inv_preemphasize:
|
41 |
+
return scipy.signal.lfilter([1], [1, -k], wav)
|
42 |
+
return wav
|
43 |
+
|
44 |
+
def get_hop_size():
|
45 |
+
return 200
|
46 |
+
|
47 |
+
def linearspectrogram(wav):
|
48 |
+
D = _stft(preemphasis(wav, 0.97))
|
49 |
+
S = _amp_to_db(np.abs(D))
|
50 |
+
return _normalize(S)
|
51 |
+
|
52 |
+
def melspectrogram(wav, sr=16000):
|
53 |
+
D = _stft(preemphasis(wav, 0.97))
|
54 |
+
S = _amp_to_db(_linear_to_mel(np.abs(D), sr))
|
55 |
+
|
56 |
+
if np.isnan(S).any():
|
57 |
+
raise ValueError("El espectrograma contiene valores NaN")
|
58 |
+
|
59 |
+
S = _normalize(S)
|
60 |
+
|
61 |
+
# Asegurar dimensiones correctas (80, T)
|
62 |
+
if len(S.shape) == 1:
|
63 |
+
S = S.reshape(80, -1)
|
64 |
+
elif S.shape[0] != 80:
|
65 |
+
S = S.T
|
66 |
+
|
67 |
+
return S
|
68 |
+
|
69 |
+
def _stft(y):
|
70 |
+
n_fft = 800
|
71 |
+
hop_length = 200
|
72 |
+
win_length = 800
|
73 |
+
return librosa.stft(y=y, n_fft=n_fft, hop_length=hop_length, win_length=win_length)
|
74 |
+
|
75 |
+
def _linear_to_mel(spectrogram, sr):
|
76 |
+
_mel_basis = _build_mel_basis(sr)
|
77 |
+
return np.dot(_mel_basis, spectrogram)
|
78 |
+
|
79 |
+
def _build_mel_basis(sr):
|
80 |
+
n_fft = 800
|
81 |
+
n_mels = 80
|
82 |
+
fmin = 80
|
83 |
+
fmax = 7600
|
84 |
+
return librosa.filters.mel(sr=sr, n_fft=n_fft, n_mels=n_mels, fmin=fmin, fmax=fmax)
|
85 |
+
|
86 |
+
def _amp_to_db(x):
|
87 |
+
return 20 * np.log10(np.maximum(1e-5, x))
|
88 |
+
|
89 |
+
def _db_to_amp(x):
|
90 |
+
return np.power(10.0, x * 0.05)
|
91 |
+
|
92 |
+
def _normalize(S):
|
93 |
+
return np.clip((S + 100) / 100, 0, 1)
|
94 |
+
|
95 |
+
def _denormalize(D):
|
96 |
+
return (D * 100) - 100
|
checkpoints/wav2lip_gan.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca9ab7b7b812c0e80a6e70a5977c545a1e8a365a6c49d5e533023c034d7ac3d8
|
3 |
+
size 435801865
|
face_detection/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .api import FaceAlignment, LandmarksType
|
face_detection/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (255 Bytes). View file
|
|
face_detection/__pycache__/api.cpython-311.pyc
ADDED
Binary file (9.85 kB). View file
|
|
face_detection/__pycache__/utils.cpython-311.pyc
ADDED
Binary file (1.68 kB). View file
|
|
face_detection/api.py
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import print_function
|
2 |
+
import os
|
3 |
+
import torch
|
4 |
+
import numpy as np
|
5 |
+
import cv2
|
6 |
+
from enum import Enum
|
7 |
+
from .detection.sfd import SFDDetector
|
8 |
+
import logging
|
9 |
+
from .utils import download_sfd_model
|
10 |
+
|
11 |
+
logger = logging.getLogger(__name__)
|
12 |
+
|
13 |
+
class LandmarksType(Enum):
|
14 |
+
_2D = 1
|
15 |
+
_2halfD = 2
|
16 |
+
_3D = 3
|
17 |
+
|
18 |
+
class NetworkSize(Enum):
|
19 |
+
LARGE = 4
|
20 |
+
|
21 |
+
def __new__(cls, value):
|
22 |
+
member = object.__new__(cls)
|
23 |
+
member._value_ = value
|
24 |
+
return member
|
25 |
+
|
26 |
+
def __int__(self):
|
27 |
+
return self.value
|
28 |
+
|
29 |
+
ROOT = os.path.dirname(os.path.abspath(__file__))
|
30 |
+
|
31 |
+
class FaceAlignment:
|
32 |
+
def __init__(self, path_to_detector=None, device='cuda'):
|
33 |
+
self.device = torch.device(device if torch.cuda.is_available() else 'cpu')
|
34 |
+
self.face_detector = SFDDetector(path_to_detector, device)
|
35 |
+
|
36 |
+
def get_detections_for_batch(self, images):
|
37 |
+
images = np.array(images)
|
38 |
+
if len(images.shape) == 3:
|
39 |
+
images = images[np.newaxis, ...]
|
40 |
+
|
41 |
+
detected_faces = self.face_detector.detect_from_batch(images)
|
42 |
+
results = []
|
43 |
+
|
44 |
+
for i, faces in enumerate(detected_faces):
|
45 |
+
if len(faces) == 0:
|
46 |
+
height, width = images[i].shape[:2]
|
47 |
+
margin_x = int(width * 0.1)
|
48 |
+
margin_y = int(height * 0.1)
|
49 |
+
faces = np.array([[margin_x, margin_y, width-margin_x, height-margin_y, 0.99]], dtype=np.int32)
|
50 |
+
|
51 |
+
faces = faces.astype(np.int32)
|
52 |
+
height, width = images[i].shape[:2]
|
53 |
+
faces[:, 0] = np.clip(faces[:, 0], 0, width - 1)
|
54 |
+
faces[:, 1] = np.clip(faces[:, 1], 0, height - 1)
|
55 |
+
faces[:, 2] = np.clip(faces[:, 2], 1, width)
|
56 |
+
faces[:, 3] = np.clip(faces[:, 3], 1, height)
|
57 |
+
|
58 |
+
results.append(faces)
|
59 |
+
|
60 |
+
return results
|
61 |
+
|
62 |
+
def detect_faces(self, image_or_path, return_single=True):
|
63 |
+
if isinstance(image_or_path, str):
|
64 |
+
try:
|
65 |
+
image = cv2.imdecode(np.fromfile(image_or_path, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
|
66 |
+
if image is None:
|
67 |
+
raise ValueError(f"No se pudo cargar la imagen: {image_or_path}")
|
68 |
+
except Exception as e:
|
69 |
+
logger.error(f"Error al cargar la imagen: {str(e)}")
|
70 |
+
raise
|
71 |
+
else:
|
72 |
+
image = image_or_path.copy()
|
73 |
+
|
74 |
+
if len(image.shape) == 2:
|
75 |
+
image = np.stack((image,)*3, axis=-1)
|
76 |
+
elif image.shape[2] == 4:
|
77 |
+
image = image[..., :3]
|
78 |
+
|
79 |
+
detected_faces = self.face_detector.detect_from_batch(np.array([image]))[0]
|
80 |
+
|
81 |
+
if len(detected_faces) == 0:
|
82 |
+
height, width = image.shape[:2]
|
83 |
+
margin_x = int(width * 0.1)
|
84 |
+
margin_y = int(height * 0.1)
|
85 |
+
detected_faces = np.array([[margin_x, margin_y, width-margin_x, height-margin_y, 0.99]], dtype=np.int32)
|
86 |
+
|
87 |
+
detected_faces = detected_faces.astype(np.int32)
|
88 |
+
height, width = image.shape[:2]
|
89 |
+
detected_faces[:, 0] = np.clip(detected_faces[:, 0], 0, width - 1)
|
90 |
+
detected_faces[:, 1] = np.clip(detected_faces[:, 1], 0, height - 1)
|
91 |
+
detected_faces[:, 2] = np.clip(detected_faces[:, 2], 1, width)
|
92 |
+
detected_faces[:, 3] = np.clip(detected_faces[:, 3], 1, height)
|
93 |
+
|
94 |
+
return detected_faces[0] if return_single else detected_faces
|
95 |
+
|
96 |
+
def get_landmarks(self, image_or_path, detected_faces=None):
|
97 |
+
if isinstance(image_or_path, str):
|
98 |
+
try:
|
99 |
+
image = cv2.imread(image_or_path)
|
100 |
+
if image is None:
|
101 |
+
raise ValueError(f"No se pudo cargar la imagen: {image_or_path}")
|
102 |
+
except Exception as e:
|
103 |
+
logger.error(f"Error al cargar la imagen: {str(e)}")
|
104 |
+
raise
|
105 |
+
else:
|
106 |
+
image = image_or_path.copy()
|
107 |
+
|
108 |
+
if detected_faces is None:
|
109 |
+
detected_faces = self.detect_faces(image, return_single=False)
|
110 |
+
|
111 |
+
if len(detected_faces) == 0:
|
112 |
+
height, width = image.shape[:2]
|
113 |
+
margin_x = int(width * 0.1)
|
114 |
+
margin_y = int(height * 0.1)
|
115 |
+
detected_faces = np.array([[margin_x, margin_y, width-margin_x, height-margin_y, 0.99]], dtype=np.int32)
|
116 |
+
|
117 |
+
landmarks = []
|
118 |
+
for face_d in detected_faces:
|
119 |
+
bbox = face_d[:4].astype(np.int32)
|
120 |
+
frame_with_face = image[bbox[1]:bbox[3], bbox[0]:bbox[2]]
|
121 |
+
|
122 |
+
# Generar landmarks b谩sicos para el rostro
|
123 |
+
face_height = bbox[3] - bbox[1]
|
124 |
+
face_width = bbox[2] - bbox[0]
|
125 |
+
|
126 |
+
# Puntos clave aproximados (68 landmarks)
|
127 |
+
basic_landmarks = np.zeros((68, 2), dtype=np.int32)
|
128 |
+
|
129 |
+
# Ojos
|
130 |
+
eye_y = bbox[1] + int(face_height * 0.35)
|
131 |
+
left_eye_x = bbox[0] + int(face_width * 0.3)
|
132 |
+
right_eye_x = bbox[0] + int(face_width * 0.7)
|
133 |
+
|
134 |
+
# Nariz
|
135 |
+
nose_x = bbox[0] + int(face_width * 0.5)
|
136 |
+
nose_y = bbox[1] + int(face_height * 0.5)
|
137 |
+
|
138 |
+
# Boca
|
139 |
+
mouth_y = bbox[1] + int(face_height * 0.7)
|
140 |
+
|
141 |
+
# Asignar puntos clave b谩sicos
|
142 |
+
for i in range(68):
|
143 |
+
if i < 17: # Contorno facial
|
144 |
+
x = bbox[0] + int(face_width * (i / 16))
|
145 |
+
y = bbox[1] + int(face_height * 0.8)
|
146 |
+
elif i < 27: # Cejas
|
147 |
+
x = left_eye_x if i < 22 else right_eye_x
|
148 |
+
y = eye_y - int(face_height * 0.1)
|
149 |
+
elif i < 36: # Nariz
|
150 |
+
x = nose_x
|
151 |
+
y = nose_y
|
152 |
+
elif i < 48: # Ojos
|
153 |
+
x = left_eye_x if i < 42 else right_eye_x
|
154 |
+
y = eye_y
|
155 |
+
else: # Boca
|
156 |
+
x = nose_x
|
157 |
+
y = mouth_y
|
158 |
+
|
159 |
+
basic_landmarks[i] = [x, y]
|
160 |
+
|
161 |
+
landmarks.append(basic_landmarks)
|
162 |
+
|
163 |
+
return landmarks
|
face_detection/detection/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .sfd import S3FD
|
face_detection/detection/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (226 Bytes). View file
|
|
face_detection/detection/sfd/__init__.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
from .sfd_detector import SFDDetector
|
2 |
+
from .s3fd import S3FD
|
face_detection/detection/sfd/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (295 Bytes). View file
|
|
face_detection/detection/sfd/__pycache__/net_s3fd.cpython-311.pyc
ADDED
Binary file (10.6 kB). View file
|
|
face_detection/detection/sfd/__pycache__/s3fd.cpython-311.pyc
ADDED
Binary file (10.4 kB). View file
|
|
face_detection/detection/sfd/__pycache__/sfd_detector.cpython-311.pyc
ADDED
Binary file (15.1 kB). View file
|
|
face_detection/detection/sfd/net_s3fd.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.nn.functional as F
|
4 |
+
|
5 |
+
class L2Norm(nn.Module):
|
6 |
+
def __init__(self, n_channels, scale=1.0):
|
7 |
+
super(L2Norm, self).__init__()
|
8 |
+
self.n_channels = n_channels
|
9 |
+
self.scale = scale
|
10 |
+
self.eps = 1e-10
|
11 |
+
self.weight = nn.Parameter(torch.Tensor(self.n_channels))
|
12 |
+
self.weight.data *= 0.0
|
13 |
+
self.weight.data += self.scale
|
14 |
+
|
15 |
+
def forward(self, x):
|
16 |
+
norm = x.pow(2).sum(dim=1, keepdim=True).sqrt() + self.eps
|
17 |
+
x = x / norm
|
18 |
+
out = self.weight.unsqueeze(0).unsqueeze(2).unsqueeze(3).expand_as(x) * x
|
19 |
+
return out
|
20 |
+
|
21 |
+
class s3fd(nn.Module):
|
22 |
+
def __init__(self):
|
23 |
+
super(s3fd, self).__init__()
|
24 |
+
self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
|
25 |
+
self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1)
|
26 |
+
self.pool1 = nn.MaxPool2d(kernel_size=2, stride=2)
|
27 |
+
|
28 |
+
self.conv2_1 = nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1)
|
29 |
+
self.conv2_2 = nn.Conv2d(128, 128, kernel_size=3, stride=1, padding=1)
|
30 |
+
self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2)
|
31 |
+
|
32 |
+
self.conv3_1 = nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1)
|
33 |
+
self.conv3_2 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)
|
34 |
+
self.conv3_3 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)
|
35 |
+
self.pool3 = nn.MaxPool2d(kernel_size=2, stride=2)
|
36 |
+
|
37 |
+
self.conv4_1 = nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1)
|
38 |
+
self.conv4_2 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
39 |
+
self.conv4_3 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
40 |
+
self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2)
|
41 |
+
|
42 |
+
self.conv5_1 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
43 |
+
self.conv5_2 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
44 |
+
self.conv5_3 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
45 |
+
self.pool5 = nn.MaxPool2d(kernel_size=2, stride=2)
|
46 |
+
|
47 |
+
self.fc6 = nn.Conv2d(512, 1024, kernel_size=3, stride=1, padding=3)
|
48 |
+
self.fc7 = nn.Conv2d(1024, 1024, kernel_size=1, stride=1, padding=0)
|
49 |
+
|
50 |
+
self.conv6_1 = nn.Conv2d(1024, 256, kernel_size=1, stride=1, padding=0)
|
51 |
+
self.conv6_2 = nn.Conv2d(256, 512, kernel_size=3, stride=2, padding=1)
|
52 |
+
|
53 |
+
self.conv7_1 = nn.Conv2d(512, 128, kernel_size=1, stride=1, padding=0)
|
54 |
+
self.conv7_2 = nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1)
|
55 |
+
|
56 |
+
self.conv3_3_norm = L2Norm(256, scale=10)
|
57 |
+
self.conv4_3_norm = L2Norm(512, scale=8)
|
58 |
+
self.conv5_3_norm = L2Norm(512, scale=5)
|
59 |
+
|
60 |
+
self.conv3_3_norm_mbox_conf = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
61 |
+
self.conv3_3_norm_mbox_loc = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
62 |
+
self.conv4_3_norm_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
63 |
+
self.conv4_3_norm_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
64 |
+
self.conv5_3_norm_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
65 |
+
self.conv5_3_norm_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
66 |
+
|
67 |
+
self.fc7_mbox_conf = nn.Conv2d(1024, 2, kernel_size=3, stride=1, padding=1)
|
68 |
+
self.fc7_mbox_loc = nn.Conv2d(1024, 4, kernel_size=3, stride=1, padding=1)
|
69 |
+
self.conv6_2_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
70 |
+
self.conv6_2_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
71 |
+
self.conv7_2_mbox_conf = nn.Conv2d(256, 2, kernel_size=3, stride=1, padding=1)
|
72 |
+
self.conv7_2_mbox_loc = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
73 |
+
|
74 |
+
def forward(self, x):
|
75 |
+
h = F.relu(self.conv1_1(x))
|
76 |
+
h = F.relu(self.conv1_2(h))
|
77 |
+
h = self.pool1(h)
|
78 |
+
|
79 |
+
h = F.relu(self.conv2_1(h))
|
80 |
+
h = F.relu(self.conv2_2(h))
|
81 |
+
h = self.pool2(h)
|
82 |
+
|
83 |
+
h = F.relu(self.conv3_1(h))
|
84 |
+
h = F.relu(self.conv3_2(h))
|
85 |
+
h = F.relu(self.conv3_3(h))
|
86 |
+
f3_3 = h
|
87 |
+
h = self.pool3(h)
|
88 |
+
|
89 |
+
h = F.relu(self.conv4_1(h))
|
90 |
+
h = F.relu(self.conv4_2(h))
|
91 |
+
h = F.relu(self.conv4_3(h))
|
92 |
+
f4_3 = h
|
93 |
+
h = self.pool4(h)
|
94 |
+
|
95 |
+
h = F.relu(self.conv5_1(h))
|
96 |
+
h = F.relu(self.conv5_2(h))
|
97 |
+
h = F.relu(self.conv5_3(h))
|
98 |
+
f5_3 = h
|
99 |
+
h = self.pool5(h)
|
100 |
+
|
101 |
+
h = F.relu(self.fc6(h))
|
102 |
+
h = F.relu(self.fc7(h))
|
103 |
+
ffc7 = h
|
104 |
+
|
105 |
+
h = F.relu(self.conv6_1(h))
|
106 |
+
h = F.relu(self.conv6_2(h))
|
107 |
+
f6_2 = h
|
108 |
+
|
109 |
+
h = F.relu(self.conv7_1(h))
|
110 |
+
h = F.relu(self.conv7_2(h))
|
111 |
+
f7_2 = h
|
112 |
+
|
113 |
+
f3_3 = self.conv3_3_norm(f3_3)
|
114 |
+
f4_3 = self.conv4_3_norm(f4_3)
|
115 |
+
f5_3 = self.conv5_3_norm(f5_3)
|
116 |
+
|
117 |
+
cls1 = self.conv3_3_norm_mbox_conf(f3_3)
|
118 |
+
reg1 = self.conv3_3_norm_mbox_loc(f3_3)
|
119 |
+
cls2 = self.conv4_3_norm_mbox_conf(f4_3)
|
120 |
+
reg2 = self.conv4_3_norm_mbox_loc(f4_3)
|
121 |
+
cls3 = self.conv5_3_norm_mbox_conf(f5_3)
|
122 |
+
reg3 = self.conv5_3_norm_mbox_loc(f5_3)
|
123 |
+
cls4 = self.fc7_mbox_conf(ffc7)
|
124 |
+
reg4 = self.fc7_mbox_loc(ffc7)
|
125 |
+
cls5 = self.conv6_2_mbox_conf(f6_2)
|
126 |
+
reg5 = self.conv6_2_mbox_loc(f6_2)
|
127 |
+
cls6 = self.conv7_2_mbox_conf(f7_2)
|
128 |
+
reg6 = self.conv7_2_mbox_loc(f7_2)
|
129 |
+
|
130 |
+
# max-out background label
|
131 |
+
chunk = torch.chunk(cls1, 4, 1)
|
132 |
+
bmax = torch.max(torch.max(chunk[0], chunk[1]), chunk[2])
|
133 |
+
cls1 = torch.cat([bmax, chunk[3]], dim=1)
|
134 |
+
|
135 |
+
return [cls1, reg1, cls2, reg2, cls3, reg3, cls4, reg4, cls5, reg5, cls6, reg6]
|
face_detection/detection/sfd/s3fd.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:619a31681264d3f7f7fc7a16a42cbbe8b23f31a256f75a366e5a1bcd59b33543
|
3 |
+
size 89843225
|
face_detection/detection/sfd/s3fd.py
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.nn.functional as F
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
class L2Norm(nn.Module):
|
7 |
+
def __init__(self, n_channels, scale=1.0):
|
8 |
+
super(L2Norm, self).__init__()
|
9 |
+
self.n_channels = n_channels
|
10 |
+
self.scale = scale
|
11 |
+
self.eps = 1e-10
|
12 |
+
self.weight = nn.Parameter(torch.Tensor(self.n_channels))
|
13 |
+
self.weight.data *= 0.0
|
14 |
+
self.weight.data += self.scale
|
15 |
+
|
16 |
+
def forward(self, x):
|
17 |
+
norm = x.pow(2).sum(dim=1, keepdim=True).sqrt() + self.eps
|
18 |
+
x = x / norm * self.weight.view(1, -1, 1, 1)
|
19 |
+
return x
|
20 |
+
|
21 |
+
class S3FD(nn.Module):
|
22 |
+
def __init__(self):
|
23 |
+
super(S3FD, self).__init__()
|
24 |
+
self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
|
25 |
+
self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1)
|
26 |
+
self.pool1 = nn.MaxPool2d(kernel_size=2, stride=2)
|
27 |
+
|
28 |
+
self.conv2_1 = nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1)
|
29 |
+
self.conv2_2 = nn.Conv2d(128, 128, kernel_size=3, stride=1, padding=1)
|
30 |
+
self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2)
|
31 |
+
|
32 |
+
self.conv3_1 = nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1)
|
33 |
+
self.conv3_2 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)
|
34 |
+
self.conv3_3 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)
|
35 |
+
self.pool3 = nn.MaxPool2d(kernel_size=2, stride=2)
|
36 |
+
|
37 |
+
self.conv4_1 = nn.Conv2d(256, 512, kernel_size=3, stride=1, padding=1)
|
38 |
+
self.conv4_2 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
39 |
+
self.conv4_3 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
40 |
+
self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2)
|
41 |
+
|
42 |
+
self.conv5_1 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
43 |
+
self.conv5_2 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
44 |
+
self.conv5_3 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1)
|
45 |
+
self.pool5 = nn.MaxPool2d(kernel_size=2, stride=2)
|
46 |
+
|
47 |
+
self.fc6 = nn.Conv2d(512, 1024, kernel_size=3, stride=1, padding=3)
|
48 |
+
self.fc7 = nn.Conv2d(1024, 1024, kernel_size=1, stride=1, padding=0)
|
49 |
+
|
50 |
+
self.conv6_1 = nn.Conv2d(1024, 256, kernel_size=1, stride=1, padding=0)
|
51 |
+
self.conv6_2 = nn.Conv2d(256, 512, kernel_size=3, stride=2, padding=1)
|
52 |
+
|
53 |
+
self.conv7_1 = nn.Conv2d(512, 128, kernel_size=1, stride=1, padding=0)
|
54 |
+
self.conv7_2 = nn.Conv2d(128, 256, kernel_size=3, stride=2, padding=1)
|
55 |
+
|
56 |
+
self.conv3_3_norm = L2Norm(256, scale=10)
|
57 |
+
self.conv4_3_norm = L2Norm(512, scale=8)
|
58 |
+
self.conv5_3_norm = L2Norm(512, scale=5)
|
59 |
+
|
60 |
+
self.conv3_3_norm_mbox_conf = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
61 |
+
self.conv3_3_norm_mbox_loc = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
62 |
+
self.conv4_3_norm_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
63 |
+
self.conv4_3_norm_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
64 |
+
self.conv5_3_norm_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
65 |
+
self.conv5_3_norm_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
66 |
+
|
67 |
+
self.fc7_mbox_conf = nn.Conv2d(1024, 2, kernel_size=3, stride=1, padding=1)
|
68 |
+
self.fc7_mbox_loc = nn.Conv2d(1024, 4, kernel_size=3, stride=1, padding=1)
|
69 |
+
self.conv6_2_mbox_conf = nn.Conv2d(512, 2, kernel_size=3, stride=1, padding=1)
|
70 |
+
self.conv6_2_mbox_loc = nn.Conv2d(512, 4, kernel_size=3, stride=1, padding=1)
|
71 |
+
self.conv7_2_mbox_conf = nn.Conv2d(256, 2, kernel_size=3, stride=1, padding=1)
|
72 |
+
self.conv7_2_mbox_loc = nn.Conv2d(256, 4, kernel_size=3, stride=1, padding=1)
|
73 |
+
|
74 |
+
def forward(self, x):
|
75 |
+
h = F.relu(self.conv1_1(x))
|
76 |
+
h = F.relu(self.conv1_2(h))
|
77 |
+
h = self.pool1(h)
|
78 |
+
|
79 |
+
h = F.relu(self.conv2_1(h))
|
80 |
+
h = F.relu(self.conv2_2(h))
|
81 |
+
h = self.pool2(h)
|
82 |
+
|
83 |
+
h = F.relu(self.conv3_1(h))
|
84 |
+
h = F.relu(self.conv3_2(h))
|
85 |
+
h = F.relu(self.conv3_3(h))
|
86 |
+
f3_3 = h
|
87 |
+
h = self.pool3(h)
|
88 |
+
|
89 |
+
h = F.relu(self.conv4_1(h))
|
90 |
+
h = F.relu(self.conv4_2(h))
|
91 |
+
h = F.relu(self.conv4_3(h))
|
92 |
+
f4_3 = h
|
93 |
+
h = self.pool4(h)
|
94 |
+
|
95 |
+
h = F.relu(self.conv5_1(h))
|
96 |
+
h = F.relu(self.conv5_2(h))
|
97 |
+
h = F.relu(self.conv5_3(h))
|
98 |
+
f5_3 = h
|
99 |
+
h = self.pool5(h)
|
100 |
+
|
101 |
+
h = F.relu(self.fc6(h))
|
102 |
+
h = F.relu(self.fc7(h))
|
103 |
+
ffc7 = h
|
104 |
+
|
105 |
+
h = F.relu(self.conv6_1(h))
|
106 |
+
h = F.relu(self.conv6_2(h))
|
107 |
+
f6_2 = h
|
108 |
+
|
109 |
+
h = F.relu(self.conv7_1(h))
|
110 |
+
h = F.relu(self.conv7_2(h))
|
111 |
+
f7_2 = h
|
112 |
+
|
113 |
+
f3_3 = self.conv3_3_norm(f3_3)
|
114 |
+
f4_3 = self.conv4_3_norm(f4_3)
|
115 |
+
f5_3 = self.conv5_3_norm(f5_3)
|
116 |
+
|
117 |
+
cls1 = self.conv3_3_norm_mbox_conf(f3_3)
|
118 |
+
reg1 = self.conv3_3_norm_mbox_loc(f3_3)
|
119 |
+
cls2 = self.conv4_3_norm_mbox_conf(f4_3)
|
120 |
+
reg2 = self.conv4_3_norm_mbox_loc(f4_3)
|
121 |
+
cls3 = self.conv5_3_norm_mbox_conf(f5_3)
|
122 |
+
reg3 = self.conv5_3_norm_mbox_loc(f5_3)
|
123 |
+
cls4 = self.fc7_mbox_conf(ffc7)
|
124 |
+
reg4 = self.fc7_mbox_loc(ffc7)
|
125 |
+
cls5 = self.conv6_2_mbox_conf(f6_2)
|
126 |
+
reg5 = self.conv6_2_mbox_loc(f6_2)
|
127 |
+
cls6 = self.conv7_2_mbox_conf(f7_2)
|
128 |
+
reg6 = self.conv7_2_mbox_loc(f7_2)
|
129 |
+
|
130 |
+
# max-out background label
|
131 |
+
chunk = torch.chunk(cls1, 4, 1)
|
132 |
+
bmax = torch.max(torch.max(chunk[0], chunk[1]), chunk[2])
|
133 |
+
cls1 = torch.cat([bmax, chunk[3]], dim=1)
|
134 |
+
|
135 |
+
return [cls1, reg1, cls2, reg2, cls3, reg3, cls4, reg4, cls5, reg5, cls6, reg6]
|
face_detection/detection/sfd/sfd_detector.py
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn.functional as F
|
3 |
+
import numpy as np
|
4 |
+
import cv2
|
5 |
+
from .net_s3fd import s3fd
|
6 |
+
import os
|
7 |
+
import logging
|
8 |
+
import json
|
9 |
+
import hashlib
|
10 |
+
|
11 |
+
logger = logging.getLogger(__name__)
|
12 |
+
|
13 |
+
def decode(loc, priors, variances):
|
14 |
+
boxes = torch.cat((
|
15 |
+
priors[:, :2] + loc[:, :2] * variances[0] * priors[:, 2:],
|
16 |
+
priors[:, 2:] * torch.exp(loc[:, 2:] * variances[1])), 1)
|
17 |
+
boxes[:, :2] -= boxes[:, 2:] / 2
|
18 |
+
boxes[:, 2:] += boxes[:, :2]
|
19 |
+
return boxes
|
20 |
+
|
21 |
+
def nms(dets, thresh):
|
22 |
+
if 0 == len(dets):
|
23 |
+
return []
|
24 |
+
x1, y1, x2, y2, scores = dets[:, 0], dets[:, 1], dets[:, 2], dets[:, 3], dets[:, 4]
|
25 |
+
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
|
26 |
+
order = scores.argsort()[::-1]
|
27 |
+
|
28 |
+
keep = []
|
29 |
+
while order.size > 0:
|
30 |
+
i = order[0]
|
31 |
+
keep.append(i)
|
32 |
+
xx1, yy1 = np.maximum(x1[i], x1[order[1:]]), np.maximum(y1[i], y1[order[1:]])
|
33 |
+
xx2, yy2 = np.minimum(x2[i], x2[order[1:]]), np.minimum(y2[i], y2[order[1:]])
|
34 |
+
|
35 |
+
w, h = np.maximum(0.0, xx2 - xx1 + 1), np.maximum(0.0, yy2 - yy1 + 1)
|
36 |
+
ovr = w * h / (areas[i] + areas[order[1:]] - w * h)
|
37 |
+
|
38 |
+
inds = np.where(ovr <= thresh)[0]
|
39 |
+
order = order[inds + 1]
|
40 |
+
|
41 |
+
return keep
|
42 |
+
|
43 |
+
class SFDDetector:
|
44 |
+
def __init__(self, model_path=None, device='cuda'):
|
45 |
+
self.device = torch.device(device if torch.cuda.is_available() else 'cpu')
|
46 |
+
|
47 |
+
self.net = s3fd()
|
48 |
+
state_dict = torch.load(model_path, map_location=self.device)
|
49 |
+
self.net.load_state_dict(state_dict)
|
50 |
+
self.net.to(self.device)
|
51 |
+
self.net.eval()
|
52 |
+
|
53 |
+
def detect_from_batch(self, images):
|
54 |
+
if len(images.shape) == 3:
|
55 |
+
images = images[np.newaxis, ...]
|
56 |
+
|
57 |
+
if images.shape[-1] == 4:
|
58 |
+
images = images[...,:3]
|
59 |
+
elif len(images.shape) == 3 and images.shape[-1] == 1:
|
60 |
+
images = np.repeat(images, 3, axis=-1)
|
61 |
+
elif len(images.shape) == 2:
|
62 |
+
images = np.repeat(images[:,:,np.newaxis], 3, axis=2)
|
63 |
+
|
64 |
+
images = images.astype(np.float32)
|
65 |
+
images = images - np.array([104, 117, 123])
|
66 |
+
images = images.transpose(0, 3, 1, 2)
|
67 |
+
images = torch.from_numpy(images).float().to(self.device)
|
68 |
+
|
69 |
+
if images.shape[2] <= 256 and images.shape[3] <= 256:
|
70 |
+
height, width = images.shape[2:4]
|
71 |
+
margin = min(width, height) // 8
|
72 |
+
return [np.array([[margin, margin, width-margin, height-margin, 0.99]], dtype=np.int32)]
|
73 |
+
|
74 |
+
with torch.no_grad():
|
75 |
+
olist = self.net(images)
|
76 |
+
|
77 |
+
bboxlists = []
|
78 |
+
for i in range(len(olist) // 2):
|
79 |
+
olist[i * 2] = F.softmax(olist[i * 2], dim=1)
|
80 |
+
olist = [oelem.data.cpu() for oelem in olist]
|
81 |
+
|
82 |
+
for batch_idx in range(images.shape[0]):
|
83 |
+
bboxlist = []
|
84 |
+
for i in range(len(olist) // 2):
|
85 |
+
ocls, oreg = olist[i * 2], olist[i * 2 + 1]
|
86 |
+
stride = 2 ** (i + 2)
|
87 |
+
|
88 |
+
scores = ocls[batch_idx, 1, :, :]
|
89 |
+
pos_inds = np.where(scores.numpy() > 0.05)
|
90 |
+
|
91 |
+
if len(pos_inds[0]) > 0:
|
92 |
+
for hindex, windex in zip(*pos_inds):
|
93 |
+
axc, ayc = stride / 2 + windex * stride, stride / 2 + hindex * stride
|
94 |
+
score = scores[hindex, windex]
|
95 |
+
loc = oreg[batch_idx, :, hindex, windex].contiguous().view(1, 4)
|
96 |
+
priors = torch.Tensor([[axc / 1.0, ayc / 1.0, stride * 4 / 1.0, stride * 4 / 1.0]])
|
97 |
+
variances = [0.1, 0.2]
|
98 |
+
box = decode(loc, priors, variances)
|
99 |
+
box = box[0].numpy() * 1.0
|
100 |
+
bboxlist.append([box[0], box[1], box[2], box[3], score.item()])
|
101 |
+
|
102 |
+
bboxlist = np.array(bboxlist)
|
103 |
+
if len(bboxlist) == 0:
|
104 |
+
height, width = images.shape[2:4]
|
105 |
+
margin = min(width, height) // 8
|
106 |
+
bboxlist = np.array([[margin, margin, width-margin, height-margin, 0.99]])
|
107 |
+
|
108 |
+
keep = nms(bboxlist, 0.3)
|
109 |
+
bboxlist = bboxlist[keep]
|
110 |
+
bboxlist[:, :4] = np.round(bboxlist[:, :4]).astype(np.int32)
|
111 |
+
bboxlists.append(bboxlist)
|
112 |
+
|
113 |
+
return bboxlists
|
114 |
+
|
115 |
+
def _get_image_hash(self, image_path):
|
116 |
+
try:
|
117 |
+
with open(image_path, 'rb') as f:
|
118 |
+
return hashlib.md5(f.read()).hexdigest()
|
119 |
+
except Exception as e:
|
120 |
+
logger.error(f"Error al calcular hash de imagen: {str(e)}")
|
121 |
+
return None
|
122 |
+
|
123 |
+
def _get_cache_path(self, image_path):
|
124 |
+
image_hash = self._get_image_hash(image_path)
|
125 |
+
if image_hash:
|
126 |
+
cache_dir = os.path.join(os.path.dirname(__file__), 'cache')
|
127 |
+
os.makedirs(cache_dir, exist_ok=True)
|
128 |
+
return os.path.join(cache_dir, f"{image_hash}.json")
|
129 |
+
return None
|
130 |
+
|
131 |
+
def _save_to_cache(self, image_path, bboxes):
|
132 |
+
try:
|
133 |
+
cache_path = self._get_cache_path(image_path)
|
134 |
+
if cache_path:
|
135 |
+
with open(cache_path, 'w') as f:
|
136 |
+
json.dump({
|
137 |
+
'bboxes': bboxes.tolist(),
|
138 |
+
'image_path': image_path,
|
139 |
+
'timestamp': os.path.getmtime(image_path)
|
140 |
+
}, f)
|
141 |
+
logger.info(f"Resultados guardados en cach茅: {cache_path}")
|
142 |
+
except Exception as e:
|
143 |
+
logger.error(f"Error al guardar en cach茅: {str(e)}")
|
144 |
+
|
145 |
+
def _load_from_cache(self, image_path):
|
146 |
+
try:
|
147 |
+
cache_path = self._get_cache_path(image_path)
|
148 |
+
if cache_path and os.path.exists(cache_path):
|
149 |
+
with open(cache_path, 'r') as f:
|
150 |
+
data = json.load(f)
|
151 |
+
if data['image_path'] == image_path and \
|
152 |
+
data['timestamp'] == os.path.getmtime(image_path):
|
153 |
+
logger.info(f"Usando resultados de cach茅: {cache_path}")
|
154 |
+
return np.array(data['bboxes'], dtype=np.int32)
|
155 |
+
except Exception as e:
|
156 |
+
logger.error(f"Error al cargar de cach茅: {str(e)}")
|
157 |
+
return None
|
158 |
+
|
159 |
+
def detect_from_image(self, image_path):
|
160 |
+
# Verificar si es una imagen predeterminada
|
161 |
+
if image_path.endswith(('male.png', 'female.png')):
|
162 |
+
cached_result = self._load_from_cache(image_path)
|
163 |
+
if cached_result is not None:
|
164 |
+
return cached_result
|
165 |
+
|
166 |
+
# Si no hay cach茅, proceder con la detecci贸n normal
|
167 |
+
try:
|
168 |
+
image = cv2.imread(image_path)
|
169 |
+
if image is None:
|
170 |
+
raise ValueError(f"No se pudo cargar la imagen: {image_path}")
|
171 |
+
|
172 |
+
result = self.detect_from_batch(image)[0]
|
173 |
+
|
174 |
+
# Asegurar que los resultados sean enteros
|
175 |
+
result = result.astype(np.int32)
|
176 |
+
|
177 |
+
# Guardar en cach茅 si es una imagen predeterminada
|
178 |
+
if image_path.endswith(('male.png', 'female.png')):
|
179 |
+
self._save_to_cache(image_path, result)
|
180 |
+
|
181 |
+
return result
|
182 |
+
|
183 |
+
except Exception as e:
|
184 |
+
logger.error(f"Error en detect_from_image: {str(e)}")
|
185 |
+
if image is not None:
|
186 |
+
height, width = image.shape[:2]
|
187 |
+
margin_x = int(width * 0.1)
|
188 |
+
margin_y = int(height * 0.1)
|
189 |
+
return np.array([[margin_x, margin_y, width-margin_x, height-margin_y, 0.99]], dtype=np.int32)
|
190 |
+
return np.array([[0, 0, 100, 100, 0.99]], dtype=np.int32)
|
face_detection/utils.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import urllib.request
|
3 |
+
import shutil
|
4 |
+
|
5 |
+
def download_sfd_model():
|
6 |
+
model_path = os.path.join(os.path.dirname(__file__), 'detection/sfd/s3fd.pth')
|
7 |
+
if os.path.exists(model_path):
|
8 |
+
return model_path
|
9 |
+
|
10 |
+
print("Descargando modelo SFD...")
|
11 |
+
url = "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
|
12 |
+
temp_path = model_path + ".temp"
|
13 |
+
|
14 |
+
try:
|
15 |
+
urllib.request.urlretrieve(url, temp_path)
|
16 |
+
os.makedirs(os.path.dirname(model_path), exist_ok=True)
|
17 |
+
shutil.move(temp_path, model_path)
|
18 |
+
return model_path
|
19 |
+
except Exception as e:
|
20 |
+
if os.path.exists(temp_path):
|
21 |
+
os.remove(temp_path)
|
22 |
+
raise Exception(f"Error al descargar el modelo SFD: {str(e)}")
|
input/face.png
ADDED
![]() |
Git LFS Details
|
logs/app_20250226_094827.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:48:27,860 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:48:27,863 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:48:36,024 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_094841.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:48:41,795 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:48:41,800 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:48:52,013 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_094858.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:48:58,233 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:48:58,237 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:49:16,556 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_094922.log
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:49:22,153 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:49:22,157 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:49:34,666 [DEBUG] Using proactor: IocpProactor
|
4 |
+
2025-02-26 09:49:40,639 [INFO] 127.0.0.1 - - [26/Feb/2025 09:49:40] "POST /generate-wav2lip HTTP/1.1" 200 -
|
5 |
+
2025-02-26 09:49:42,802 [INFO] 127.0.0.1 - - [26/Feb/2025 09:49:42] "[35m[1mGET /animation/p55fbipl HTTP/1.1[0m" 206 -
|
6 |
+
2025-02-26 09:52:12,795 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\audio_processing\\audio.py', reloading
|
logs/app_20250226_094927.log
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:49:27,718 [INFO] [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2 |
+
* Running on http://127.0.0.1:5000
|
3 |
+
2025-02-26 09:49:27,719 [INFO] [33mPress CTRL+C to quit[0m
|
4 |
+
2025-02-26 09:49:27,722 [INFO] * Restarting with stat
|
logs/app_20250226_094932.log
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:49:32,624 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:49:32,627 [INFO] * Debugger PIN: 129-368-041
|
logs/app_20250226_095219.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:52:19,194 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:52:19,198 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:52:37,507 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095243.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:52:43,097 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:52:43,100 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:53:05,463 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095311.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:53:11,127 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:53:11,132 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:53:12,192 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095318.log
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:53:18,634 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:53:18,638 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:53:28,212 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:28] "GET / HTTP/1.1" 200 -
|
4 |
+
2025-02-26 09:53:28,359 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:28] "[36mGET /static/female.png HTTP/1.1[0m" 304 -
|
5 |
+
2025-02-26 09:53:28,360 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:28] "[36mGET /static/male.png HTTP/1.1[0m" 304 -
|
6 |
+
2025-02-26 09:53:30,873 [DEBUG] Using proactor: IocpProactor
|
7 |
+
2025-02-26 09:53:31,732 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:31] "POST /generate-tts HTTP/1.1" 200 -
|
8 |
+
2025-02-26 09:53:31,754 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:31] "[35m[1mGET /audio/e2eb471c-335f-4ca6-bf27-c72d8e34c9eb HTTP/1.1[0m" 206 -
|
9 |
+
2025-02-26 09:53:37,630 [DEBUG] Using proactor: IocpProactor
|
10 |
+
2025-02-26 09:53:43,550 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:43] "POST /generate-wav2lip HTTP/1.1" 200 -
|
11 |
+
2025-02-26 09:53:47,321 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:47] "[35m[1mGET /animation/ogm63h41 HTTP/1.1[0m" 206 -
|
12 |
+
2025-02-26 09:53:53,824 [INFO] 127.0.0.1 - - [26/Feb/2025 09:53:53] "GET /download-animation/ogm63h41 HTTP/1.1" 200 -
|
13 |
+
2025-02-26 09:55:05,328 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095510.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:55:10,893 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:55:10,897 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:55:26,158 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095531.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:55:31,801 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:55:31,805 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:55:33,877 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095539.log
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:55:39,608 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:55:39,614 [INFO] * Debugger PIN: 129-368-041
|
logs/app_20250226_095541.log
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:55:41,679 [INFO] [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2 |
+
* Running on http://127.0.0.1:5000
|
3 |
+
2025-02-26 09:55:41,680 [INFO] [33mPress CTRL+C to quit[0m
|
4 |
+
2025-02-26 09:55:41,682 [INFO] * Restarting with stat
|
5 |
+
2025-02-26 09:57:38,115 [INFO] * Restarting with stat
|
6 |
+
2025-02-26 09:58:11,209 [INFO] * Restarting with stat
|
7 |
+
2025-02-26 09:58:17,857 [INFO] * Restarting with stat
|
8 |
+
2025-02-26 09:58:41,736 [INFO] * Restarting with stat
|
9 |
+
2025-02-26 09:59:34,075 [INFO] * Restarting with stat
|
10 |
+
2025-02-26 10:02:28,408 [INFO] * Restarting with stat
|
11 |
+
2025-02-26 10:02:47,782 [INFO] * Restarting with stat
|
12 |
+
2025-02-26 10:04:33,381 [INFO] * Restarting with stat
|
13 |
+
2025-02-26 10:04:41,502 [INFO] * Restarting with stat
|
14 |
+
2025-02-26 10:05:02,610 [INFO] * Restarting with stat
|
15 |
+
2025-02-26 10:05:13,709 [INFO] * Restarting with stat
|
16 |
+
2025-02-26 10:05:51,546 [INFO] * Restarting with stat
|
17 |
+
2025-02-26 10:06:06,840 [INFO] * Restarting with stat
|
18 |
+
2025-02-26 10:06:16,988 [INFO] * Restarting with stat
|
19 |
+
2025-02-26 10:06:45,633 [INFO] * Restarting with stat
|
20 |
+
2025-02-26 10:07:01,018 [INFO] * Restarting with stat
|
21 |
+
2025-02-26 10:08:11,389 [INFO] * Restarting with stat
|
22 |
+
2025-02-26 10:08:40,304 [INFO] * Restarting with stat
|
23 |
+
2025-02-26 10:08:57,811 [INFO] * Restarting with stat
|
24 |
+
2025-02-26 10:09:24,452 [INFO] * Restarting with stat
|
25 |
+
2025-02-26 10:10:11,333 [INFO] * Restarting with stat
|
26 |
+
2025-02-26 10:10:28,815 [INFO] * Restarting with stat
|
27 |
+
2025-02-26 10:11:06,714 [INFO] * Restarting with stat
|
28 |
+
2025-02-26 10:11:27,051 [INFO] * Restarting with stat
|
29 |
+
2025-02-26 10:11:42,632 [INFO] * Restarting with stat
|
30 |
+
2025-02-26 10:14:18,355 [INFO] * Restarting with stat
|
31 |
+
2025-02-26 10:15:54,363 [INFO] * Restarting with stat
|
32 |
+
2025-02-26 10:16:18,597 [INFO] * Restarting with stat
|
33 |
+
2025-02-26 10:16:26,291 [INFO] * Restarting with stat
|
34 |
+
2025-02-26 10:17:48,626 [INFO] * Restarting with stat
|
logs/app_20250226_095546.log
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:55:46,835 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:55:46,839 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:55:57,875 [DEBUG] Using proactor: IocpProactor
|
4 |
+
2025-02-26 09:56:04,525 [INFO] 127.0.0.1 - - [26/Feb/2025 09:56:04] "POST /generate-wav2lip HTTP/1.1" 200 -
|
5 |
+
2025-02-26 09:56:05,972 [INFO] 127.0.0.1 - - [26/Feb/2025 09:56:05] "[35m[1mGET /animation/muv4wx7u HTTP/1.1[0m" 206 -
|
6 |
+
2025-02-26 09:57:37,511 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095743.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:57:43,156 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:57:43,160 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:58:10,623 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095816.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:58:16,191 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:58:16,194 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:58:17,257 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095822.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:58:22,727 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:58:22,730 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:58:41,078 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095846.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:58:46,681 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:58:46,685 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 09:59:33,387 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_095939.log
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 09:59:39,112 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 09:59:39,117 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 10:00:03,475 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:03] "GET / HTTP/1.1" 200 -
|
4 |
+
2025-02-26 10:00:03,612 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:03] "[36mGET /static/female.png HTTP/1.1[0m" 304 -
|
5 |
+
2025-02-26 10:00:03,613 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:03] "[36mGET /static/male.png HTTP/1.1[0m" 304 -
|
6 |
+
2025-02-26 10:00:34,846 [DEBUG] Using proactor: IocpProactor
|
7 |
+
2025-02-26 10:00:36,610 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:36] "POST /generate-tts HTTP/1.1" 200 -
|
8 |
+
2025-02-26 10:00:36,624 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:36] "[35m[1mGET /audio/f3034a40-ca8d-47c1-aff0-b8f46705afc3 HTTP/1.1[0m" 206 -
|
9 |
+
2025-02-26 10:00:47,903 [DEBUG] Using proactor: IocpProactor
|
10 |
+
2025-02-26 10:00:54,175 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:54] "POST /generate-wav2lip HTTP/1.1" 200 -
|
11 |
+
2025-02-26 10:00:55,739 [INFO] 127.0.0.1 - - [26/Feb/2025 10:00:55] "[35m[1mGET /animation/wzand8wh HTTP/1.1[0m" 206 -
|
12 |
+
2025-02-26 10:01:05,359 [DEBUG] Using proactor: IocpProactor
|
13 |
+
2025-02-26 10:01:10,911 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:10] "POST /generate-wav2lip HTTP/1.1" 200 -
|
14 |
+
2025-02-26 10:01:12,414 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:12] "[35m[1mGET /animation/mnybzhuz HTTP/1.1[0m" 206 -
|
15 |
+
2025-02-26 10:01:20,949 [DEBUG] Using proactor: IocpProactor
|
16 |
+
2025-02-26 10:01:26,682 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:26] "POST /generate-wav2lip HTTP/1.1" 200 -
|
17 |
+
2025-02-26 10:01:28,292 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:28] "[35m[1mGET /animation/pg1qvyjv HTTP/1.1[0m" 206 -
|
18 |
+
2025-02-26 10:01:30,413 [DEBUG] Using proactor: IocpProactor
|
19 |
+
2025-02-26 10:01:36,131 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:36] "POST /generate-wav2lip HTTP/1.1" 200 -
|
20 |
+
2025-02-26 10:01:49,183 [INFO] 127.0.0.1 - - [26/Feb/2025 10:01:49] "[35m[1mGET /animation/5vo357qi HTTP/1.1[0m" 206 -
|
21 |
+
2025-02-26 10:02:03,414 [DEBUG] Using proactor: IocpProactor
|
22 |
+
2025-02-26 10:02:09,251 [INFO] 127.0.0.1 - - [26/Feb/2025 10:02:09] "POST /generate-wav2lip HTTP/1.1" 200 -
|
23 |
+
2025-02-26 10:02:10,684 [INFO] 127.0.0.1 - - [26/Feb/2025 10:02:10] "[35m[1mGET /animation/x798oqjv HTTP/1.1[0m" 206 -
|
24 |
+
2025-02-26 10:02:16,276 [DEBUG] Using proactor: IocpProactor
|
25 |
+
2025-02-26 10:02:22,201 [INFO] 127.0.0.1 - - [26/Feb/2025 10:02:22] "POST /generate-wav2lip HTTP/1.1" 200 -
|
26 |
+
2025-02-26 10:02:27,791 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_100233.log
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 10:02:33,923 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 10:02:33,927 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 10:02:33,964 [INFO] 127.0.0.1 - - [26/Feb/2025 10:02:33] "[35m[1mGET /animation/vazcvh66 HTTP/1.1[0m" 206 -
|
4 |
+
2025-02-26 10:02:47,188 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\inference.py', reloading
|
logs/app_20250226_100252.log
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 10:02:52,892 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 10:02:52,896 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 10:03:00,094 [DEBUG] Using proactor: IocpProactor
|
4 |
+
2025-02-26 10:03:06,485 [INFO] 127.0.0.1 - - [26/Feb/2025 10:03:06] "POST /generate-wav2lip HTTP/1.1" 200 -
|
5 |
+
2025-02-26 10:03:10,588 [INFO] 127.0.0.1 - - [26/Feb/2025 10:03:10] "[35m[1mGET /animation/4ibhk17b HTTP/1.1[0m" 206 -
|
6 |
+
2025-02-26 10:03:14,299 [INFO] 127.0.0.1 - - [26/Feb/2025 10:03:14] "GET / HTTP/1.1" 200 -
|
7 |
+
2025-02-26 10:03:14,438 [INFO] 127.0.0.1 - - [26/Feb/2025 10:03:14] "[36mGET /static/female.png HTTP/1.1[0m" 304 -
|
8 |
+
2025-02-26 10:03:14,444 [INFO] 127.0.0.1 - - [26/Feb/2025 10:03:14] "[36mGET /static/male.png HTTP/1.1[0m" 304 -
|
9 |
+
2025-02-26 10:04:32,725 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_100301.log
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 10:03:01,093 [INFO] [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2 |
+
* Running on http://127.0.0.1:5000
|
3 |
+
2025-02-26 10:03:01,093 [INFO] [33mPress CTRL+C to quit[0m
|
4 |
+
2025-02-26 10:03:01,095 [INFO] * Restarting with stat
|
5 |
+
2025-02-26 10:04:33,467 [INFO] * Restarting with stat
|
6 |
+
2025-02-26 10:04:41,621 [INFO] * Restarting with stat
|
7 |
+
2025-02-26 10:05:02,719 [INFO] * Restarting with stat
|
8 |
+
2025-02-26 10:05:13,953 [INFO] * Restarting with stat
|
9 |
+
2025-02-26 10:05:51,738 [INFO] * Restarting with stat
|
10 |
+
2025-02-26 10:06:07,001 [INFO] * Restarting with stat
|
11 |
+
2025-02-26 10:06:17,095 [INFO] * Restarting with stat
|
12 |
+
2025-02-26 10:06:45,636 [INFO] * Restarting with stat
|
13 |
+
2025-02-26 10:07:00,982 [INFO] * Restarting with stat
|
14 |
+
2025-02-26 10:08:11,385 [INFO] * Restarting with stat
|
15 |
+
2025-02-26 10:08:40,300 [INFO] * Restarting with stat
|
16 |
+
2025-02-26 10:08:57,786 [INFO] * Restarting with stat
|
17 |
+
2025-02-26 10:09:24,573 [INFO] * Restarting with stat
|
18 |
+
2025-02-26 10:10:11,410 [INFO] * Restarting with stat
|
19 |
+
2025-02-26 10:10:28,865 [INFO] * Restarting with stat
|
20 |
+
2025-02-26 10:11:06,731 [INFO] * Restarting with stat
|
21 |
+
2025-02-26 10:11:27,062 [INFO] * Restarting with stat
|
22 |
+
2025-02-26 10:11:42,648 [INFO] * Restarting with stat
|
23 |
+
2025-02-26 10:14:18,355 [INFO] * Restarting with stat
|
24 |
+
2025-02-26 10:15:54,304 [INFO] * Restarting with stat
|
25 |
+
2025-02-26 10:16:18,600 [INFO] * Restarting with stat
|
26 |
+
2025-02-26 10:16:26,237 [INFO] * Restarting with stat
|
27 |
+
2025-02-26 10:17:48,593 [INFO] * Restarting with stat
|
28 |
+
2025-02-26 10:18:13,743 [INFO] * Restarting with stat
|
29 |
+
2025-02-26 10:20:22,094 [INFO] * Restarting with stat
|
30 |
+
2025-02-26 10:22:42,557 [INFO] * Restarting with stat
|
31 |
+
2025-02-26 10:22:57,240 [INFO] * Restarting with stat
|
32 |
+
2025-02-26 10:24:43,939 [INFO] * Restarting with stat
|
33 |
+
2025-02-26 10:24:59,242 [INFO] * Restarting with stat
|
34 |
+
2025-02-26 10:27:16,304 [INFO] * Restarting with stat
|
35 |
+
2025-02-26 10:27:28,120 [INFO] * Restarting with stat
|
36 |
+
2025-02-26 10:28:24,763 [INFO] * Restarting with stat
|
37 |
+
2025-02-26 10:29:02,640 [INFO] * Restarting with stat
|
38 |
+
2025-02-26 11:01:46,537 [INFO] * Restarting with stat
|
39 |
+
2025-02-26 11:02:46,325 [INFO] * Restarting with stat
|
40 |
+
2025-02-26 11:03:00,020 [INFO] * Restarting with stat
|
41 |
+
2025-02-26 11:04:23,475 [INFO] * Restarting with stat
|
42 |
+
2025-02-26 11:05:51,129 [INFO] * Restarting with stat
|
43 |
+
2025-02-26 11:06:58,816 [INFO] * Restarting with stat
|
44 |
+
2025-02-26 11:08:20,122 [INFO] * Restarting with stat
|
45 |
+
2025-02-26 11:11:00,367 [INFO] * Restarting with stat
|
46 |
+
2025-02-26 11:12:19,740 [INFO] * Restarting with stat
|
47 |
+
2025-02-26 11:16:24,810 [INFO] * Restarting with stat
|
48 |
+
2025-02-26 11:24:19,950 [INFO] * Restarting with stat
|
49 |
+
2025-02-26 11:24:45,771 [INFO] * Restarting with stat
|
50 |
+
2025-02-26 11:25:52,999 [INFO] * Restarting with stat
|
51 |
+
2025-02-26 11:26:25,916 [INFO] * Restarting with stat
|
52 |
+
2025-02-26 11:26:47,678 [INFO] * Restarting with stat
|
53 |
+
2025-02-26 11:27:52,882 [INFO] * Restarting with stat
|
54 |
+
2025-02-26 11:29:34,617 [INFO] * Restarting with stat
|
55 |
+
2025-02-26 11:30:39,813 [INFO] * Restarting with stat
|
56 |
+
2025-02-26 11:31:38,937 [INFO] * Restarting with stat
|
57 |
+
2025-02-26 11:31:44,888 [INFO] * Restarting with stat
|
58 |
+
2025-02-26 11:32:23,954 [INFO] * Restarting with stat
|
59 |
+
2025-02-26 11:32:32,477 [INFO] * Restarting with stat
|
60 |
+
2025-02-26 11:33:17,690 [INFO] * Restarting with stat
|
61 |
+
2025-02-26 11:33:34,256 [INFO] * Restarting with stat
|
62 |
+
2025-02-26 11:35:12,815 [INFO] * Restarting with stat
|
63 |
+
2025-02-26 11:35:21,606 [INFO] * Restarting with stat
|
64 |
+
2025-02-26 11:36:59,147 [INFO] * Restarting with stat
|
65 |
+
2025-02-26 11:38:30,721 [INFO] * Restarting with stat
|
66 |
+
2025-02-26 11:38:39,228 [INFO] * Restarting with stat
|
67 |
+
2025-02-26 11:38:45,700 [INFO] * Restarting with stat
|
68 |
+
2025-02-26 11:39:53,406 [INFO] * Restarting with stat
|
69 |
+
2025-02-26 11:41:46,253 [INFO] * Restarting with stat
|
70 |
+
2025-02-26 11:42:34,417 [INFO] * Restarting with stat
|
71 |
+
2025-02-26 11:42:56,074 [INFO] * Restarting with stat
|
72 |
+
2025-02-26 11:43:46,146 [INFO] * Restarting with stat
|
logs/app_20250226_100306.log
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 10:03:06,420 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 10:03:06,424 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 10:04:32,807 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
logs/app_20250226_100438.log
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2025-02-26 10:04:38,779 [WARNING] * Debugger is active!
|
2 |
+
2025-02-26 10:04:38,785 [INFO] * Debugger PIN: 129-368-041
|
3 |
+
2025-02-26 10:04:38,873 [WARNING] * Debugger is active!
|
4 |
+
2025-02-26 10:04:38,878 [INFO] * Debugger PIN: 129-368-041
|
5 |
+
2025-02-26 10:04:40,862 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|
6 |
+
2025-02-26 10:04:40,962 [INFO] * Detected change in 'C:\\Users\\Salom贸n\\Desktop\\reels\\app.py', reloading
|