Spaces:
Runtime error
Runtime error
Commit
·
efe586f
1
Parent(s):
fc709b7
add files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitignore +10 -0
- QualityScaler +1 -0
- animate_face.py +402 -0
- config.py +39 -0
- face_vid2vid/GPEN/README.md +92 -0
- face_vid2vid/GPEN/__init_paths.py +21 -0
- face_vid2vid/GPEN/align_faces.py +236 -0
- face_vid2vid/GPEN/face_enhancement.py +160 -0
- face_vid2vid/GPEN/face_model/face_gan.py +54 -0
- face_vid2vid/GPEN/face_model/model.py +736 -0
- face_vid2vid/GPEN/face_model/op/__init__.py +2 -0
- face_vid2vid/GPEN/face_model/op/fused_act.py +88 -0
- face_vid2vid/GPEN/face_model/op/fused_bias_act.cpp +21 -0
- face_vid2vid/GPEN/face_model/op/fused_bias_act_kernel.cu +99 -0
- face_vid2vid/GPEN/face_model/op/upfirdn2d.cpp +23 -0
- face_vid2vid/GPEN/face_model/op/upfirdn2d.py +188 -0
- face_vid2vid/GPEN/face_model/op/upfirdn2d_kernel.cu +272 -0
- face_vid2vid/GPEN/requirements.txt +8 -0
- face_vid2vid/GPEN/retinaface/data/FDDB/img_list.txt +2845 -0
- face_vid2vid/GPEN/retinaface/data/__init__.py +3 -0
- face_vid2vid/GPEN/retinaface/data/config.py +42 -0
- face_vid2vid/GPEN/retinaface/data/data_augment.py +237 -0
- face_vid2vid/GPEN/retinaface/data/wider_face.py +101 -0
- face_vid2vid/GPEN/retinaface/facemodels/__init__.py +0 -0
- face_vid2vid/GPEN/retinaface/facemodels/net.py +137 -0
- face_vid2vid/GPEN/retinaface/facemodels/retinaface.py +127 -0
- face_vid2vid/GPEN/retinaface/layers/__init__.py +2 -0
- face_vid2vid/GPEN/retinaface/layers/functions/prior_box.py +34 -0
- face_vid2vid/GPEN/retinaface/layers/modules/__init__.py +3 -0
- face_vid2vid/GPEN/retinaface/layers/modules/multibox_loss.py +125 -0
- face_vid2vid/GPEN/retinaface/retinaface_detection.py +200 -0
- face_vid2vid/GPEN/retinaface/utils/__init__.py +0 -0
- face_vid2vid/GPEN/retinaface/utils/box_utils.py +330 -0
- face_vid2vid/GPEN/retinaface/utils/nms/__init__.py +0 -0
- face_vid2vid/GPEN/retinaface/utils/nms/py_cpu_nms.py +38 -0
- face_vid2vid/GPEN/retinaface/utils/timer.py +40 -0
- face_vid2vid/GPEN/sr_model/arch_util.py +125 -0
- face_vid2vid/GPEN/sr_model/real_esrnet.py +107 -0
- face_vid2vid/GPEN/sr_model/rrdbnet_arch.py +116 -0
- face_vid2vid/LICENSE.md +161 -0
- face_vid2vid/README.md +64 -0
- face_vid2vid/animate.py +33 -0
- face_vid2vid/augmentation.py +345 -0
- face_vid2vid/config/vox-256-spade.yaml +88 -0
- face_vid2vid/crop-video.py +158 -0
- face_vid2vid/demo.py +304 -0
- face_vid2vid/demo_utils.py +368 -0
- face_vid2vid/frames_dataset.py +154 -0
- face_vid2vid/logger.py +202 -0
- face_vid2vid/modules/dense_motion.py +128 -0
.gitignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.avi
|
2 |
+
*.png
|
3 |
+
__pycache__
|
4 |
+
__pycache__/*
|
5 |
+
.DS_Store
|
6 |
+
temp/*
|
7 |
+
results/*
|
8 |
+
*.lock
|
9 |
+
!assets/*.mp4
|
10 |
+
!tortoise/data/mel_norms.pth
|
QualityScaler
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 40a10a410cfc150871d84708157cd30020fe7ac4
|
animate_face.py
ADDED
@@ -0,0 +1,402 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import cv2
|
4 |
+
import yaml
|
5 |
+
import imageio
|
6 |
+
import numpy as np
|
7 |
+
import torch
|
8 |
+
import torch.nn.functional as F
|
9 |
+
import subprocess, platform
|
10 |
+
from mutagen.mp3 import MP3
|
11 |
+
from mutagen.wave import WAVE
|
12 |
+
from datetime import timedelta
|
13 |
+
|
14 |
+
from face_vid2vid.sync_batchnorm.replicate import DataParallelWithCallback
|
15 |
+
from face_vid2vid.modules.generator import OcclusionAwareSPADEGenerator
|
16 |
+
from face_vid2vid.modules.keypoint_detector import KPDetector, HEEstimator
|
17 |
+
from face_vid2vid.animate import normalize_kp
|
18 |
+
from batch_face import RetinaFace
|
19 |
+
|
20 |
+
|
21 |
+
if sys.version_info[0] < 3:
|
22 |
+
raise Exception("You must use Python 3 or higher. Recommended version is Python 3.7")
|
23 |
+
|
24 |
+
|
25 |
+
def load_checkpoints(config_path, checkpoint_path):
|
26 |
+
with open(config_path) as f:
|
27 |
+
config = yaml.load(f, Loader=yaml.FullLoader)
|
28 |
+
|
29 |
+
generator = OcclusionAwareSPADEGenerator(**config["model_params"]["generator_params"], **config["model_params"]["common_params"])
|
30 |
+
# convert to half precision to speed up
|
31 |
+
# generator.cuda().half()
|
32 |
+
|
33 |
+
kp_detector = KPDetector(**config["model_params"]["kp_detector_params"], **config["model_params"]["common_params"])
|
34 |
+
# the result will be wrong if converted to half precision, not sure why
|
35 |
+
# kp_detector.cuda() # .half()
|
36 |
+
|
37 |
+
he_estimator = HEEstimator(**config["model_params"]["he_estimator_params"], **config["model_params"]["common_params"])
|
38 |
+
# the result will be wrong if converted to half precision, not sure why
|
39 |
+
# he_estimator.cuda() # .half()
|
40 |
+
|
41 |
+
print("Loading checkpoints")
|
42 |
+
checkpoint = torch.load(checkpoint_path,map_location=torch.device('cpu'))
|
43 |
+
|
44 |
+
generator.load_state_dict(checkpoint["generator"])
|
45 |
+
kp_detector.load_state_dict(checkpoint["kp_detector"])
|
46 |
+
he_estimator.load_state_dict(checkpoint["he_estimator"])
|
47 |
+
|
48 |
+
generator = DataParallelWithCallback(generator)
|
49 |
+
kp_detector = DataParallelWithCallback(kp_detector)
|
50 |
+
he_estimator = DataParallelWithCallback(he_estimator)
|
51 |
+
|
52 |
+
generator.eval()
|
53 |
+
kp_detector.eval()
|
54 |
+
he_estimator.eval()
|
55 |
+
print("Model successfully loaded!")
|
56 |
+
|
57 |
+
return generator, kp_detector, he_estimator
|
58 |
+
|
59 |
+
|
60 |
+
def headpose_pred_to_degree(pred):
|
61 |
+
device = pred.device
|
62 |
+
idx_tensor = [idx for idx in range(66)]
|
63 |
+
idx_tensor = torch.FloatTensor(idx_tensor).to(device)
|
64 |
+
pred = F.softmax(pred, dim=1)
|
65 |
+
degree = torch.sum(pred * idx_tensor, axis=1) * 3 - 99
|
66 |
+
|
67 |
+
return degree
|
68 |
+
|
69 |
+
|
70 |
+
def get_rotation_matrix(yaw, pitch, roll):
|
71 |
+
yaw = yaw / 180 * 3.14
|
72 |
+
pitch = pitch / 180 * 3.14
|
73 |
+
roll = roll / 180 * 3.14
|
74 |
+
|
75 |
+
roll = roll.unsqueeze(1)
|
76 |
+
pitch = pitch.unsqueeze(1)
|
77 |
+
yaw = yaw.unsqueeze(1)
|
78 |
+
|
79 |
+
pitch_mat = torch.cat(
|
80 |
+
[
|
81 |
+
torch.ones_like(pitch),
|
82 |
+
torch.zeros_like(pitch),
|
83 |
+
torch.zeros_like(pitch),
|
84 |
+
torch.zeros_like(pitch),
|
85 |
+
torch.cos(pitch),
|
86 |
+
-torch.sin(pitch),
|
87 |
+
torch.zeros_like(pitch),
|
88 |
+
torch.sin(pitch),
|
89 |
+
torch.cos(pitch),
|
90 |
+
],
|
91 |
+
dim=1,
|
92 |
+
)
|
93 |
+
pitch_mat = pitch_mat.view(pitch_mat.shape[0], 3, 3)
|
94 |
+
|
95 |
+
yaw_mat = torch.cat(
|
96 |
+
[
|
97 |
+
torch.cos(yaw),
|
98 |
+
torch.zeros_like(yaw),
|
99 |
+
torch.sin(yaw),
|
100 |
+
torch.zeros_like(yaw),
|
101 |
+
torch.ones_like(yaw),
|
102 |
+
torch.zeros_like(yaw),
|
103 |
+
-torch.sin(yaw),
|
104 |
+
torch.zeros_like(yaw),
|
105 |
+
torch.cos(yaw),
|
106 |
+
],
|
107 |
+
dim=1,
|
108 |
+
)
|
109 |
+
yaw_mat = yaw_mat.view(yaw_mat.shape[0], 3, 3)
|
110 |
+
|
111 |
+
roll_mat = torch.cat(
|
112 |
+
[
|
113 |
+
torch.cos(roll),
|
114 |
+
-torch.sin(roll),
|
115 |
+
torch.zeros_like(roll),
|
116 |
+
torch.sin(roll),
|
117 |
+
torch.cos(roll),
|
118 |
+
torch.zeros_like(roll),
|
119 |
+
torch.zeros_like(roll),
|
120 |
+
torch.zeros_like(roll),
|
121 |
+
torch.ones_like(roll),
|
122 |
+
],
|
123 |
+
dim=1,
|
124 |
+
)
|
125 |
+
roll_mat = roll_mat.view(roll_mat.shape[0], 3, 3)
|
126 |
+
|
127 |
+
rot_mat = torch.einsum("bij,bjk,bkm->bim", pitch_mat, yaw_mat, roll_mat)
|
128 |
+
|
129 |
+
return rot_mat
|
130 |
+
|
131 |
+
|
132 |
+
def keypoint_transformation(kp_canonical, he, estimate_jacobian=False, free_view=False, yaw=0, pitch=0, roll=0, output_coord=False):
|
133 |
+
kp = kp_canonical["value"]
|
134 |
+
if not free_view:
|
135 |
+
yaw, pitch, roll = he["yaw"], he["pitch"], he["roll"]
|
136 |
+
yaw = headpose_pred_to_degree(yaw)
|
137 |
+
pitch = headpose_pred_to_degree(pitch)
|
138 |
+
roll = headpose_pred_to_degree(roll)
|
139 |
+
else:
|
140 |
+
if yaw is not None:
|
141 |
+
yaw = torch.tensor([yaw]) #.cuda()
|
142 |
+
else:
|
143 |
+
yaw = he["yaw"]
|
144 |
+
yaw = headpose_pred_to_degree(yaw)
|
145 |
+
if pitch is not None:
|
146 |
+
pitch = torch.tensor([pitch]) # .cuda()
|
147 |
+
else:
|
148 |
+
pitch = he["pitch"]
|
149 |
+
pitch = headpose_pred_to_degree(pitch)
|
150 |
+
if roll is not None:
|
151 |
+
roll = torch.tensor([roll]) # .cuda()
|
152 |
+
else:
|
153 |
+
roll = he["roll"]
|
154 |
+
roll = headpose_pred_to_degree(roll)
|
155 |
+
|
156 |
+
t, exp = he["t"], he["exp"]
|
157 |
+
|
158 |
+
rot_mat = get_rotation_matrix(yaw, pitch, roll)
|
159 |
+
|
160 |
+
# keypoint rotation
|
161 |
+
kp_rotated = torch.einsum("bmp,bkp->bkm", rot_mat, kp)
|
162 |
+
|
163 |
+
# keypoint translation
|
164 |
+
t = t.unsqueeze_(1).repeat(1, kp.shape[1], 1)
|
165 |
+
kp_t = kp_rotated + t
|
166 |
+
|
167 |
+
# add expression deviation
|
168 |
+
exp = exp.view(exp.shape[0], -1, 3)
|
169 |
+
kp_transformed = kp_t + exp
|
170 |
+
|
171 |
+
if estimate_jacobian:
|
172 |
+
jacobian = kp_canonical["jacobian"]
|
173 |
+
jacobian_transformed = torch.einsum("bmp,bkps->bkms", rot_mat, jacobian)
|
174 |
+
else:
|
175 |
+
jacobian_transformed = None
|
176 |
+
|
177 |
+
if output_coord:
|
178 |
+
return {"value": kp_transformed, "jacobian": jacobian_transformed}, {
|
179 |
+
"yaw": float(yaw.cpu().numpy()),
|
180 |
+
"pitch": float(pitch.cpu().numpy()),
|
181 |
+
"roll": float(roll.cpu().numpy()),
|
182 |
+
}
|
183 |
+
|
184 |
+
return {"value": kp_transformed, "jacobian": jacobian_transformed}
|
185 |
+
|
186 |
+
|
187 |
+
def get_square_face(coords, image):
|
188 |
+
x1, y1, x2, y2 = coords
|
189 |
+
# expand the face region by 1.5 times
|
190 |
+
length = max(x2 - x1, y2 - y1) // 2
|
191 |
+
x1 = x1 - length * 0.5
|
192 |
+
x2 = x2 + length * 0.5
|
193 |
+
y1 = y1 - length * 0.5
|
194 |
+
y2 = y2 + length * 0.5
|
195 |
+
|
196 |
+
# get square image
|
197 |
+
center = (x1 + x2) // 2, (y1 + y2) // 2
|
198 |
+
length = max(x2 - x1, y2 - y1) // 2
|
199 |
+
x1 = max(int(round(center[0] - length)), 0)
|
200 |
+
x2 = min(int(round(center[0] + length)), image.shape[1])
|
201 |
+
y1 = max(int(round(center[1] - length)), 0)
|
202 |
+
y2 = min(int(round(center[1] + length)), image.shape[0])
|
203 |
+
return image[y1:y2, x1:x2]
|
204 |
+
|
205 |
+
|
206 |
+
def smooth_coord(last_coord, current_coord, smooth_factor=0.2):
|
207 |
+
change = np.array(current_coord) - np.array(last_coord)
|
208 |
+
# smooth the change to 0.1 times
|
209 |
+
change = change * smooth_factor
|
210 |
+
return (np.array(last_coord) + np.array(change)).astype(int).tolist()
|
211 |
+
|
212 |
+
|
213 |
+
class FaceAnimationClass:
|
214 |
+
def __init__(self, source_image_path=None, use_sr=False):
|
215 |
+
assert source_image_path is not None, "source_image_path is None, please set source_image_path"
|
216 |
+
config_path = os.path.join(os.path.dirname(__file__), "face_vid2vid/config/vox-256-spade.yaml")
|
217 |
+
# save to local cache to speed loading
|
218 |
+
checkpoint_path = os.path.join(os.path.expanduser("~"), ".cache/torch/hub/checkpoints/FaceMapping.pth.tar")
|
219 |
+
if not os.path.exists(checkpoint_path):
|
220 |
+
os.makedirs(os.path.dirname(checkpoint_path), exist_ok=True)
|
221 |
+
from gdown import download
|
222 |
+
file_id = "11ZgyjKI5OcB7klcsIdPpCCX38AIX8Soc"
|
223 |
+
download(id=file_id, output=checkpoint_path, quiet=False)
|
224 |
+
if use_sr:
|
225 |
+
from face_vid2vid.GPEN.face_enhancement import FaceEnhancement
|
226 |
+
|
227 |
+
self.faceenhancer = FaceEnhancement(
|
228 |
+
size=256, model="GPEN-BFR-256", use_sr=False, sr_model="realesrnet_x2", channel_multiplier=1, narrow=0.5, use_facegan=True
|
229 |
+
)
|
230 |
+
|
231 |
+
# load checkpoints
|
232 |
+
self.generator, self.kp_detector, self.he_estimator = load_checkpoints(config_path=config_path, checkpoint_path=checkpoint_path)
|
233 |
+
source_image = cv2.cvtColor(cv2.imread(source_image_path), cv2.COLOR_RGB2BGR).astype(np.float32) / 255.
|
234 |
+
source_image = cv2.resize(source_image, (256, 256), interpolation=cv2.INTER_AREA)
|
235 |
+
source = torch.tensor(source_image[np.newaxis].astype(np.float32)).permute(0, 3, 1, 2)
|
236 |
+
self.source = source #.cuda()
|
237 |
+
|
238 |
+
# initilize face detectors
|
239 |
+
self.face_detector = RetinaFace()
|
240 |
+
self.detect_interval = 8
|
241 |
+
self.smooth_factor = 0.2
|
242 |
+
|
243 |
+
# load base frame and blank frame
|
244 |
+
self.base_frame = cv2.imread(source_image_path) if not use_sr else self.faceenhancer.process(cv2.imread(source_image_path))[0]
|
245 |
+
self.base_frame = cv2.resize(self.base_frame, (256, 256))
|
246 |
+
self.blank_frame = np.ones(self.base_frame.shape, dtype=np.uint8) * 255
|
247 |
+
cv2.putText(self.blank_frame, "Face not", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
248 |
+
cv2.putText(self.blank_frame, "detected!", (50, 100), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
249 |
+
|
250 |
+
# count for frame
|
251 |
+
self.n_frame = 0
|
252 |
+
|
253 |
+
# initilize variables
|
254 |
+
self.first_frame = True
|
255 |
+
self.last_coords = None
|
256 |
+
self.coords = None
|
257 |
+
self.use_sr = use_sr
|
258 |
+
self.kp_source = None
|
259 |
+
self.kp_driving_initial = None
|
260 |
+
|
261 |
+
|
262 |
+
def _conver_input_frame(self, frame):
|
263 |
+
frame = cv2.resize(frame, (256, 256), interpolation=cv2.INTER_NEAREST).astype(np.float32) / 255.0
|
264 |
+
return torch.tensor(frame[np.newaxis]).permute(0, 3, 1, 2) #.cuda()
|
265 |
+
|
266 |
+
def _process_first_frame(self, frame):
|
267 |
+
print("Processing first frame")
|
268 |
+
# function to process the first frame
|
269 |
+
faces = self.face_detector(frame, cv=True)
|
270 |
+
if len(faces) == 0:
|
271 |
+
raise ValueError("Face is not detected")
|
272 |
+
else:
|
273 |
+
self.coords = faces[0][0]
|
274 |
+
face = get_square_face(self.coords, frame)
|
275 |
+
self.last_coords = self.coords
|
276 |
+
|
277 |
+
# get the keypoint and headpose from the source image
|
278 |
+
with torch.no_grad():
|
279 |
+
self.kp_canonical = self.kp_detector(self.source)
|
280 |
+
self.he_source = self.he_estimator(self.source)
|
281 |
+
|
282 |
+
face_input = self._conver_input_frame(face)
|
283 |
+
he_driving_initial = self.he_estimator(face_input)
|
284 |
+
self.kp_driving_initial, coordinates = keypoint_transformation(self.kp_canonical, he_driving_initial, output_coord=True)
|
285 |
+
self.kp_source = keypoint_transformation(
|
286 |
+
self.kp_canonical, self.he_source, free_view=True, yaw=coordinates["yaw"], pitch=coordinates["pitch"], roll=coordinates["roll"]
|
287 |
+
)
|
288 |
+
|
289 |
+
def _inference(self, frame):
|
290 |
+
# function to process the rest frames
|
291 |
+
with torch.no_grad():
|
292 |
+
self.n_frame += 1
|
293 |
+
if self.first_frame:
|
294 |
+
self._process_first_frame(frame)
|
295 |
+
self.first_frame = False
|
296 |
+
else:
|
297 |
+
pass
|
298 |
+
if self.n_frame % self.detect_interval == 0:
|
299 |
+
faces = self.face_detector(frame, cv=True)
|
300 |
+
if len(faces) == 0:
|
301 |
+
raise ValueError("Face is not detected")
|
302 |
+
else:
|
303 |
+
self.coords = faces[0][0]
|
304 |
+
self.coords = smooth_coord(self.last_coords, self.coords, self.smooth_factor)
|
305 |
+
face = get_square_face(self.coords, frame)
|
306 |
+
self.last_coords = self.coords
|
307 |
+
face_input = self._conver_input_frame(face)
|
308 |
+
|
309 |
+
he_driving = self.he_estimator(face_input)
|
310 |
+
kp_driving = keypoint_transformation(self.kp_canonical, he_driving)
|
311 |
+
kp_norm = normalize_kp(
|
312 |
+
kp_source=self.kp_source,
|
313 |
+
kp_driving=kp_driving,
|
314 |
+
kp_driving_initial=self.kp_driving_initial,
|
315 |
+
use_relative_movement=True,
|
316 |
+
adapt_movement_scale=True,
|
317 |
+
)
|
318 |
+
|
319 |
+
out = self.generator(self.source, kp_source=self.kp_source, kp_driving=kp_norm, fp16=True)
|
320 |
+
image = np.transpose(out["prediction"].data.cpu().numpy(), [0, 2, 3, 1])[0]
|
321 |
+
image = (np.array(image).astype(np.float32) * 255).astype(np.uint8)
|
322 |
+
result = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
323 |
+
|
324 |
+
return face, result
|
325 |
+
|
326 |
+
def inference(self, frame):
|
327 |
+
# function to inference, input frame, output cropped face and its result
|
328 |
+
try:
|
329 |
+
if frame is not None:
|
330 |
+
face, result = self._inference(frame)
|
331 |
+
if self.use_sr:
|
332 |
+
result, _, _ = self.faceenhancer.process(result)
|
333 |
+
result = cv2.resize(result, (256, 256))
|
334 |
+
return face, result
|
335 |
+
except Exception as e:
|
336 |
+
print(e)
|
337 |
+
self.first_frame = True
|
338 |
+
self.n_frame = 0
|
339 |
+
return self.blank_frame, self.base_frame
|
340 |
+
|
341 |
+
|
342 |
+
def get_audio_duration(audioPath):
|
343 |
+
if audioPath.endswith(".mp3"):
|
344 |
+
audio = MP3(audioPath)
|
345 |
+
else:
|
346 |
+
audio = WAVE(audioPath)
|
347 |
+
duration = audio.info.length
|
348 |
+
return duration
|
349 |
+
|
350 |
+
def seconds_to_hms(seconds):
|
351 |
+
seconds = int(seconds) + 1
|
352 |
+
hms = str(timedelta(seconds=seconds))
|
353 |
+
hms = hms.split(":")
|
354 |
+
hms = [f"0{h}" if len(h) == 1 else h for h in hms]
|
355 |
+
return ":".join(hms)
|
356 |
+
|
357 |
+
def animate_face(path_id, audiofile, driverfile, imgfile, animatedfile):
|
358 |
+
from tqdm import tqdm
|
359 |
+
import time
|
360 |
+
faceanimation = FaceAnimationClass(source_image_path=os.path.abspath(imgfile), use_sr=False)
|
361 |
+
|
362 |
+
tmpfile = os.path.join("temp", path_id, "tmp.mp4")
|
363 |
+
#duration = get_audio_duration(os.path.join("temp", path_id, audiofile))
|
364 |
+
duration = get_audio_duration(os.path.abspath(audiofile))
|
365 |
+
print("duration of audio:", duration)
|
366 |
+
hms = seconds_to_hms(duration)
|
367 |
+
print("converted into hms:", hms)
|
368 |
+
|
369 |
+
# Using list for subprocess arguments
|
370 |
+
command = ["ffmpeg", "-ss", "00:00:00", "-i", driverfile, "-to", hms, "-c", "copy", tmpfile]
|
371 |
+
|
372 |
+
# Execute the command
|
373 |
+
if platform.system() == 'Windows':
|
374 |
+
subprocess.call(command, shell=False)
|
375 |
+
else:
|
376 |
+
subprocess.call(' '.join(command), shell=True)
|
377 |
+
|
378 |
+
capture = cv2.VideoCapture(tmpfile)
|
379 |
+
fps = capture.get(cv2.CAP_PROP_FPS)
|
380 |
+
frames = []
|
381 |
+
_, frame = capture.read()
|
382 |
+
while frame is not None:
|
383 |
+
frames.append(frame)
|
384 |
+
_, frame = capture.read()
|
385 |
+
capture.release()
|
386 |
+
|
387 |
+
output_frames = []
|
388 |
+
time_start = time.time()
|
389 |
+
for frame in tqdm(frames):
|
390 |
+
face, result = faceanimation.inference(frame)
|
391 |
+
# show = cv2.hconcat([cv2.resize(face, (result.shape[1], result.shape[0])), result])
|
392 |
+
output_frames.append(result)
|
393 |
+
time_end = time.time()
|
394 |
+
print("Time cost: %.2f" % (time_end - time_start), "FPS: %.2f" % (len(frames) / (time_end - time_start)))
|
395 |
+
writer = imageio.get_writer(os.path.join("temp", path_id, animatedfile), fps=fps, quality=9, macro_block_size=1,
|
396 |
+
codec="libx264", pixelformat="yuv420p")
|
397 |
+
for frame in output_frames:
|
398 |
+
writer.append_data(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
399 |
+
# writer.append_data(frame)
|
400 |
+
writer.close()
|
401 |
+
|
402 |
+
|
config.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import time
|
3 |
+
import os
|
4 |
+
|
5 |
+
OPENAI_API_KEY = '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'
|
6 |
+
path_id = ""
|
7 |
+
checkpoint_path="wav2lip/wav2lip_gan.pth"
|
8 |
+
outfile="out.mp4"
|
9 |
+
audiofile="voices/output.mp3"
|
10 |
+
#imgfile="images/output.png"
|
11 |
+
imgfile="images/image.png"
|
12 |
+
driverfile="face_vid2vid/assets/christmas.mp4"
|
13 |
+
animatedfile="animated.mp4"
|
14 |
+
static=False
|
15 |
+
fps=25
|
16 |
+
pads=[0, 10, 0, 0]
|
17 |
+
face_det_batch_size=16
|
18 |
+
wav2lip_batch_size=128
|
19 |
+
resize_factor=0.5
|
20 |
+
crop=[0, -1, 0, -1]
|
21 |
+
box=[-1, -1, -1, -1]
|
22 |
+
img_size = 96
|
23 |
+
rotate=False
|
24 |
+
nosmooth=False
|
25 |
+
mel_step_size = 16
|
26 |
+
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
27 |
+
device = 'cpu'
|
28 |
+
print('Using {} for inference.'.format(device))
|
29 |
+
|
30 |
+
import warnings
|
31 |
+
warnings.filterwarnings('ignore')
|
32 |
+
|
33 |
+
def init_path_id():
|
34 |
+
path_id = str(int(time.time()))
|
35 |
+
path = os.path.join("temp", path_id)
|
36 |
+
os.makedirs(path, exist_ok=True)
|
37 |
+
return path_id, path
|
38 |
+
|
39 |
+
|
face_vid2vid/GPEN/README.md
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# GAN Prior Embedded Network for Blind Face Restoration in the Wild
|
2 |
+
|
3 |
+
[Paper](https://arxiv.org/abs/2105.06070) | [Supplementary](https://www4.comp.polyu.edu.hk/~cslzhang/paper/GPEN-cvpr21-supp.pdf) | [Demo](https://vision.aliyun.com/experience/detail?spm=a211p3.14020179.J_7524944390.17.66cd4850wVDkUQ&tagName=facebody&children=EnhanceFace)
|
4 |
+
|
5 |
+
[Tao Yang](https://cg.cs.tsinghua.edu.cn/people/~tyang)<sup>1</sup>, Peiran Ren<sup>1</sup>, Xuansong Xie<sup>1</sup>, [Lei Zhang](https://www4.comp.polyu.edu.hk/~cslzhang)<sup>1,2</sup>
|
6 |
+
_<sup>1</sup>[DAMO Academy, Alibaba Group](https://damo.alibaba.com), Hangzhou, China_
|
7 |
+
_<sup>2</sup>[Department of Computing, The Hong Kong Polytechnic University](http://www.comp.polyu.edu.hk), Hong Kong, China_
|
8 |
+
|
9 |
+
#### Face Restoration
|
10 |
+
|
11 |
+
<img src="figs/real_00.png" width="390px"/> <img src="figs/real_01.png" width="390px"/>
|
12 |
+
<img src="figs/real_02.png" width="390px"/> <img src="figs/real_03.png" width="390px"/>
|
13 |
+
|
14 |
+
<img src="figs/Solvay_conference_1927_comp.jpg" width="784px"/>
|
15 |
+
|
16 |
+
#### Face Colorization
|
17 |
+
|
18 |
+
<img src="figs/colorization_00.jpg" width="390px"/> <img src="figs/colorization_01.jpg" width="390px"/>
|
19 |
+
|
20 |
+
#### Face Inpainting
|
21 |
+
|
22 |
+
<img src="figs/inpainting_00.jpg" width="390px"/> <img src="figs/inpainting_01.jpg" width="390px"/>
|
23 |
+
|
24 |
+
#### Conditional Image Synthesis (Seg2Face)
|
25 |
+
|
26 |
+
<img src="figs/seg2face_00.jpg" width="390px"/> <img src="figs/seg2face_01.jpg" width="390px"/>
|
27 |
+
|
28 |
+
## News
|
29 |
+
(2021-07-06) The training code will be released soon. Stay tuned.
|
30 |
+
|
31 |
+
(2021-10-11) The Colab demo for GPEN is available now <a href="https://colab.research.google.com/drive/1fPUsJCpQipp2Z5B5GbEXqpBGsMp-nvjm?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"></a>.
|
32 |
+
|
33 |
+
(2021-10-22) GPEN can now work with SR methods. A SR model trained by myself is provided. Replace it with your own model if necessary.
|
34 |
+
|
35 |
+
## Usage
|
36 |
+
|
37 |
+

|
38 |
+

|
39 |
+

|
40 |
+

|
41 |
+

|
42 |
+
|
43 |
+
- Clone this repository:
|
44 |
+
```bash
|
45 |
+
git clone https://github.com/yangxy/GPEN.git
|
46 |
+
cd GPEN
|
47 |
+
```
|
48 |
+
- Download RetinaFace model and our pre-trained model (not our best model due to commercial issues) and put them into ``weights/``.
|
49 |
+
|
50 |
+
[RetinaFace-R50](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/RetinaFace-R50.pth) | [GPEN-BFR-512](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-BFR-512.pth) | [GPEN-BFR-512-D](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-BFR-512-D.pth) | [GPEN-BFR-256](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-BFR-256.pth) | [GPEN-Colorization-1024](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-Colorization-1024.pth) | [GPEN-Inpainting-1024](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-Inpainting-1024.pth) | [GPEN-Seg2face-512](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-Seg2face-512.pth) | [rrdb_realesrnet_psnr](https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/rrdb_realesrnet_psnr.pth)
|
51 |
+
|
52 |
+
- Restore face images:
|
53 |
+
```bash
|
54 |
+
python face_enhancement.py --model GPEN-BFR-512 --size 512 --channel_multiplier 2 --narrow 1 --use_sr --indir examples/imgs --outdir examples/outs-BFR
|
55 |
+
```
|
56 |
+
|
57 |
+
- Colorize faces:
|
58 |
+
```bash
|
59 |
+
python face_colorization.py
|
60 |
+
```
|
61 |
+
|
62 |
+
- Complete faces:
|
63 |
+
```bash
|
64 |
+
python face_inpainting.py
|
65 |
+
```
|
66 |
+
|
67 |
+
- Synthesize faces:
|
68 |
+
```bash
|
69 |
+
python segmentation2face.py
|
70 |
+
```
|
71 |
+
|
72 |
+
## Main idea
|
73 |
+
<img src="figs/architecture.png" width="784px"/>
|
74 |
+
|
75 |
+
## Citation
|
76 |
+
If our work is useful for your research, please consider citing:
|
77 |
+
|
78 |
+
@inproceedings{Yang2021GPEN,
|
79 |
+
title={GAN Prior Embedded Network for Blind Face Restoration in the Wild},
|
80 |
+
author={Tao Yang, Peiran Ren, Xuansong Xie, and Lei Zhang},
|
81 |
+
booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
|
82 |
+
year={2021}
|
83 |
+
}
|
84 |
+
|
85 |
+
## License
|
86 |
+
© Alibaba, 2021. For academic and non-commercial use only.
|
87 |
+
|
88 |
+
## Acknowledgments
|
89 |
+
We borrow some codes from [Pytorch_Retinaface](https://github.com/biubug6/Pytorch_Retinaface), [stylegan2-pytorch](https://github.com/rosinality/stylegan2-pytorch), and [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN).
|
90 |
+
|
91 |
+
## Contact
|
92 |
+
If you have any questions or suggestions about this paper, feel free to reach me at [email protected].
|
face_vid2vid/GPEN/__init_paths.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
@paper: GAN Prior Embedded Network for Blind Face Restoration in the Wild (CVPR2021)
|
3 |
+
@author: yangxy ([email protected])
|
4 |
+
'''
|
5 |
+
import os.path as osp
|
6 |
+
import sys
|
7 |
+
|
8 |
+
def add_path(path):
|
9 |
+
if path not in sys.path:
|
10 |
+
sys.path.insert(0, path)
|
11 |
+
|
12 |
+
this_dir = osp.dirname(__file__)
|
13 |
+
|
14 |
+
path = osp.join(this_dir, 'retinaface')
|
15 |
+
add_path(path)
|
16 |
+
|
17 |
+
path = osp.join(this_dir, 'face_model')
|
18 |
+
add_path(path)
|
19 |
+
|
20 |
+
path = osp.join(this_dir, 'sr_model')
|
21 |
+
add_path(path)
|
face_vid2vid/GPEN/align_faces.py
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""
|
3 |
+
Created on Mon Apr 24 15:43:29 2017
|
4 |
+
@author: zhaoy
|
5 |
+
"""
|
6 |
+
"""
|
7 |
+
@Modified by yangxy ([email protected])
|
8 |
+
"""
|
9 |
+
import cv2
|
10 |
+
import numpy as np
|
11 |
+
from skimage import transform as trans
|
12 |
+
|
13 |
+
# reference facial points, a list of coordinates (x,y)
|
14 |
+
REFERENCE_FACIAL_POINTS = [
|
15 |
+
[30.29459953, 51.69630051],
|
16 |
+
[65.53179932, 51.50139999],
|
17 |
+
[48.02519989, 71.73660278],
|
18 |
+
[33.54930115, 92.3655014],
|
19 |
+
[62.72990036, 92.20410156],
|
20 |
+
]
|
21 |
+
|
22 |
+
DEFAULT_CROP_SIZE = (96, 112)
|
23 |
+
|
24 |
+
|
25 |
+
def _umeyama(src, dst, estimate_scale=True, scale=1.0):
|
26 |
+
"""Estimate N-D similarity transformation with or without scaling.
|
27 |
+
Parameters
|
28 |
+
----------
|
29 |
+
src : (M, N) array
|
30 |
+
Source coordinates.
|
31 |
+
dst : (M, N) array
|
32 |
+
Destination coordinates.
|
33 |
+
estimate_scale : bool
|
34 |
+
Whether to estimate scaling factor.
|
35 |
+
Returns
|
36 |
+
-------
|
37 |
+
T : (N + 1, N + 1)
|
38 |
+
The homogeneous similarity transformation matrix. The matrix contains
|
39 |
+
NaN values only if the problem == not well-conditioned.
|
40 |
+
References
|
41 |
+
----------
|
42 |
+
.. [1] "Least-squares estimation of transformation parameters between two
|
43 |
+
point patterns", Shinji Umeyama, PAMI 1991, :DOI:`10.1109/34.88573`
|
44 |
+
"""
|
45 |
+
|
46 |
+
num = src.shape[0]
|
47 |
+
dim = src.shape[1]
|
48 |
+
|
49 |
+
# Compute mean of src and dst.
|
50 |
+
src_mean = src.mean(axis=0)
|
51 |
+
dst_mean = dst.mean(axis=0)
|
52 |
+
|
53 |
+
# Subtract mean from src and dst.
|
54 |
+
src_demean = src - src_mean
|
55 |
+
dst_demean = dst - dst_mean
|
56 |
+
|
57 |
+
# Eq. (38).
|
58 |
+
A = dst_demean.T @ src_demean / num
|
59 |
+
|
60 |
+
# Eq. (39).
|
61 |
+
d = np.ones((dim,), dtype=np.double)
|
62 |
+
if np.linalg.det(A) < 0:
|
63 |
+
d[dim - 1] = -1
|
64 |
+
|
65 |
+
T = np.eye(dim + 1, dtype=np.double)
|
66 |
+
|
67 |
+
U, S, V = np.linalg.svd(A)
|
68 |
+
|
69 |
+
# Eq. (40) and (43).
|
70 |
+
rank = np.linalg.matrix_rank(A)
|
71 |
+
if rank == 0:
|
72 |
+
return np.nan * T
|
73 |
+
elif rank == dim - 1:
|
74 |
+
if np.linalg.det(U) * np.linalg.det(V) > 0:
|
75 |
+
T[:dim, :dim] = U @ V
|
76 |
+
else:
|
77 |
+
s = d[dim - 1]
|
78 |
+
d[dim - 1] = -1
|
79 |
+
T[:dim, :dim] = U @ np.diag(d) @ V
|
80 |
+
d[dim - 1] = s
|
81 |
+
else:
|
82 |
+
T[:dim, :dim] = U @ np.diag(d) @ V
|
83 |
+
|
84 |
+
if estimate_scale:
|
85 |
+
# Eq. (41) and (42).
|
86 |
+
scale = 1.0 / src_demean.var(axis=0).sum() * (S @ d)
|
87 |
+
else:
|
88 |
+
scale = scale
|
89 |
+
|
90 |
+
T[:dim, dim] = dst_mean - scale * (T[:dim, :dim] @ src_mean.T)
|
91 |
+
T[:dim, :dim] *= scale
|
92 |
+
|
93 |
+
return T, scale
|
94 |
+
|
95 |
+
|
96 |
+
class FaceWarpException(Exception):
|
97 |
+
def __str__(self):
|
98 |
+
return "In File {}:{}".format(__file__, super.__str__(self))
|
99 |
+
|
100 |
+
|
101 |
+
def get_reference_facial_points(output_size=None, inner_padding_factor=0.0, outer_padding=(0, 0), default_square=False):
|
102 |
+
tmp_5pts = np.array(REFERENCE_FACIAL_POINTS)
|
103 |
+
tmp_crop_size = np.array(DEFAULT_CROP_SIZE)
|
104 |
+
|
105 |
+
# 0) make the inner region a square
|
106 |
+
if default_square:
|
107 |
+
size_diff = max(tmp_crop_size) - tmp_crop_size
|
108 |
+
tmp_5pts += size_diff / 2
|
109 |
+
tmp_crop_size += size_diff
|
110 |
+
|
111 |
+
if output_size and output_size[0] == tmp_crop_size[0] and output_size[1] == tmp_crop_size[1]:
|
112 |
+
print("output_size == DEFAULT_CROP_SIZE {}: return default reference points".format(tmp_crop_size))
|
113 |
+
return tmp_5pts
|
114 |
+
|
115 |
+
if inner_padding_factor == 0 and outer_padding == (0, 0):
|
116 |
+
if output_size is None:
|
117 |
+
print("No paddings to do: return default reference points")
|
118 |
+
return tmp_5pts
|
119 |
+
else:
|
120 |
+
raise FaceWarpException("No paddings to do, output_size must be None or {}".format(tmp_crop_size))
|
121 |
+
|
122 |
+
# check output size
|
123 |
+
if not (0 <= inner_padding_factor <= 1.0):
|
124 |
+
raise FaceWarpException("Not (0 <= inner_padding_factor <= 1.0)")
|
125 |
+
|
126 |
+
if (inner_padding_factor > 0 or outer_padding[0] > 0 or outer_padding[1] > 0) and output_size is None:
|
127 |
+
output_size = tmp_crop_size * (1 + inner_padding_factor * 2).astype(np.int32)
|
128 |
+
output_size += np.array(outer_padding)
|
129 |
+
print(" deduced from paddings, output_size = ", output_size)
|
130 |
+
|
131 |
+
if not (outer_padding[0] < output_size[0] and outer_padding[1] < output_size[1]):
|
132 |
+
raise FaceWarpException("Not (outer_padding[0] < output_size[0]" "and outer_padding[1] < output_size[1])")
|
133 |
+
|
134 |
+
# 1) pad the inner region according inner_padding_factor
|
135 |
+
# print('---> STEP1: pad the inner region according inner_padding_factor')
|
136 |
+
if inner_padding_factor > 0:
|
137 |
+
size_diff = tmp_crop_size * inner_padding_factor * 2
|
138 |
+
tmp_5pts += size_diff / 2
|
139 |
+
tmp_crop_size += np.round(size_diff).astype(np.int32)
|
140 |
+
|
141 |
+
# print(' crop_size = ', tmp_crop_size)
|
142 |
+
# print(' reference_5pts = ', tmp_5pts)
|
143 |
+
|
144 |
+
# 2) resize the padded inner region
|
145 |
+
# print('---> STEP2: resize the padded inner region')
|
146 |
+
size_bf_outer_pad = np.array(output_size) - np.array(outer_padding) * 2
|
147 |
+
# print(' crop_size = ', tmp_crop_size)
|
148 |
+
# print(' size_bf_outer_pad = ', size_bf_outer_pad)
|
149 |
+
|
150 |
+
if size_bf_outer_pad[0] * tmp_crop_size[1] != size_bf_outer_pad[1] * tmp_crop_size[0]:
|
151 |
+
raise FaceWarpException("Must have (output_size - outer_padding)" "= some_scale * (crop_size * (1.0 + inner_padding_factor)")
|
152 |
+
|
153 |
+
scale_factor = size_bf_outer_pad[0].astype(np.float32) / tmp_crop_size[0]
|
154 |
+
# print(' resize scale_factor = ', scale_factor)
|
155 |
+
tmp_5pts = tmp_5pts * scale_factor
|
156 |
+
# size_diff = tmp_crop_size * (scale_factor - min(scale_factor))
|
157 |
+
# tmp_5pts = tmp_5pts + size_diff / 2
|
158 |
+
tmp_crop_size = size_bf_outer_pad
|
159 |
+
# print(' crop_size = ', tmp_crop_size)
|
160 |
+
# print(' reference_5pts = ', tmp_5pts)
|
161 |
+
|
162 |
+
# 3) add outer_padding to make output_size
|
163 |
+
reference_5point = tmp_5pts + np.array(outer_padding)
|
164 |
+
tmp_crop_size = output_size
|
165 |
+
# print('---> STEP3: add outer_padding to make output_size')
|
166 |
+
# print(' crop_size = ', tmp_crop_size)
|
167 |
+
# print(' reference_5pts = ', tmp_5pts)
|
168 |
+
#
|
169 |
+
# print('===> end get_reference_facial_points\n')
|
170 |
+
|
171 |
+
return reference_5point
|
172 |
+
|
173 |
+
|
174 |
+
def get_affine_transform_matrix(src_pts, dst_pts):
|
175 |
+
tfm = np.float32([[1, 0, 0], [0, 1, 0]])
|
176 |
+
n_pts = src_pts.shape[0]
|
177 |
+
ones = np.ones((n_pts, 1), src_pts.dtype)
|
178 |
+
src_pts_ = np.hstack([src_pts, ones])
|
179 |
+
dst_pts_ = np.hstack([dst_pts, ones])
|
180 |
+
|
181 |
+
A, res, rank, s = np.linalg.lstsq(src_pts_, dst_pts_)
|
182 |
+
|
183 |
+
if rank == 3:
|
184 |
+
tfm = np.float32([[A[0, 0], A[1, 0], A[2, 0]], [A[0, 1], A[1, 1], A[2, 1]]])
|
185 |
+
elif rank == 2:
|
186 |
+
tfm = np.float32([[A[0, 0], A[1, 0], 0], [A[0, 1], A[1, 1], 0]])
|
187 |
+
|
188 |
+
return tfm
|
189 |
+
|
190 |
+
|
191 |
+
def warp_and_crop_face(src_img, facial_pts, reference_pts=None, crop_size=(96, 112), align_type="smilarity"): # smilarity cv2_affine affine
|
192 |
+
if reference_pts is None:
|
193 |
+
if crop_size[0] == 96 and crop_size[1] == 112:
|
194 |
+
reference_pts = REFERENCE_FACIAL_POINTS
|
195 |
+
else:
|
196 |
+
default_square = False
|
197 |
+
inner_padding_factor = 0
|
198 |
+
outer_padding = (0, 0)
|
199 |
+
output_size = crop_size
|
200 |
+
|
201 |
+
reference_pts = get_reference_facial_points(output_size, inner_padding_factor, outer_padding, default_square)
|
202 |
+
ref_pts = np.float32(reference_pts)
|
203 |
+
ref_pts_shp = ref_pts.shape
|
204 |
+
if max(ref_pts_shp) < 3 or min(ref_pts_shp) != 2:
|
205 |
+
raise FaceWarpException("reference_pts.shape must be (K,2) or (2,K) and K>2")
|
206 |
+
|
207 |
+
if ref_pts_shp[0] == 2:
|
208 |
+
ref_pts = ref_pts.T
|
209 |
+
|
210 |
+
src_pts = np.float32(facial_pts)
|
211 |
+
src_pts_shp = src_pts.shape
|
212 |
+
if max(src_pts_shp) < 3 or min(src_pts_shp) != 2:
|
213 |
+
raise FaceWarpException("facial_pts.shape must be (K,2) or (2,K) and K>2")
|
214 |
+
|
215 |
+
if src_pts_shp[0] == 2:
|
216 |
+
src_pts = src_pts.T
|
217 |
+
|
218 |
+
if src_pts.shape != ref_pts.shape:
|
219 |
+
raise FaceWarpException("facial_pts and reference_pts must have the same shape")
|
220 |
+
|
221 |
+
if align_type == "cv2_affine":
|
222 |
+
tfm = cv2.getAffineTransform(src_pts[0:3], ref_pts[0:3])
|
223 |
+
tfm_inv = cv2.getAffineTransform(ref_pts[0:3], src_pts[0:3])
|
224 |
+
elif align_type == "affine":
|
225 |
+
tfm = get_affine_transform_matrix(src_pts, ref_pts)
|
226 |
+
tfm_inv = get_affine_transform_matrix(ref_pts, src_pts)
|
227 |
+
else:
|
228 |
+
params, scale = _umeyama(src_pts, ref_pts)
|
229 |
+
tfm = params[:2, :]
|
230 |
+
|
231 |
+
params, _ = _umeyama(ref_pts, src_pts, False, scale=1.0 / scale)
|
232 |
+
tfm_inv = params[:2, :]
|
233 |
+
|
234 |
+
face_img = cv2.warpAffine(src_img, tfm, (crop_size[0], crop_size[1]), flags=3)
|
235 |
+
|
236 |
+
return face_img, tfm_inv
|
face_vid2vid/GPEN/face_enhancement.py
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
@paper: GAN Prior Embedded Network for Blind Face Restoration in the Wild (CVPR2021)
|
3 |
+
@author: yangxy ([email protected])
|
4 |
+
"""
|
5 |
+
import os
|
6 |
+
import cv2
|
7 |
+
import glob
|
8 |
+
import time
|
9 |
+
import argparse
|
10 |
+
import numpy as np
|
11 |
+
from PIL import Image
|
12 |
+
from skimage import transform as tf
|
13 |
+
|
14 |
+
import GPEN.__init_paths as init_paths
|
15 |
+
from GPEN.retinaface.retinaface_detection import RetinaFaceDetection
|
16 |
+
from GPEN.face_model.face_gan import FaceGAN
|
17 |
+
from GPEN.sr_model.real_esrnet import RealESRNet
|
18 |
+
from GPEN.align_faces import warp_and_crop_face, get_reference_facial_points
|
19 |
+
|
20 |
+
def check_ckpts(model, sr_model):
|
21 |
+
# check if checkpoints are downloaded
|
22 |
+
try:
|
23 |
+
ckpts_folder = os.path.join(os.path.dirname(__file__), "weights")
|
24 |
+
if not os.path.exists(ckpts_folder):
|
25 |
+
print("Downloading checkpoints...")
|
26 |
+
from gdown import download_folder
|
27 |
+
file_id = "1epln5c8HW1QXfVz6444Fe0hG-vRNavi6"
|
28 |
+
download_folder(id=file_id, output=ckpts_folder, quiet=False, use_cookies=False)
|
29 |
+
else:
|
30 |
+
print("Checkpoints already downloaded, skipping...")
|
31 |
+
except Exception as e:
|
32 |
+
print(e)
|
33 |
+
raise Exception("Error while downloading checkpoints")
|
34 |
+
|
35 |
+
|
36 |
+
class FaceEnhancement(object):
|
37 |
+
def __init__(self, base_dir=os.path.dirname(__file__), size=512, model=None, use_sr=True, sr_model=None, channel_multiplier=2, narrow=1, use_facegan=True):
|
38 |
+
check_ckpts(model, sr_model)
|
39 |
+
|
40 |
+
self.facedetector = RetinaFaceDetection(base_dir)
|
41 |
+
self.facegan = FaceGAN(base_dir, size, model, channel_multiplier, narrow)
|
42 |
+
self.srmodel = RealESRNet(base_dir, sr_model)
|
43 |
+
self.use_sr = use_sr
|
44 |
+
self.size = size
|
45 |
+
self.threshold = 0.9
|
46 |
+
self.use_facegan = use_facegan
|
47 |
+
|
48 |
+
# the mask for pasting restored faces back
|
49 |
+
self.mask = np.zeros((512, 512), np.float32)
|
50 |
+
cv2.rectangle(self.mask, (26, 26), (486, 486), (1, 1, 1), -1, cv2.LINE_AA)
|
51 |
+
self.mask = cv2.GaussianBlur(self.mask, (101, 101), 11)
|
52 |
+
self.mask = cv2.GaussianBlur(self.mask, (101, 101), 11)
|
53 |
+
|
54 |
+
self.kernel = np.array(([0.0625, 0.125, 0.0625], [0.125, 0.25, 0.125], [0.0625, 0.125, 0.0625]), dtype="float32")
|
55 |
+
|
56 |
+
# get the reference 5 landmarks position in the crop settings
|
57 |
+
default_square = True
|
58 |
+
inner_padding_factor = 0.25
|
59 |
+
outer_padding = (0, 0)
|
60 |
+
self.reference_5pts = get_reference_facial_points((self.size, self.size), inner_padding_factor, outer_padding, default_square)
|
61 |
+
|
62 |
+
def process(self, img):
|
63 |
+
if self.use_sr:
|
64 |
+
img_sr = self.srmodel.process(img)
|
65 |
+
if img_sr is not None:
|
66 |
+
img = cv2.resize(img, img_sr.shape[:2][::-1])
|
67 |
+
|
68 |
+
facebs, landms = self.facedetector.detect(img)
|
69 |
+
|
70 |
+
orig_faces, enhanced_faces = [], []
|
71 |
+
height, width = img.shape[:2]
|
72 |
+
full_mask = np.zeros((height, width), dtype=np.float32)
|
73 |
+
full_img = np.zeros(img.shape, dtype=np.uint8)
|
74 |
+
|
75 |
+
for i, (faceb, facial5points) in enumerate(zip(facebs, landms)):
|
76 |
+
if faceb[4] < self.threshold:
|
77 |
+
continue
|
78 |
+
fh, fw = (faceb[3] - faceb[1]), (faceb[2] - faceb[0])
|
79 |
+
|
80 |
+
facial5points = np.reshape(facial5points, (2, 5))
|
81 |
+
|
82 |
+
of, tfm_inv = warp_and_crop_face(img, facial5points, reference_pts=self.reference_5pts, crop_size=(self.size, self.size))
|
83 |
+
|
84 |
+
# enhance the face
|
85 |
+
ef = self.facegan.process(of) if self.use_facegan else of
|
86 |
+
|
87 |
+
orig_faces.append(of)
|
88 |
+
enhanced_faces.append(ef)
|
89 |
+
|
90 |
+
tmp_mask = self.mask
|
91 |
+
tmp_mask = cv2.resize(tmp_mask, ef.shape[:2])
|
92 |
+
tmp_mask = cv2.warpAffine(tmp_mask, tfm_inv, (width, height), flags=3)
|
93 |
+
|
94 |
+
if min(fh, fw) < 100: # gaussian filter for small faces
|
95 |
+
ef = cv2.filter2D(ef, -1, self.kernel)
|
96 |
+
|
97 |
+
tmp_img = cv2.warpAffine(ef, tfm_inv, (width, height), flags=3)
|
98 |
+
|
99 |
+
mask = tmp_mask - full_mask
|
100 |
+
full_mask[np.where(mask > 0)] = tmp_mask[np.where(mask > 0)]
|
101 |
+
full_img[np.where(mask > 0)] = tmp_img[np.where(mask > 0)]
|
102 |
+
|
103 |
+
full_mask = full_mask[:, :, np.newaxis]
|
104 |
+
if self.use_sr and img_sr is not None:
|
105 |
+
img = cv2.convertScaleAbs(img_sr * (1 - full_mask) + full_img * full_mask)
|
106 |
+
else:
|
107 |
+
img = cv2.convertScaleAbs(img * (1 - full_mask) + full_img * full_mask)
|
108 |
+
|
109 |
+
return img, orig_faces, enhanced_faces
|
110 |
+
|
111 |
+
|
112 |
+
if __name__ == "__main__":
|
113 |
+
parser = argparse.ArgumentParser()
|
114 |
+
parser.add_argument("--model", type=str, default="GPEN-BFR-512", help="GPEN model")
|
115 |
+
parser.add_argument("--size", type=int, default=512, help="resolution of GPEN")
|
116 |
+
parser.add_argument("--channel_multiplier", type=int, default=2, help="channel multiplier of GPEN")
|
117 |
+
parser.add_argument("--narrow", type=float, default=1, help="channel narrow scale")
|
118 |
+
parser.add_argument("--use_sr", action="store_true", help="use sr or not")
|
119 |
+
parser.add_argument("--sr_model", type=str, default="realesrnet_x2", help="SR model")
|
120 |
+
parser.add_argument("--sr_scale", type=int, default=2, help="SR scale")
|
121 |
+
parser.add_argument("--indir", type=str, default="examples/imgs", help="input folder")
|
122 |
+
parser.add_argument("--outdir", type=str, default="results/outs-BFR", help="output folder")
|
123 |
+
args = parser.parse_args()
|
124 |
+
|
125 |
+
# model = {'name':'GPEN-BFR-512', 'size':512, 'channel_multiplier':2, 'narrow':1}
|
126 |
+
# model = {'name':'GPEN-BFR-256', 'size':256, 'channel_multiplier':1, 'narrow':0.5}
|
127 |
+
|
128 |
+
os.makedirs(args.outdir, exist_ok=True)
|
129 |
+
|
130 |
+
faceenhancer = FaceEnhancement(
|
131 |
+
size=args.size,
|
132 |
+
model=args.model,
|
133 |
+
use_sr=args.use_sr,
|
134 |
+
sr_model=args.sr_model,
|
135 |
+
channel_multiplier=args.channel_multiplier,
|
136 |
+
narrow=args.narrow,
|
137 |
+
)
|
138 |
+
|
139 |
+
files = sorted(glob.glob(os.path.join(args.indir, "*.*g")))
|
140 |
+
for n, file in enumerate(files[:]):
|
141 |
+
filename = os.path.basename(file)
|
142 |
+
|
143 |
+
im = cv2.imread(file, cv2.IMREAD_COLOR) # BGR
|
144 |
+
if not isinstance(im, np.ndarray):
|
145 |
+
print(filename, "error")
|
146 |
+
continue
|
147 |
+
# im = cv2.resize(im, (0,0), fx=2, fy=2) # optional
|
148 |
+
|
149 |
+
img, orig_faces, enhanced_faces = faceenhancer.process(im)
|
150 |
+
|
151 |
+
im = cv2.resize(im, img.shape[:2][::-1])
|
152 |
+
cv2.imwrite(os.path.join(args.outdir, ".".join(filename.split(".")[:-1]) + "_COMP.jpg"), np.hstack((im, img)))
|
153 |
+
cv2.imwrite(os.path.join(args.outdir, ".".join(filename.split(".")[:-1]) + "_GPEN.jpg"), img)
|
154 |
+
|
155 |
+
for m, (ef, of) in enumerate(zip(enhanced_faces, orig_faces)):
|
156 |
+
of = cv2.resize(of, ef.shape[:2])
|
157 |
+
cv2.imwrite(os.path.join(args.outdir, ".".join(filename.split(".")[:-1]) + "_face%02d" % m + ".jpg"), np.hstack((of, ef)))
|
158 |
+
|
159 |
+
if n % 10 == 0:
|
160 |
+
print(n, filename)
|
face_vid2vid/GPEN/face_model/face_gan.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
@paper: GAN Prior Embedded Network for Blind Face Restoration in the Wild (CVPR2021)
|
3 |
+
@author: yangxy ([email protected])
|
4 |
+
'''
|
5 |
+
import torch
|
6 |
+
import os
|
7 |
+
import cv2
|
8 |
+
import glob
|
9 |
+
import numpy as np
|
10 |
+
from torch import nn
|
11 |
+
import torch.nn.functional as F
|
12 |
+
from torchvision import transforms, utils
|
13 |
+
from model import FullGenerator
|
14 |
+
import torch
|
15 |
+
|
16 |
+
class FaceGAN(object):
|
17 |
+
def __init__(self, base_dir='./', size=512, model=None, channel_multiplier=2, narrow=1, is_norm=True):
|
18 |
+
self.mfile = os.path.join(base_dir, 'weights', model+'.pth')
|
19 |
+
self.n_mlp = 8
|
20 |
+
self.is_norm = is_norm
|
21 |
+
self.resolution = size
|
22 |
+
self.load_model(channel_multiplier, narrow)
|
23 |
+
|
24 |
+
def load_model(self, channel_multiplier=2, narrow=1):
|
25 |
+
self.model = FullGenerator(self.resolution, 512, self.n_mlp, channel_multiplier, narrow=narrow).cuda()
|
26 |
+
pretrained_dict = torch.load(self.mfile,map_location=torch.device('cpu'))
|
27 |
+
self.model.load_state_dict(pretrained_dict)
|
28 |
+
self.model.eval()
|
29 |
+
|
30 |
+
def process(self, img):
|
31 |
+
img = cv2.resize(img, (self.resolution, self.resolution))
|
32 |
+
img_t = self.img2tensor(img)
|
33 |
+
|
34 |
+
with torch.no_grad():
|
35 |
+
out, __ = self.model(img_t)
|
36 |
+
|
37 |
+
out = self.tensor2img(out)
|
38 |
+
|
39 |
+
return out
|
40 |
+
|
41 |
+
def img2tensor(self, img):
|
42 |
+
img_t = torch.from_numpy(img).cuda()/255.
|
43 |
+
if self.is_norm:
|
44 |
+
img_t = (img_t - 0.5) / 0.5
|
45 |
+
img_t = img_t.permute(2, 0, 1).unsqueeze(0).flip(1) # BGR->RGB
|
46 |
+
return img_t
|
47 |
+
|
48 |
+
def tensor2img(self, img_t, pmax=255.0, imtype=np.uint8):
|
49 |
+
if self.is_norm:
|
50 |
+
img_t = img_t * 0.5 + 0.5
|
51 |
+
img_t = img_t.squeeze(0).permute(1, 2, 0).flip(2) # RGB->BGR
|
52 |
+
img_np = np.clip(img_t.float().cpu().numpy(), 0, 1) * pmax
|
53 |
+
|
54 |
+
return img_np.astype(imtype)
|
face_vid2vid/GPEN/face_model/model.py
ADDED
@@ -0,0 +1,736 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
@paper: GAN Prior Embedded Network for Blind Face Restoration in the Wild (CVPR2021)
|
3 |
+
@author: yangxy ([email protected])
|
4 |
+
'''
|
5 |
+
import math
|
6 |
+
import random
|
7 |
+
import functools
|
8 |
+
import operator
|
9 |
+
import itertools
|
10 |
+
|
11 |
+
import torch
|
12 |
+
from torch import nn
|
13 |
+
from torch.nn import functional as F
|
14 |
+
from torch.autograd import Function
|
15 |
+
|
16 |
+
from op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
|
17 |
+
|
18 |
+
class PixelNorm(nn.Module):
|
19 |
+
def __init__(self):
|
20 |
+
super().__init__()
|
21 |
+
|
22 |
+
def forward(self, input):
|
23 |
+
return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim=True) + 1e-8)
|
24 |
+
|
25 |
+
|
26 |
+
def make_kernel(k):
|
27 |
+
k = torch.tensor(k, dtype=torch.float32)
|
28 |
+
|
29 |
+
if k.ndim == 1:
|
30 |
+
k = k[None, :] * k[:, None]
|
31 |
+
|
32 |
+
k /= k.sum()
|
33 |
+
|
34 |
+
return k
|
35 |
+
|
36 |
+
|
37 |
+
class Upsample(nn.Module):
|
38 |
+
def __init__(self, kernel, factor=2):
|
39 |
+
super().__init__()
|
40 |
+
|
41 |
+
self.factor = factor
|
42 |
+
kernel = make_kernel(kernel) * (factor ** 2)
|
43 |
+
self.register_buffer('kernel', kernel)
|
44 |
+
|
45 |
+
p = kernel.shape[0] - factor
|
46 |
+
|
47 |
+
pad0 = (p + 1) // 2 + factor - 1
|
48 |
+
pad1 = p // 2
|
49 |
+
|
50 |
+
self.pad = (pad0, pad1)
|
51 |
+
|
52 |
+
def forward(self, input):
|
53 |
+
out = upfirdn2d(input, self.kernel, up=self.factor, down=1, pad=self.pad)
|
54 |
+
|
55 |
+
return out
|
56 |
+
|
57 |
+
|
58 |
+
class Downsample(nn.Module):
|
59 |
+
def __init__(self, kernel, factor=2):
|
60 |
+
super().__init__()
|
61 |
+
|
62 |
+
self.factor = factor
|
63 |
+
kernel = make_kernel(kernel)
|
64 |
+
self.register_buffer('kernel', kernel)
|
65 |
+
|
66 |
+
p = kernel.shape[0] - factor
|
67 |
+
|
68 |
+
pad0 = (p + 1) // 2
|
69 |
+
pad1 = p // 2
|
70 |
+
|
71 |
+
self.pad = (pad0, pad1)
|
72 |
+
|
73 |
+
def forward(self, input):
|
74 |
+
out = upfirdn2d(input, self.kernel, up=1, down=self.factor, pad=self.pad)
|
75 |
+
|
76 |
+
return out
|
77 |
+
|
78 |
+
|
79 |
+
class Blur(nn.Module):
|
80 |
+
def __init__(self, kernel, pad, upsample_factor=1):
|
81 |
+
super().__init__()
|
82 |
+
|
83 |
+
kernel = make_kernel(kernel)
|
84 |
+
|
85 |
+
if upsample_factor > 1:
|
86 |
+
kernel = kernel * (upsample_factor ** 2)
|
87 |
+
|
88 |
+
self.register_buffer('kernel', kernel)
|
89 |
+
|
90 |
+
self.pad = pad
|
91 |
+
|
92 |
+
def forward(self, input):
|
93 |
+
out = upfirdn2d(input, self.kernel, pad=self.pad)
|
94 |
+
|
95 |
+
return out
|
96 |
+
|
97 |
+
|
98 |
+
class EqualConv2d(nn.Module):
|
99 |
+
def __init__(
|
100 |
+
self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True
|
101 |
+
):
|
102 |
+
super().__init__()
|
103 |
+
|
104 |
+
self.weight = nn.Parameter(
|
105 |
+
torch.randn(out_channel, in_channel, kernel_size, kernel_size)
|
106 |
+
)
|
107 |
+
self.scale = 1 / math.sqrt(in_channel * kernel_size ** 2)
|
108 |
+
|
109 |
+
self.stride = stride
|
110 |
+
self.padding = padding
|
111 |
+
|
112 |
+
if bias:
|
113 |
+
self.bias = nn.Parameter(torch.zeros(out_channel))
|
114 |
+
|
115 |
+
else:
|
116 |
+
self.bias = None
|
117 |
+
|
118 |
+
def forward(self, input):
|
119 |
+
out = F.conv2d(
|
120 |
+
input,
|
121 |
+
self.weight * self.scale,
|
122 |
+
bias=self.bias,
|
123 |
+
stride=self.stride,
|
124 |
+
padding=self.padding,
|
125 |
+
)
|
126 |
+
|
127 |
+
return out
|
128 |
+
|
129 |
+
def __repr__(self):
|
130 |
+
return (
|
131 |
+
f'{self.__class__.__name__}({self.weight.shape[1]}, {self.weight.shape[0]},'
|
132 |
+
f' {self.weight.shape[2]}, stride={self.stride}, padding={self.padding})'
|
133 |
+
)
|
134 |
+
|
135 |
+
|
136 |
+
class EqualLinear(nn.Module):
|
137 |
+
def __init__(
|
138 |
+
self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1, activation=None
|
139 |
+
):
|
140 |
+
super().__init__()
|
141 |
+
|
142 |
+
self.weight = nn.Parameter(torch.randn(out_dim, in_dim).div_(lr_mul))
|
143 |
+
|
144 |
+
if bias:
|
145 |
+
self.bias = nn.Parameter(torch.zeros(out_dim).fill_(bias_init))
|
146 |
+
|
147 |
+
else:
|
148 |
+
self.bias = None
|
149 |
+
|
150 |
+
self.activation = activation
|
151 |
+
|
152 |
+
self.scale = (1 / math.sqrt(in_dim)) * lr_mul
|
153 |
+
self.lr_mul = lr_mul
|
154 |
+
|
155 |
+
def forward(self, input):
|
156 |
+
if self.activation:
|
157 |
+
out = F.linear(input, self.weight * self.scale)
|
158 |
+
out = fused_leaky_relu(out, self.bias * self.lr_mul)
|
159 |
+
|
160 |
+
else:
|
161 |
+
out = F.linear(input, self.weight * self.scale, bias=self.bias * self.lr_mul)
|
162 |
+
|
163 |
+
return out
|
164 |
+
|
165 |
+
def __repr__(self):
|
166 |
+
return (
|
167 |
+
f'{self.__class__.__name__}({self.weight.shape[1]}, {self.weight.shape[0]})'
|
168 |
+
)
|
169 |
+
|
170 |
+
|
171 |
+
class ScaledLeakyReLU(nn.Module):
|
172 |
+
def __init__(self, negative_slope=0.2):
|
173 |
+
super().__init__()
|
174 |
+
|
175 |
+
self.negative_slope = negative_slope
|
176 |
+
|
177 |
+
def forward(self, input):
|
178 |
+
out = F.leaky_relu(input, negative_slope=self.negative_slope)
|
179 |
+
|
180 |
+
return out * math.sqrt(2)
|
181 |
+
|
182 |
+
|
183 |
+
class ModulatedConv2d(nn.Module):
|
184 |
+
def __init__(
|
185 |
+
self,
|
186 |
+
in_channel,
|
187 |
+
out_channel,
|
188 |
+
kernel_size,
|
189 |
+
style_dim,
|
190 |
+
demodulate=True,
|
191 |
+
upsample=False,
|
192 |
+
downsample=False,
|
193 |
+
blur_kernel=[1, 3, 3, 1],
|
194 |
+
):
|
195 |
+
super().__init__()
|
196 |
+
|
197 |
+
self.eps = 1e-8
|
198 |
+
self.kernel_size = kernel_size
|
199 |
+
self.in_channel = in_channel
|
200 |
+
self.out_channel = out_channel
|
201 |
+
self.upsample = upsample
|
202 |
+
self.downsample = downsample
|
203 |
+
|
204 |
+
if upsample:
|
205 |
+
factor = 2
|
206 |
+
p = (len(blur_kernel) - factor) - (kernel_size - 1)
|
207 |
+
pad0 = (p + 1) // 2 + factor - 1
|
208 |
+
pad1 = p // 2 + 1
|
209 |
+
|
210 |
+
self.blur = Blur(blur_kernel, pad=(pad0, pad1), upsample_factor=factor)
|
211 |
+
|
212 |
+
if downsample:
|
213 |
+
factor = 2
|
214 |
+
p = (len(blur_kernel) - factor) + (kernel_size - 1)
|
215 |
+
pad0 = (p + 1) // 2
|
216 |
+
pad1 = p // 2
|
217 |
+
|
218 |
+
self.blur = Blur(blur_kernel, pad=(pad0, pad1))
|
219 |
+
|
220 |
+
fan_in = in_channel * kernel_size ** 2
|
221 |
+
self.scale = 1 / math.sqrt(fan_in)
|
222 |
+
self.padding = kernel_size // 2
|
223 |
+
|
224 |
+
self.weight = nn.Parameter(
|
225 |
+
torch.randn(1, out_channel, in_channel, kernel_size, kernel_size)
|
226 |
+
)
|
227 |
+
|
228 |
+
self.modulation = EqualLinear(style_dim, in_channel, bias_init=1)
|
229 |
+
|
230 |
+
self.demodulate = demodulate
|
231 |
+
|
232 |
+
def __repr__(self):
|
233 |
+
return (
|
234 |
+
f'{self.__class__.__name__}({self.in_channel}, {self.out_channel}, {self.kernel_size}, '
|
235 |
+
f'upsample={self.upsample}, downsample={self.downsample})'
|
236 |
+
)
|
237 |
+
|
238 |
+
def forward(self, input, style):
|
239 |
+
batch, in_channel, height, width = input.shape
|
240 |
+
|
241 |
+
style = self.modulation(style).view(batch, 1, in_channel, 1, 1)
|
242 |
+
weight = self.scale * self.weight * style
|
243 |
+
|
244 |
+
if self.demodulate:
|
245 |
+
demod = torch.rsqrt(weight.pow(2).sum([2, 3, 4]) + 1e-8)
|
246 |
+
weight = weight * demod.view(batch, self.out_channel, 1, 1, 1)
|
247 |
+
|
248 |
+
weight = weight.view(
|
249 |
+
batch * self.out_channel, in_channel, self.kernel_size, self.kernel_size
|
250 |
+
)
|
251 |
+
|
252 |
+
if self.upsample:
|
253 |
+
input = input.view(1, batch * in_channel, height, width)
|
254 |
+
weight = weight.view(
|
255 |
+
batch, self.out_channel, in_channel, self.kernel_size, self.kernel_size
|
256 |
+
)
|
257 |
+
weight = weight.transpose(1, 2).reshape(
|
258 |
+
batch * in_channel, self.out_channel, self.kernel_size, self.kernel_size
|
259 |
+
)
|
260 |
+
out = F.conv_transpose2d(input, weight, padding=0, stride=2, groups=batch)
|
261 |
+
_, _, height, width = out.shape
|
262 |
+
out = out.view(batch, self.out_channel, height, width)
|
263 |
+
out = self.blur(out)
|
264 |
+
|
265 |
+
elif self.downsample:
|
266 |
+
input = self.blur(input)
|
267 |
+
_, _, height, width = input.shape
|
268 |
+
input = input.view(1, batch * in_channel, height, width)
|
269 |
+
out = F.conv2d(input, weight, padding=0, stride=2, groups=batch)
|
270 |
+
_, _, height, width = out.shape
|
271 |
+
out = out.view(batch, self.out_channel, height, width)
|
272 |
+
|
273 |
+
else:
|
274 |
+
input = input.view(1, batch * in_channel, height, width)
|
275 |
+
out = F.conv2d(input, weight, padding=self.padding, groups=batch)
|
276 |
+
_, _, height, width = out.shape
|
277 |
+
out = out.view(batch, self.out_channel, height, width)
|
278 |
+
|
279 |
+
return out
|
280 |
+
|
281 |
+
|
282 |
+
class NoiseInjection(nn.Module):
|
283 |
+
def __init__(self, isconcat=True):
|
284 |
+
super().__init__()
|
285 |
+
|
286 |
+
self.isconcat = isconcat
|
287 |
+
self.weight = nn.Parameter(torch.zeros(1))
|
288 |
+
|
289 |
+
def forward(self, image, noise=None):
|
290 |
+
if noise is None:
|
291 |
+
batch, _, height, width = image.shape
|
292 |
+
noise = image.new_empty(batch, 1, height, width).normal_()
|
293 |
+
|
294 |
+
if self.isconcat:
|
295 |
+
return torch.cat((image, self.weight * noise), dim=1)
|
296 |
+
else:
|
297 |
+
return image + self.weight * noise
|
298 |
+
|
299 |
+
|
300 |
+
class ConstantInput(nn.Module):
|
301 |
+
def __init__(self, channel, size=4):
|
302 |
+
super().__init__()
|
303 |
+
|
304 |
+
self.input = nn.Parameter(torch.randn(1, channel, size, size))
|
305 |
+
|
306 |
+
def forward(self, input):
|
307 |
+
batch = input.shape[0]
|
308 |
+
out = self.input.repeat(batch, 1, 1, 1)
|
309 |
+
|
310 |
+
return out
|
311 |
+
|
312 |
+
|
313 |
+
class StyledConv(nn.Module):
|
314 |
+
def __init__(
|
315 |
+
self,
|
316 |
+
in_channel,
|
317 |
+
out_channel,
|
318 |
+
kernel_size,
|
319 |
+
style_dim,
|
320 |
+
upsample=False,
|
321 |
+
blur_kernel=[1, 3, 3, 1],
|
322 |
+
demodulate=True,
|
323 |
+
isconcat=True
|
324 |
+
):
|
325 |
+
super().__init__()
|
326 |
+
|
327 |
+
self.conv = ModulatedConv2d(
|
328 |
+
in_channel,
|
329 |
+
out_channel,
|
330 |
+
kernel_size,
|
331 |
+
style_dim,
|
332 |
+
upsample=upsample,
|
333 |
+
blur_kernel=blur_kernel,
|
334 |
+
demodulate=demodulate,
|
335 |
+
)
|
336 |
+
|
337 |
+
self.noise = NoiseInjection(isconcat)
|
338 |
+
#self.bias = nn.Parameter(torch.zeros(1, out_channel, 1, 1))
|
339 |
+
#self.activate = ScaledLeakyReLU(0.2)
|
340 |
+
feat_multiplier = 2 if isconcat else 1
|
341 |
+
self.activate = FusedLeakyReLU(out_channel*feat_multiplier)
|
342 |
+
|
343 |
+
def forward(self, input, style, noise=None):
|
344 |
+
out = self.conv(input, style)
|
345 |
+
out = self.noise(out, noise=noise)
|
346 |
+
# out = out + self.bias
|
347 |
+
out = self.activate(out)
|
348 |
+
|
349 |
+
return out
|
350 |
+
|
351 |
+
|
352 |
+
class ToRGB(nn.Module):
|
353 |
+
def __init__(self, in_channel, style_dim, upsample=True, blur_kernel=[1, 3, 3, 1]):
|
354 |
+
super().__init__()
|
355 |
+
|
356 |
+
if upsample:
|
357 |
+
self.upsample = Upsample(blur_kernel)
|
358 |
+
|
359 |
+
self.conv = ModulatedConv2d(in_channel, 3, 1, style_dim, demodulate=False)
|
360 |
+
self.bias = nn.Parameter(torch.zeros(1, 3, 1, 1))
|
361 |
+
|
362 |
+
def forward(self, input, style, skip=None):
|
363 |
+
out = self.conv(input, style)
|
364 |
+
out = out + self.bias
|
365 |
+
|
366 |
+
if skip is not None:
|
367 |
+
skip = self.upsample(skip)
|
368 |
+
|
369 |
+
out = out + skip
|
370 |
+
|
371 |
+
return out
|
372 |
+
|
373 |
+
class Generator(nn.Module):
|
374 |
+
def __init__(
|
375 |
+
self,
|
376 |
+
size,
|
377 |
+
style_dim,
|
378 |
+
n_mlp,
|
379 |
+
channel_multiplier=2,
|
380 |
+
blur_kernel=[1, 3, 3, 1],
|
381 |
+
lr_mlp=0.01,
|
382 |
+
isconcat=True,
|
383 |
+
narrow=1
|
384 |
+
):
|
385 |
+
super().__init__()
|
386 |
+
|
387 |
+
self.size = size
|
388 |
+
self.n_mlp = n_mlp
|
389 |
+
self.style_dim = style_dim
|
390 |
+
self.feat_multiplier = 2 if isconcat else 1
|
391 |
+
|
392 |
+
layers = [PixelNorm()]
|
393 |
+
|
394 |
+
for i in range(n_mlp):
|
395 |
+
layers.append(
|
396 |
+
EqualLinear(
|
397 |
+
style_dim, style_dim, lr_mul=lr_mlp, activation='fused_lrelu'
|
398 |
+
)
|
399 |
+
)
|
400 |
+
|
401 |
+
self.style = nn.Sequential(*layers)
|
402 |
+
|
403 |
+
self.channels = {
|
404 |
+
4: int(512 * narrow),
|
405 |
+
8: int(512 * narrow),
|
406 |
+
16: int(512 * narrow),
|
407 |
+
32: int(512 * narrow),
|
408 |
+
64: int(256 * channel_multiplier * narrow),
|
409 |
+
128: int(128 * channel_multiplier * narrow),
|
410 |
+
256: int(64 * channel_multiplier * narrow),
|
411 |
+
512: int(32 * channel_multiplier * narrow),
|
412 |
+
1024: int(16 * channel_multiplier * narrow)
|
413 |
+
}
|
414 |
+
|
415 |
+
self.input = ConstantInput(self.channels[4])
|
416 |
+
self.conv1 = StyledConv(
|
417 |
+
self.channels[4], self.channels[4], 3, style_dim, blur_kernel=blur_kernel, isconcat=isconcat
|
418 |
+
)
|
419 |
+
self.to_rgb1 = ToRGB(self.channels[4]*self.feat_multiplier, style_dim, upsample=False)
|
420 |
+
|
421 |
+
self.log_size = int(math.log(size, 2))
|
422 |
+
|
423 |
+
self.convs = nn.ModuleList()
|
424 |
+
self.upsamples = nn.ModuleList()
|
425 |
+
self.to_rgbs = nn.ModuleList()
|
426 |
+
|
427 |
+
in_channel = self.channels[4]
|
428 |
+
|
429 |
+
for i in range(3, self.log_size + 1):
|
430 |
+
out_channel = self.channels[2 ** i]
|
431 |
+
|
432 |
+
self.convs.append(
|
433 |
+
StyledConv(
|
434 |
+
in_channel*self.feat_multiplier,
|
435 |
+
out_channel,
|
436 |
+
3,
|
437 |
+
style_dim,
|
438 |
+
upsample=True,
|
439 |
+
blur_kernel=blur_kernel,
|
440 |
+
isconcat=isconcat
|
441 |
+
)
|
442 |
+
)
|
443 |
+
|
444 |
+
self.convs.append(
|
445 |
+
StyledConv(
|
446 |
+
out_channel*self.feat_multiplier, out_channel, 3, style_dim, blur_kernel=blur_kernel, isconcat=isconcat
|
447 |
+
)
|
448 |
+
)
|
449 |
+
|
450 |
+
self.to_rgbs.append(ToRGB(out_channel*self.feat_multiplier, style_dim))
|
451 |
+
|
452 |
+
in_channel = out_channel
|
453 |
+
|
454 |
+
self.n_latent = self.log_size * 2 - 2
|
455 |
+
|
456 |
+
def make_noise(self):
|
457 |
+
device = self.input.input.device
|
458 |
+
|
459 |
+
noises = [torch.randn(1, 1, 2 ** 2, 2 ** 2, device=device)]
|
460 |
+
|
461 |
+
for i in range(3, self.log_size + 1):
|
462 |
+
for _ in range(2):
|
463 |
+
noises.append(torch.randn(1, 1, 2 ** i, 2 ** i, device=device))
|
464 |
+
|
465 |
+
return noises
|
466 |
+
|
467 |
+
def mean_latent(self, n_latent):
|
468 |
+
latent_in = torch.randn(
|
469 |
+
n_latent, self.style_dim, device=self.input.input.device
|
470 |
+
)
|
471 |
+
latent = self.style(latent_in).mean(0, keepdim=True)
|
472 |
+
|
473 |
+
return latent
|
474 |
+
|
475 |
+
def get_latent(self, input):
|
476 |
+
return self.style(input)
|
477 |
+
|
478 |
+
def forward(
|
479 |
+
self,
|
480 |
+
styles,
|
481 |
+
return_latents=False,
|
482 |
+
inject_index=None,
|
483 |
+
truncation=1,
|
484 |
+
truncation_latent=None,
|
485 |
+
input_is_latent=False,
|
486 |
+
noise=None,
|
487 |
+
):
|
488 |
+
if not input_is_latent:
|
489 |
+
styles = [self.style(s) for s in styles]
|
490 |
+
|
491 |
+
if noise is None:
|
492 |
+
'''
|
493 |
+
noise = [None] * (2 * (self.log_size - 2) + 1)
|
494 |
+
'''
|
495 |
+
noise = []
|
496 |
+
batch = styles[0].shape[0]
|
497 |
+
for i in range(self.n_mlp + 1):
|
498 |
+
size = 2 ** (i+2)
|
499 |
+
noise.append(torch.randn(batch, self.channels[size], size, size, device=styles[0].device))
|
500 |
+
|
501 |
+
if truncation < 1:
|
502 |
+
style_t = []
|
503 |
+
|
504 |
+
for style in styles:
|
505 |
+
style_t.append(
|
506 |
+
truncation_latent + truncation * (style - truncation_latent)
|
507 |
+
)
|
508 |
+
|
509 |
+
styles = style_t
|
510 |
+
|
511 |
+
if len(styles) < 2:
|
512 |
+
inject_index = self.n_latent
|
513 |
+
|
514 |
+
latent = styles[0].unsqueeze(1).repeat(1, inject_index, 1)
|
515 |
+
|
516 |
+
else:
|
517 |
+
if inject_index is None:
|
518 |
+
inject_index = random.randint(1, self.n_latent - 1)
|
519 |
+
|
520 |
+
latent = styles[0].unsqueeze(1).repeat(1, inject_index, 1)
|
521 |
+
latent2 = styles[1].unsqueeze(1).repeat(1, self.n_latent - inject_index, 1)
|
522 |
+
|
523 |
+
latent = torch.cat([latent, latent2], 1)
|
524 |
+
|
525 |
+
out = self.input(latent)
|
526 |
+
out = self.conv1(out, latent[:, 0], noise=noise[0])
|
527 |
+
|
528 |
+
skip = self.to_rgb1(out, latent[:, 1])
|
529 |
+
|
530 |
+
i = 1
|
531 |
+
for conv1, conv2, noise1, noise2, to_rgb in zip(
|
532 |
+
self.convs[::2], self.convs[1::2], noise[1::2], noise[2::2], self.to_rgbs
|
533 |
+
):
|
534 |
+
out = conv1(out, latent[:, i], noise=noise1)
|
535 |
+
out = conv2(out, latent[:, i + 1], noise=noise2)
|
536 |
+
skip = to_rgb(out, latent[:, i + 2], skip)
|
537 |
+
|
538 |
+
i += 2
|
539 |
+
|
540 |
+
image = skip
|
541 |
+
|
542 |
+
if return_latents:
|
543 |
+
return image, latent
|
544 |
+
|
545 |
+
else:
|
546 |
+
return image, None
|
547 |
+
|
548 |
+
class ConvLayer(nn.Sequential):
|
549 |
+
def __init__(
|
550 |
+
self,
|
551 |
+
in_channel,
|
552 |
+
out_channel,
|
553 |
+
kernel_size,
|
554 |
+
downsample=False,
|
555 |
+
blur_kernel=[1, 3, 3, 1],
|
556 |
+
bias=True,
|
557 |
+
activate=True,
|
558 |
+
):
|
559 |
+
layers = []
|
560 |
+
|
561 |
+
if downsample:
|
562 |
+
factor = 2
|
563 |
+
p = (len(blur_kernel) - factor) + (kernel_size - 1)
|
564 |
+
pad0 = (p + 1) // 2
|
565 |
+
pad1 = p // 2
|
566 |
+
|
567 |
+
layers.append(Blur(blur_kernel, pad=(pad0, pad1)))
|
568 |
+
|
569 |
+
stride = 2
|
570 |
+
self.padding = 0
|
571 |
+
|
572 |
+
else:
|
573 |
+
stride = 1
|
574 |
+
self.padding = kernel_size // 2
|
575 |
+
|
576 |
+
layers.append(
|
577 |
+
EqualConv2d(
|
578 |
+
in_channel,
|
579 |
+
out_channel,
|
580 |
+
kernel_size,
|
581 |
+
padding=self.padding,
|
582 |
+
stride=stride,
|
583 |
+
bias=bias and not activate,
|
584 |
+
)
|
585 |
+
)
|
586 |
+
|
587 |
+
if activate:
|
588 |
+
if bias:
|
589 |
+
layers.append(FusedLeakyReLU(out_channel))
|
590 |
+
|
591 |
+
else:
|
592 |
+
layers.append(ScaledLeakyReLU(0.2))
|
593 |
+
|
594 |
+
super().__init__(*layers)
|
595 |
+
|
596 |
+
|
597 |
+
class ResBlock(nn.Module):
|
598 |
+
def __init__(self, in_channel, out_channel, blur_kernel=[1, 3, 3, 1]):
|
599 |
+
super().__init__()
|
600 |
+
|
601 |
+
self.conv1 = ConvLayer(in_channel, in_channel, 3)
|
602 |
+
self.conv2 = ConvLayer(in_channel, out_channel, 3, downsample=True)
|
603 |
+
|
604 |
+
self.skip = ConvLayer(
|
605 |
+
in_channel, out_channel, 1, downsample=True, activate=False, bias=False
|
606 |
+
)
|
607 |
+
|
608 |
+
def forward(self, input):
|
609 |
+
out = self.conv1(input)
|
610 |
+
out = self.conv2(out)
|
611 |
+
|
612 |
+
skip = self.skip(input)
|
613 |
+
out = (out + skip) / math.sqrt(2)
|
614 |
+
|
615 |
+
return out
|
616 |
+
|
617 |
+
class FullGenerator(nn.Module):
|
618 |
+
def __init__(
|
619 |
+
self,
|
620 |
+
size,
|
621 |
+
style_dim,
|
622 |
+
n_mlp,
|
623 |
+
channel_multiplier=2,
|
624 |
+
blur_kernel=[1, 3, 3, 1],
|
625 |
+
lr_mlp=0.01,
|
626 |
+
isconcat=True,
|
627 |
+
narrow=1
|
628 |
+
):
|
629 |
+
super().__init__()
|
630 |
+
channels = {
|
631 |
+
4: int(512 * narrow),
|
632 |
+
8: int(512 * narrow),
|
633 |
+
16: int(512 * narrow),
|
634 |
+
32: int(512 * narrow),
|
635 |
+
64: int(256 * channel_multiplier * narrow),
|
636 |
+
128: int(128 * channel_multiplier * narrow),
|
637 |
+
256: int(64 * channel_multiplier * narrow),
|
638 |
+
512: int(32 * channel_multiplier * narrow),
|
639 |
+
1024: int(16 * channel_multiplier * narrow)
|
640 |
+
}
|
641 |
+
|
642 |
+
self.log_size = int(math.log(size, 2))
|
643 |
+
self.generator = Generator(size, style_dim, n_mlp, channel_multiplier=channel_multiplier, blur_kernel=blur_kernel, lr_mlp=lr_mlp, isconcat=isconcat, narrow=narrow)
|
644 |
+
|
645 |
+
conv = [ConvLayer(3, channels[size], 1)]
|
646 |
+
self.ecd0 = nn.Sequential(*conv)
|
647 |
+
in_channel = channels[size]
|
648 |
+
|
649 |
+
self.names = ['ecd%d'%i for i in range(self.log_size-1)]
|
650 |
+
for i in range(self.log_size, 2, -1):
|
651 |
+
out_channel = channels[2 ** (i - 1)]
|
652 |
+
#conv = [ResBlock(in_channel, out_channel, blur_kernel)]
|
653 |
+
conv = [ConvLayer(in_channel, out_channel, 3, downsample=True)]
|
654 |
+
setattr(self, self.names[self.log_size-i+1], nn.Sequential(*conv))
|
655 |
+
in_channel = out_channel
|
656 |
+
self.final_linear = nn.Sequential(EqualLinear(channels[4] * 4 * 4, style_dim, activation='fused_lrelu'))
|
657 |
+
|
658 |
+
def forward(self,
|
659 |
+
inputs,
|
660 |
+
return_latents=False,
|
661 |
+
inject_index=None,
|
662 |
+
truncation=1,
|
663 |
+
truncation_latent=None,
|
664 |
+
input_is_latent=False,
|
665 |
+
):
|
666 |
+
noise = []
|
667 |
+
for i in range(self.log_size-1):
|
668 |
+
ecd = getattr(self, self.names[i])
|
669 |
+
inputs = ecd(inputs)
|
670 |
+
noise.append(inputs)
|
671 |
+
#print(inputs.shape)
|
672 |
+
inputs = inputs.view(inputs.shape[0], -1)
|
673 |
+
outs = self.final_linear(inputs)
|
674 |
+
#print(outs.shape)
|
675 |
+
noise = list(itertools.chain.from_iterable(itertools.repeat(x, 2) for x in noise))[::-1]
|
676 |
+
outs = self.generator([outs], return_latents, inject_index, truncation, truncation_latent, input_is_latent, noise=noise[1:])
|
677 |
+
return outs
|
678 |
+
|
679 |
+
class Discriminator(nn.Module):
|
680 |
+
def __init__(self, size, channel_multiplier=2, blur_kernel=[1, 3, 3, 1], narrow=1):
|
681 |
+
super().__init__()
|
682 |
+
|
683 |
+
channels = {
|
684 |
+
4: int(512 * narrow),
|
685 |
+
8: int(512 * narrow),
|
686 |
+
16: int(512 * narrow),
|
687 |
+
32: int(512 * narrow),
|
688 |
+
64: int(256 * channel_multiplier * narrow),
|
689 |
+
128: int(128 * channel_multiplier * narrow),
|
690 |
+
256: int(64 * channel_multiplier * narrow),
|
691 |
+
512: int(32 * channel_multiplier * narrow),
|
692 |
+
1024: int(16 * channel_multiplier * narrow)
|
693 |
+
}
|
694 |
+
|
695 |
+
convs = [ConvLayer(3, channels[size], 1)]
|
696 |
+
|
697 |
+
log_size = int(math.log(size, 2))
|
698 |
+
|
699 |
+
in_channel = channels[size]
|
700 |
+
|
701 |
+
for i in range(log_size, 2, -1):
|
702 |
+
out_channel = channels[2 ** (i - 1)]
|
703 |
+
|
704 |
+
convs.append(ResBlock(in_channel, out_channel, blur_kernel))
|
705 |
+
|
706 |
+
in_channel = out_channel
|
707 |
+
|
708 |
+
self.convs = nn.Sequential(*convs)
|
709 |
+
|
710 |
+
self.stddev_group = 4
|
711 |
+
self.stddev_feat = 1
|
712 |
+
|
713 |
+
self.final_conv = ConvLayer(in_channel + 1, channels[4], 3)
|
714 |
+
self.final_linear = nn.Sequential(
|
715 |
+
EqualLinear(channels[4] * 4 * 4, channels[4], activation='fused_lrelu'),
|
716 |
+
EqualLinear(channels[4], 1),
|
717 |
+
)
|
718 |
+
|
719 |
+
def forward(self, input):
|
720 |
+
out = self.convs(input)
|
721 |
+
|
722 |
+
batch, channel, height, width = out.shape
|
723 |
+
group = min(batch, self.stddev_group)
|
724 |
+
stddev = out.view(
|
725 |
+
group, -1, self.stddev_feat, channel // self.stddev_feat, height, width
|
726 |
+
)
|
727 |
+
stddev = torch.sqrt(stddev.var(0, unbiased=False) + 1e-8)
|
728 |
+
stddev = stddev.mean([2, 3, 4], keepdims=True).squeeze(2)
|
729 |
+
stddev = stddev.repeat(group, 1, height, width)
|
730 |
+
out = torch.cat([out, stddev], 1)
|
731 |
+
|
732 |
+
out = self.final_conv(out)
|
733 |
+
|
734 |
+
out = out.view(batch, -1)
|
735 |
+
out = self.final_linear(out)
|
736 |
+
return out
|
face_vid2vid/GPEN/face_model/op/__init__.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
from .fused_act import FusedLeakyReLU, fused_leaky_relu
|
2 |
+
from .upfirdn2d import upfirdn2d
|
face_vid2vid/GPEN/face_model/op/fused_act.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import torch
|
4 |
+
from torch import nn
|
5 |
+
from torch.autograd import Function
|
6 |
+
from torch.utils.cpp_extension import load, _import_module_from_library
|
7 |
+
|
8 |
+
|
9 |
+
module_path = os.path.dirname(__file__)
|
10 |
+
fused = load(
|
11 |
+
'fused',
|
12 |
+
sources=[
|
13 |
+
os.path.join(module_path, 'fused_bias_act.cpp'),
|
14 |
+
os.path.join(module_path, 'fused_bias_act_kernel.cu'),
|
15 |
+
],
|
16 |
+
)
|
17 |
+
|
18 |
+
#fused = _import_module_from_library('fused', '/tmp/torch_extensions/fused', True)
|
19 |
+
|
20 |
+
|
21 |
+
class FusedLeakyReLUFunctionBackward(Function):
|
22 |
+
@staticmethod
|
23 |
+
def forward(ctx, grad_output, out, negative_slope, scale):
|
24 |
+
ctx.save_for_backward(out)
|
25 |
+
ctx.negative_slope = negative_slope
|
26 |
+
ctx.scale = scale
|
27 |
+
|
28 |
+
empty = grad_output.new_empty(0)
|
29 |
+
|
30 |
+
grad_input = fused.fused_bias_act(
|
31 |
+
grad_output, empty, out, 3, 1, negative_slope, scale
|
32 |
+
)
|
33 |
+
|
34 |
+
dim = [0]
|
35 |
+
|
36 |
+
if grad_input.ndim > 2:
|
37 |
+
dim += list(range(2, grad_input.ndim))
|
38 |
+
|
39 |
+
grad_bias = grad_input.sum(dim).detach()
|
40 |
+
|
41 |
+
return grad_input, grad_bias
|
42 |
+
|
43 |
+
@staticmethod
|
44 |
+
def backward(ctx, gradgrad_input, gradgrad_bias):
|
45 |
+
out, = ctx.saved_tensors
|
46 |
+
gradgrad_out = fused.fused_bias_act(
|
47 |
+
gradgrad_input, gradgrad_bias, out, 3, 1, ctx.negative_slope, ctx.scale
|
48 |
+
)
|
49 |
+
|
50 |
+
return gradgrad_out, None, None, None
|
51 |
+
|
52 |
+
|
53 |
+
class FusedLeakyReLUFunction(Function):
|
54 |
+
@staticmethod
|
55 |
+
def forward(ctx, input, bias, negative_slope, scale):
|
56 |
+
empty = input.new_empty(0)
|
57 |
+
out = fused.fused_bias_act(input, bias, empty, 3, 0, negative_slope, scale)
|
58 |
+
ctx.save_for_backward(out)
|
59 |
+
ctx.negative_slope = negative_slope
|
60 |
+
ctx.scale = scale
|
61 |
+
|
62 |
+
return out
|
63 |
+
|
64 |
+
@staticmethod
|
65 |
+
def backward(ctx, grad_output):
|
66 |
+
out, = ctx.saved_tensors
|
67 |
+
|
68 |
+
grad_input, grad_bias = FusedLeakyReLUFunctionBackward.apply(
|
69 |
+
grad_output, out, ctx.negative_slope, ctx.scale
|
70 |
+
)
|
71 |
+
|
72 |
+
return grad_input, grad_bias, None, None
|
73 |
+
|
74 |
+
|
75 |
+
class FusedLeakyReLU(nn.Module):
|
76 |
+
def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5):
|
77 |
+
super().__init__()
|
78 |
+
|
79 |
+
self.bias = nn.Parameter(torch.zeros(channel))
|
80 |
+
self.negative_slope = negative_slope
|
81 |
+
self.scale = scale
|
82 |
+
|
83 |
+
def forward(self, input):
|
84 |
+
return fused_leaky_relu(input, self.bias, self.negative_slope, self.scale)
|
85 |
+
|
86 |
+
|
87 |
+
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
|
88 |
+
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
|
face_vid2vid/GPEN/face_model/op/fused_bias_act.cpp
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <torch/extension.h>
|
2 |
+
|
3 |
+
|
4 |
+
torch::Tensor fused_bias_act_op(const torch::Tensor& input, const torch::Tensor& bias, const torch::Tensor& refer,
|
5 |
+
int act, int grad, float alpha, float scale);
|
6 |
+
|
7 |
+
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
|
8 |
+
#define CHECK_CONTIGUOUS(x) TORCH_CHECK(x.is_contiguous(), #x " must be contiguous")
|
9 |
+
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
|
10 |
+
|
11 |
+
torch::Tensor fused_bias_act(const torch::Tensor& input, const torch::Tensor& bias, const torch::Tensor& refer,
|
12 |
+
int act, int grad, float alpha, float scale) {
|
13 |
+
CHECK_CUDA(input);
|
14 |
+
CHECK_CUDA(bias);
|
15 |
+
|
16 |
+
return fused_bias_act_op(input, bias, refer, act, grad, alpha, scale);
|
17 |
+
}
|
18 |
+
|
19 |
+
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
20 |
+
m.def("fused_bias_act", &fused_bias_act, "fused bias act (CUDA)");
|
21 |
+
}
|
face_vid2vid/GPEN/face_model/op/fused_bias_act_kernel.cu
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
|
2 |
+
//
|
3 |
+
// This work is made available under the Nvidia Source Code License-NC.
|
4 |
+
// To view a copy of this license, visit
|
5 |
+
// https://nvlabs.github.io/stylegan2/license.html
|
6 |
+
|
7 |
+
#include <torch/types.h>
|
8 |
+
|
9 |
+
#include <ATen/ATen.h>
|
10 |
+
#include <ATen/AccumulateType.h>
|
11 |
+
#include <ATen/cuda/CUDAContext.h>
|
12 |
+
#include <ATen/cuda/CUDAApplyUtils.cuh>
|
13 |
+
|
14 |
+
#include <cuda.h>
|
15 |
+
#include <cuda_runtime.h>
|
16 |
+
|
17 |
+
|
18 |
+
template <typename scalar_t>
|
19 |
+
static __global__ void fused_bias_act_kernel(scalar_t* out, const scalar_t* p_x, const scalar_t* p_b, const scalar_t* p_ref,
|
20 |
+
int act, int grad, scalar_t alpha, scalar_t scale, int loop_x, int size_x, int step_b, int size_b, int use_bias, int use_ref) {
|
21 |
+
int xi = blockIdx.x * loop_x * blockDim.x + threadIdx.x;
|
22 |
+
|
23 |
+
scalar_t zero = 0.0;
|
24 |
+
|
25 |
+
for (int loop_idx = 0; loop_idx < loop_x && xi < size_x; loop_idx++, xi += blockDim.x) {
|
26 |
+
scalar_t x = p_x[xi];
|
27 |
+
|
28 |
+
if (use_bias) {
|
29 |
+
x += p_b[(xi / step_b) % size_b];
|
30 |
+
}
|
31 |
+
|
32 |
+
scalar_t ref = use_ref ? p_ref[xi] : zero;
|
33 |
+
|
34 |
+
scalar_t y;
|
35 |
+
|
36 |
+
switch (act * 10 + grad) {
|
37 |
+
default:
|
38 |
+
case 10: y = x; break;
|
39 |
+
case 11: y = x; break;
|
40 |
+
case 12: y = 0.0; break;
|
41 |
+
|
42 |
+
case 30: y = (x > 0.0) ? x : x * alpha; break;
|
43 |
+
case 31: y = (ref > 0.0) ? x : x * alpha; break;
|
44 |
+
case 32: y = 0.0; break;
|
45 |
+
}
|
46 |
+
|
47 |
+
out[xi] = y * scale;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
torch::Tensor fused_bias_act_op(const torch::Tensor& input, const torch::Tensor& bias, const torch::Tensor& refer,
|
53 |
+
int act, int grad, float alpha, float scale) {
|
54 |
+
int curDevice = -1;
|
55 |
+
cudaGetDevice(&curDevice);
|
56 |
+
cudaStream_t stream = at::cuda::getCurrentCUDAStream(curDevice);
|
57 |
+
|
58 |
+
auto x = input.contiguous();
|
59 |
+
auto b = bias.contiguous();
|
60 |
+
auto ref = refer.contiguous();
|
61 |
+
|
62 |
+
int use_bias = b.numel() ? 1 : 0;
|
63 |
+
int use_ref = ref.numel() ? 1 : 0;
|
64 |
+
|
65 |
+
int size_x = x.numel();
|
66 |
+
int size_b = b.numel();
|
67 |
+
int step_b = 1;
|
68 |
+
|
69 |
+
for (int i = 1 + 1; i < x.dim(); i++) {
|
70 |
+
step_b *= x.size(i);
|
71 |
+
}
|
72 |
+
|
73 |
+
int loop_x = 4;
|
74 |
+
int block_size = 4 * 32;
|
75 |
+
int grid_size = (size_x - 1) / (loop_x * block_size) + 1;
|
76 |
+
|
77 |
+
auto y = torch::empty_like(x);
|
78 |
+
|
79 |
+
AT_DISPATCH_FLOATING_TYPES_AND_HALF(x.scalar_type(), "fused_bias_act_kernel", [&] {
|
80 |
+
fused_bias_act_kernel<scalar_t><<<grid_size, block_size, 0, stream>>>(
|
81 |
+
y.data_ptr<scalar_t>(),
|
82 |
+
x.data_ptr<scalar_t>(),
|
83 |
+
b.data_ptr<scalar_t>(),
|
84 |
+
ref.data_ptr<scalar_t>(),
|
85 |
+
act,
|
86 |
+
grad,
|
87 |
+
alpha,
|
88 |
+
scale,
|
89 |
+
loop_x,
|
90 |
+
size_x,
|
91 |
+
step_b,
|
92 |
+
size_b,
|
93 |
+
use_bias,
|
94 |
+
use_ref
|
95 |
+
);
|
96 |
+
});
|
97 |
+
|
98 |
+
return y;
|
99 |
+
}
|
face_vid2vid/GPEN/face_model/op/upfirdn2d.cpp
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <torch/extension.h>
|
2 |
+
|
3 |
+
|
4 |
+
torch::Tensor upfirdn2d_op(const torch::Tensor& input, const torch::Tensor& kernel,
|
5 |
+
int up_x, int up_y, int down_x, int down_y,
|
6 |
+
int pad_x0, int pad_x1, int pad_y0, int pad_y1);
|
7 |
+
|
8 |
+
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
|
9 |
+
#define CHECK_CONTIGUOUS(x) TORCH_CHECK(x.is_contiguous(), #x " must be contiguous")
|
10 |
+
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
|
11 |
+
|
12 |
+
torch::Tensor upfirdn2d(const torch::Tensor& input, const torch::Tensor& kernel,
|
13 |
+
int up_x, int up_y, int down_x, int down_y,
|
14 |
+
int pad_x0, int pad_x1, int pad_y0, int pad_y1) {
|
15 |
+
CHECK_CUDA(input);
|
16 |
+
CHECK_CUDA(kernel);
|
17 |
+
|
18 |
+
return upfirdn2d_op(input, kernel, up_x, up_y, down_x, down_y, pad_x0, pad_x1, pad_y0, pad_y1);
|
19 |
+
}
|
20 |
+
|
21 |
+
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
22 |
+
m.def("upfirdn2d", &upfirdn2d, "upfirdn2d (CUDA)");
|
23 |
+
}
|
face_vid2vid/GPEN/face_model/op/upfirdn2d.py
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import torch
|
4 |
+
from torch.autograd import Function
|
5 |
+
from torch.utils.cpp_extension import load, _import_module_from_library
|
6 |
+
|
7 |
+
|
8 |
+
module_path = os.path.dirname(__file__)
|
9 |
+
upfirdn2d_op = load(
|
10 |
+
'upfirdn2d',
|
11 |
+
sources=[
|
12 |
+
os.path.join(module_path, 'upfirdn2d.cpp'),
|
13 |
+
os.path.join(module_path, 'upfirdn2d_kernel.cu'),
|
14 |
+
],
|
15 |
+
)
|
16 |
+
|
17 |
+
#upfirdn2d_op = _import_module_from_library('upfirdn2d', '/tmp/torch_extensions/upfirdn2d', True)
|
18 |
+
|
19 |
+
class UpFirDn2dBackward(Function):
|
20 |
+
@staticmethod
|
21 |
+
def forward(
|
22 |
+
ctx, grad_output, kernel, grad_kernel, up, down, pad, g_pad, in_size, out_size
|
23 |
+
):
|
24 |
+
|
25 |
+
up_x, up_y = up
|
26 |
+
down_x, down_y = down
|
27 |
+
g_pad_x0, g_pad_x1, g_pad_y0, g_pad_y1 = g_pad
|
28 |
+
|
29 |
+
grad_output = grad_output.reshape(-1, out_size[0], out_size[1], 1)
|
30 |
+
|
31 |
+
grad_input = upfirdn2d_op.upfirdn2d(
|
32 |
+
grad_output,
|
33 |
+
grad_kernel,
|
34 |
+
down_x,
|
35 |
+
down_y,
|
36 |
+
up_x,
|
37 |
+
up_y,
|
38 |
+
g_pad_x0,
|
39 |
+
g_pad_x1,
|
40 |
+
g_pad_y0,
|
41 |
+
g_pad_y1,
|
42 |
+
)
|
43 |
+
grad_input = grad_input.view(in_size[0], in_size[1], in_size[2], in_size[3])
|
44 |
+
|
45 |
+
ctx.save_for_backward(kernel)
|
46 |
+
|
47 |
+
pad_x0, pad_x1, pad_y0, pad_y1 = pad
|
48 |
+
|
49 |
+
ctx.up_x = up_x
|
50 |
+
ctx.up_y = up_y
|
51 |
+
ctx.down_x = down_x
|
52 |
+
ctx.down_y = down_y
|
53 |
+
ctx.pad_x0 = pad_x0
|
54 |
+
ctx.pad_x1 = pad_x1
|
55 |
+
ctx.pad_y0 = pad_y0
|
56 |
+
ctx.pad_y1 = pad_y1
|
57 |
+
ctx.in_size = in_size
|
58 |
+
ctx.out_size = out_size
|
59 |
+
|
60 |
+
return grad_input
|
61 |
+
|
62 |
+
@staticmethod
|
63 |
+
def backward(ctx, gradgrad_input):
|
64 |
+
kernel, = ctx.saved_tensors
|
65 |
+
|
66 |
+
gradgrad_input = gradgrad_input.reshape(-1, ctx.in_size[2], ctx.in_size[3], 1)
|
67 |
+
|
68 |
+
gradgrad_out = upfirdn2d_op.upfirdn2d(
|
69 |
+
gradgrad_input,
|
70 |
+
kernel,
|
71 |
+
ctx.up_x,
|
72 |
+
ctx.up_y,
|
73 |
+
ctx.down_x,
|
74 |
+
ctx.down_y,
|
75 |
+
ctx.pad_x0,
|
76 |
+
ctx.pad_x1,
|
77 |
+
ctx.pad_y0,
|
78 |
+
ctx.pad_y1,
|
79 |
+
)
|
80 |
+
# gradgrad_out = gradgrad_out.view(ctx.in_size[0], ctx.out_size[0], ctx.out_size[1], ctx.in_size[3])
|
81 |
+
gradgrad_out = gradgrad_out.view(
|
82 |
+
ctx.in_size[0], ctx.in_size[1], ctx.out_size[0], ctx.out_size[1]
|
83 |
+
)
|
84 |
+
|
85 |
+
return gradgrad_out, None, None, None, None, None, None, None, None
|
86 |
+
|
87 |
+
|
88 |
+
class UpFirDn2d(Function):
|
89 |
+
@staticmethod
|
90 |
+
def forward(ctx, input, kernel, up, down, pad):
|
91 |
+
up_x, up_y = up
|
92 |
+
down_x, down_y = down
|
93 |
+
pad_x0, pad_x1, pad_y0, pad_y1 = pad
|
94 |
+
|
95 |
+
kernel_h, kernel_w = kernel.shape
|
96 |
+
batch, channel, in_h, in_w = input.shape
|
97 |
+
ctx.in_size = input.shape
|
98 |
+
|
99 |
+
input = input.reshape(-1, in_h, in_w, 1)
|
100 |
+
|
101 |
+
ctx.save_for_backward(kernel, torch.flip(kernel, [0, 1]))
|
102 |
+
|
103 |
+
out_h = (in_h * up_y + pad_y0 + pad_y1 - kernel_h) // down_y + 1
|
104 |
+
out_w = (in_w * up_x + pad_x0 + pad_x1 - kernel_w) // down_x + 1
|
105 |
+
ctx.out_size = (out_h, out_w)
|
106 |
+
|
107 |
+
ctx.up = (up_x, up_y)
|
108 |
+
ctx.down = (down_x, down_y)
|
109 |
+
ctx.pad = (pad_x0, pad_x1, pad_y0, pad_y1)
|
110 |
+
|
111 |
+
g_pad_x0 = kernel_w - pad_x0 - 1
|
112 |
+
g_pad_y0 = kernel_h - pad_y0 - 1
|
113 |
+
g_pad_x1 = in_w * up_x - out_w * down_x + pad_x0 - up_x + 1
|
114 |
+
g_pad_y1 = in_h * up_y - out_h * down_y + pad_y0 - up_y + 1
|
115 |
+
|
116 |
+
ctx.g_pad = (g_pad_x0, g_pad_x1, g_pad_y0, g_pad_y1)
|
117 |
+
|
118 |
+
out = upfirdn2d_op.upfirdn2d(
|
119 |
+
input, kernel, up_x, up_y, down_x, down_y, pad_x0, pad_x1, pad_y0, pad_y1
|
120 |
+
)
|
121 |
+
# out = out.view(major, out_h, out_w, minor)
|
122 |
+
out = out.view(-1, channel, out_h, out_w)
|
123 |
+
|
124 |
+
return out
|
125 |
+
|
126 |
+
@staticmethod
|
127 |
+
def backward(ctx, grad_output):
|
128 |
+
kernel, grad_kernel = ctx.saved_tensors
|
129 |
+
|
130 |
+
grad_input = UpFirDn2dBackward.apply(
|
131 |
+
grad_output,
|
132 |
+
kernel,
|
133 |
+
grad_kernel,
|
134 |
+
ctx.up,
|
135 |
+
ctx.down,
|
136 |
+
ctx.pad,
|
137 |
+
ctx.g_pad,
|
138 |
+
ctx.in_size,
|
139 |
+
ctx.out_size,
|
140 |
+
)
|
141 |
+
|
142 |
+
return grad_input, None, None, None, None
|
143 |
+
|
144 |
+
|
145 |
+
def upfirdn2d(input, kernel, up=1, down=1, pad=(0, 0)):
|
146 |
+
out = UpFirDn2d.apply(
|
147 |
+
input, kernel, (up, up), (down, down), (pad[0], pad[1], pad[0], pad[1])
|
148 |
+
)
|
149 |
+
|
150 |
+
return out
|
151 |
+
|
152 |
+
|
153 |
+
def upfirdn2d_native(
|
154 |
+
input, kernel, up_x, up_y, down_x, down_y, pad_x0, pad_x1, pad_y0, pad_y1
|
155 |
+
):
|
156 |
+
_, in_h, in_w, minor = input.shape
|
157 |
+
kernel_h, kernel_w = kernel.shape
|
158 |
+
|
159 |
+
out = input.view(-1, in_h, 1, in_w, 1, minor)
|
160 |
+
out = F.pad(out, [0, 0, 0, up_x - 1, 0, 0, 0, up_y - 1])
|
161 |
+
out = out.view(-1, in_h * up_y, in_w * up_x, minor)
|
162 |
+
|
163 |
+
out = F.pad(
|
164 |
+
out, [0, 0, max(pad_x0, 0), max(pad_x1, 0), max(pad_y0, 0), max(pad_y1, 0)]
|
165 |
+
)
|
166 |
+
out = out[
|
167 |
+
:,
|
168 |
+
max(-pad_y0, 0) : out.shape[1] - max(-pad_y1, 0),
|
169 |
+
max(-pad_x0, 0) : out.shape[2] - max(-pad_x1, 0),
|
170 |
+
:,
|
171 |
+
]
|
172 |
+
|
173 |
+
out = out.permute(0, 3, 1, 2)
|
174 |
+
out = out.reshape(
|
175 |
+
[-1, 1, in_h * up_y + pad_y0 + pad_y1, in_w * up_x + pad_x0 + pad_x1]
|
176 |
+
)
|
177 |
+
w = torch.flip(kernel, [0, 1]).view(1, 1, kernel_h, kernel_w)
|
178 |
+
out = F.conv2d(out, w)
|
179 |
+
out = out.reshape(
|
180 |
+
-1,
|
181 |
+
minor,
|
182 |
+
in_h * up_y + pad_y0 + pad_y1 - kernel_h + 1,
|
183 |
+
in_w * up_x + pad_x0 + pad_x1 - kernel_w + 1,
|
184 |
+
)
|
185 |
+
out = out.permute(0, 2, 3, 1)
|
186 |
+
|
187 |
+
return out[:, ::down_y, ::down_x, :]
|
188 |
+
|
face_vid2vid/GPEN/face_model/op/upfirdn2d_kernel.cu
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
|
2 |
+
//
|
3 |
+
// This work is made available under the Nvidia Source Code License-NC.
|
4 |
+
// To view a copy of this license, visit
|
5 |
+
// https://nvlabs.github.io/stylegan2/license.html
|
6 |
+
|
7 |
+
#include <torch/types.h>
|
8 |
+
|
9 |
+
#include <ATen/ATen.h>
|
10 |
+
#include <ATen/AccumulateType.h>
|
11 |
+
#include <ATen/cuda/CUDAContext.h>
|
12 |
+
#include <ATen/cuda/CUDAApplyUtils.cuh>
|
13 |
+
|
14 |
+
#include <cuda.h>
|
15 |
+
#include <cuda_runtime.h>
|
16 |
+
|
17 |
+
|
18 |
+
static __host__ __device__ __forceinline__ int floor_div(int a, int b) {
|
19 |
+
int c = a / b;
|
20 |
+
|
21 |
+
if (c * b > a) {
|
22 |
+
c--;
|
23 |
+
}
|
24 |
+
|
25 |
+
return c;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
struct UpFirDn2DKernelParams {
|
30 |
+
int up_x;
|
31 |
+
int up_y;
|
32 |
+
int down_x;
|
33 |
+
int down_y;
|
34 |
+
int pad_x0;
|
35 |
+
int pad_x1;
|
36 |
+
int pad_y0;
|
37 |
+
int pad_y1;
|
38 |
+
|
39 |
+
int major_dim;
|
40 |
+
int in_h;
|
41 |
+
int in_w;
|
42 |
+
int minor_dim;
|
43 |
+
int kernel_h;
|
44 |
+
int kernel_w;
|
45 |
+
int out_h;
|
46 |
+
int out_w;
|
47 |
+
int loop_major;
|
48 |
+
int loop_x;
|
49 |
+
};
|
50 |
+
|
51 |
+
|
52 |
+
template <typename scalar_t, int up_x, int up_y, int down_x, int down_y, int kernel_h, int kernel_w, int tile_out_h, int tile_out_w>
|
53 |
+
__global__ void upfirdn2d_kernel(scalar_t* out, const scalar_t* input, const scalar_t* kernel, const UpFirDn2DKernelParams p) {
|
54 |
+
const int tile_in_h = ((tile_out_h - 1) * down_y + kernel_h - 1) / up_y + 1;
|
55 |
+
const int tile_in_w = ((tile_out_w - 1) * down_x + kernel_w - 1) / up_x + 1;
|
56 |
+
|
57 |
+
__shared__ volatile float sk[kernel_h][kernel_w];
|
58 |
+
__shared__ volatile float sx[tile_in_h][tile_in_w];
|
59 |
+
|
60 |
+
int minor_idx = blockIdx.x;
|
61 |
+
int tile_out_y = minor_idx / p.minor_dim;
|
62 |
+
minor_idx -= tile_out_y * p.minor_dim;
|
63 |
+
tile_out_y *= tile_out_h;
|
64 |
+
int tile_out_x_base = blockIdx.y * p.loop_x * tile_out_w;
|
65 |
+
int major_idx_base = blockIdx.z * p.loop_major;
|
66 |
+
|
67 |
+
if (tile_out_x_base >= p.out_w | tile_out_y >= p.out_h | major_idx_base >= p.major_dim) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
for (int tap_idx = threadIdx.x; tap_idx < kernel_h * kernel_w; tap_idx += blockDim.x) {
|
72 |
+
int ky = tap_idx / kernel_w;
|
73 |
+
int kx = tap_idx - ky * kernel_w;
|
74 |
+
scalar_t v = 0.0;
|
75 |
+
|
76 |
+
if (kx < p.kernel_w & ky < p.kernel_h) {
|
77 |
+
v = kernel[(p.kernel_h - 1 - ky) * p.kernel_w + (p.kernel_w - 1 - kx)];
|
78 |
+
}
|
79 |
+
|
80 |
+
sk[ky][kx] = v;
|
81 |
+
}
|
82 |
+
|
83 |
+
for (int loop_major = 0, major_idx = major_idx_base; loop_major < p.loop_major & major_idx < p.major_dim; loop_major++, major_idx++) {
|
84 |
+
for (int loop_x = 0, tile_out_x = tile_out_x_base; loop_x < p.loop_x & tile_out_x < p.out_w; loop_x++, tile_out_x += tile_out_w) {
|
85 |
+
int tile_mid_x = tile_out_x * down_x + up_x - 1 - p.pad_x0;
|
86 |
+
int tile_mid_y = tile_out_y * down_y + up_y - 1 - p.pad_y0;
|
87 |
+
int tile_in_x = floor_div(tile_mid_x, up_x);
|
88 |
+
int tile_in_y = floor_div(tile_mid_y, up_y);
|
89 |
+
|
90 |
+
__syncthreads();
|
91 |
+
|
92 |
+
for (int in_idx = threadIdx.x; in_idx < tile_in_h * tile_in_w; in_idx += blockDim.x) {
|
93 |
+
int rel_in_y = in_idx / tile_in_w;
|
94 |
+
int rel_in_x = in_idx - rel_in_y * tile_in_w;
|
95 |
+
int in_x = rel_in_x + tile_in_x;
|
96 |
+
int in_y = rel_in_y + tile_in_y;
|
97 |
+
|
98 |
+
scalar_t v = 0.0;
|
99 |
+
|
100 |
+
if (in_x >= 0 & in_y >= 0 & in_x < p.in_w & in_y < p.in_h) {
|
101 |
+
v = input[((major_idx * p.in_h + in_y) * p.in_w + in_x) * p.minor_dim + minor_idx];
|
102 |
+
}
|
103 |
+
|
104 |
+
sx[rel_in_y][rel_in_x] = v;
|
105 |
+
}
|
106 |
+
|
107 |
+
__syncthreads();
|
108 |
+
for (int out_idx = threadIdx.x; out_idx < tile_out_h * tile_out_w; out_idx += blockDim.x) {
|
109 |
+
int rel_out_y = out_idx / tile_out_w;
|
110 |
+
int rel_out_x = out_idx - rel_out_y * tile_out_w;
|
111 |
+
int out_x = rel_out_x + tile_out_x;
|
112 |
+
int out_y = rel_out_y + tile_out_y;
|
113 |
+
|
114 |
+
int mid_x = tile_mid_x + rel_out_x * down_x;
|
115 |
+
int mid_y = tile_mid_y + rel_out_y * down_y;
|
116 |
+
int in_x = floor_div(mid_x, up_x);
|
117 |
+
int in_y = floor_div(mid_y, up_y);
|
118 |
+
int rel_in_x = in_x - tile_in_x;
|
119 |
+
int rel_in_y = in_y - tile_in_y;
|
120 |
+
int kernel_x = (in_x + 1) * up_x - mid_x - 1;
|
121 |
+
int kernel_y = (in_y + 1) * up_y - mid_y - 1;
|
122 |
+
|
123 |
+
scalar_t v = 0.0;
|
124 |
+
|
125 |
+
#pragma unroll
|
126 |
+
for (int y = 0; y < kernel_h / up_y; y++)
|
127 |
+
#pragma unroll
|
128 |
+
for (int x = 0; x < kernel_w / up_x; x++)
|
129 |
+
v += sx[rel_in_y + y][rel_in_x + x] * sk[kernel_y + y * up_y][kernel_x + x * up_x];
|
130 |
+
|
131 |
+
if (out_x < p.out_w & out_y < p.out_h) {
|
132 |
+
out[((major_idx * p.out_h + out_y) * p.out_w + out_x) * p.minor_dim + minor_idx] = v;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
torch::Tensor upfirdn2d_op(const torch::Tensor& input, const torch::Tensor& kernel,
|
141 |
+
int up_x, int up_y, int down_x, int down_y,
|
142 |
+
int pad_x0, int pad_x1, int pad_y0, int pad_y1) {
|
143 |
+
int curDevice = -1;
|
144 |
+
cudaGetDevice(&curDevice);
|
145 |
+
cudaStream_t stream = at::cuda::getCurrentCUDAStream(curDevice);
|
146 |
+
|
147 |
+
UpFirDn2DKernelParams p;
|
148 |
+
|
149 |
+
auto x = input.contiguous();
|
150 |
+
auto k = kernel.contiguous();
|
151 |
+
|
152 |
+
p.major_dim = x.size(0);
|
153 |
+
p.in_h = x.size(1);
|
154 |
+
p.in_w = x.size(2);
|
155 |
+
p.minor_dim = x.size(3);
|
156 |
+
p.kernel_h = k.size(0);
|
157 |
+
p.kernel_w = k.size(1);
|
158 |
+
p.up_x = up_x;
|
159 |
+
p.up_y = up_y;
|
160 |
+
p.down_x = down_x;
|
161 |
+
p.down_y = down_y;
|
162 |
+
p.pad_x0 = pad_x0;
|
163 |
+
p.pad_x1 = pad_x1;
|
164 |
+
p.pad_y0 = pad_y0;
|
165 |
+
p.pad_y1 = pad_y1;
|
166 |
+
|
167 |
+
p.out_h = (p.in_h * p.up_y + p.pad_y0 + p.pad_y1 - p.kernel_h + p.down_y) / p.down_y;
|
168 |
+
p.out_w = (p.in_w * p.up_x + p.pad_x0 + p.pad_x1 - p.kernel_w + p.down_x) / p.down_x;
|
169 |
+
|
170 |
+
auto out = at::empty({p.major_dim, p.out_h, p.out_w, p.minor_dim}, x.options());
|
171 |
+
|
172 |
+
int mode = -1;
|
173 |
+
|
174 |
+
int tile_out_h;
|
175 |
+
int tile_out_w;
|
176 |
+
|
177 |
+
if (p.up_x == 1 && p.up_y == 1 && p.down_x == 1 && p.down_y == 1 && p.kernel_h <= 4 && p.kernel_w <= 4) {
|
178 |
+
mode = 1;
|
179 |
+
tile_out_h = 16;
|
180 |
+
tile_out_w = 64;
|
181 |
+
}
|
182 |
+
|
183 |
+
if (p.up_x == 1 && p.up_y == 1 && p.down_x == 1 && p.down_y == 1 && p.kernel_h <= 3 && p.kernel_w <= 3) {
|
184 |
+
mode = 2;
|
185 |
+
tile_out_h = 16;
|
186 |
+
tile_out_w = 64;
|
187 |
+
}
|
188 |
+
|
189 |
+
if (p.up_x == 2 && p.up_y == 2 && p.down_x == 1 && p.down_y == 1 && p.kernel_h <= 4 && p.kernel_w <= 4) {
|
190 |
+
mode = 3;
|
191 |
+
tile_out_h = 16;
|
192 |
+
tile_out_w = 64;
|
193 |
+
}
|
194 |
+
|
195 |
+
if (p.up_x == 2 && p.up_y == 2 && p.down_x == 1 && p.down_y == 1 && p.kernel_h <= 2 && p.kernel_w <= 2) {
|
196 |
+
mode = 4;
|
197 |
+
tile_out_h = 16;
|
198 |
+
tile_out_w = 64;
|
199 |
+
}
|
200 |
+
|
201 |
+
if (p.up_x == 1 && p.up_y == 1 && p.down_x == 2 && p.down_y == 2 && p.kernel_h <= 4 && p.kernel_w <= 4) {
|
202 |
+
mode = 5;
|
203 |
+
tile_out_h = 8;
|
204 |
+
tile_out_w = 32;
|
205 |
+
}
|
206 |
+
|
207 |
+
if (p.up_x == 1 && p.up_y == 1 && p.down_x == 2 && p.down_y == 2 && p.kernel_h <= 2 && p.kernel_w <= 2) {
|
208 |
+
mode = 6;
|
209 |
+
tile_out_h = 8;
|
210 |
+
tile_out_w = 32;
|
211 |
+
}
|
212 |
+
|
213 |
+
dim3 block_size;
|
214 |
+
dim3 grid_size;
|
215 |
+
|
216 |
+
if (tile_out_h > 0 && tile_out_w) {
|
217 |
+
p.loop_major = (p.major_dim - 1) / 16384 + 1;
|
218 |
+
p.loop_x = 1;
|
219 |
+
block_size = dim3(32 * 8, 1, 1);
|
220 |
+
grid_size = dim3(((p.out_h - 1) / tile_out_h + 1) * p.minor_dim,
|
221 |
+
(p.out_w - 1) / (p.loop_x * tile_out_w) + 1,
|
222 |
+
(p.major_dim - 1) / p.loop_major + 1);
|
223 |
+
}
|
224 |
+
|
225 |
+
AT_DISPATCH_FLOATING_TYPES_AND_HALF(x.scalar_type(), "upfirdn2d_cuda", [&] {
|
226 |
+
switch (mode) {
|
227 |
+
case 1:
|
228 |
+
upfirdn2d_kernel<scalar_t, 1, 1, 1, 1, 4, 4, 16, 64><<<grid_size, block_size, 0, stream>>>(
|
229 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
230 |
+
);
|
231 |
+
|
232 |
+
break;
|
233 |
+
|
234 |
+
case 2:
|
235 |
+
upfirdn2d_kernel<scalar_t, 1, 1, 1, 1, 3, 3, 16, 64><<<grid_size, block_size, 0, stream>>>(
|
236 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
237 |
+
);
|
238 |
+
|
239 |
+
break;
|
240 |
+
|
241 |
+
case 3:
|
242 |
+
upfirdn2d_kernel<scalar_t, 2, 2, 1, 1, 4, 4, 16, 64><<<grid_size, block_size, 0, stream>>>(
|
243 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
244 |
+
);
|
245 |
+
|
246 |
+
break;
|
247 |
+
|
248 |
+
case 4:
|
249 |
+
upfirdn2d_kernel<scalar_t, 2, 2, 1, 1, 2, 2, 16, 64><<<grid_size, block_size, 0, stream>>>(
|
250 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
251 |
+
);
|
252 |
+
|
253 |
+
break;
|
254 |
+
|
255 |
+
case 5:
|
256 |
+
upfirdn2d_kernel<scalar_t, 1, 1, 2, 2, 4, 4, 8, 32><<<grid_size, block_size, 0, stream>>>(
|
257 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
258 |
+
);
|
259 |
+
|
260 |
+
break;
|
261 |
+
|
262 |
+
case 6:
|
263 |
+
upfirdn2d_kernel<scalar_t, 1, 1, 2, 2, 4, 4, 8, 32><<<grid_size, block_size, 0, stream>>>(
|
264 |
+
out.data_ptr<scalar_t>(), x.data_ptr<scalar_t>(), k.data_ptr<scalar_t>(), p
|
265 |
+
);
|
266 |
+
|
267 |
+
break;
|
268 |
+
}
|
269 |
+
});
|
270 |
+
|
271 |
+
return out;
|
272 |
+
}
|
face_vid2vid/GPEN/requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ninja
|
2 |
+
torch
|
3 |
+
torchvision
|
4 |
+
opencv-python
|
5 |
+
numpy
|
6 |
+
scikit-image
|
7 |
+
pillow
|
8 |
+
pyyaml==5.4.1
|
face_vid2vid/GPEN/retinaface/data/FDDB/img_list.txt
ADDED
@@ -0,0 +1,2845 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2002/08/11/big/img_591
|
2 |
+
2002/08/26/big/img_265
|
3 |
+
2002/07/19/big/img_423
|
4 |
+
2002/08/24/big/img_490
|
5 |
+
2002/08/31/big/img_17676
|
6 |
+
2002/07/31/big/img_228
|
7 |
+
2002/07/24/big/img_402
|
8 |
+
2002/08/04/big/img_769
|
9 |
+
2002/07/19/big/img_581
|
10 |
+
2002/08/13/big/img_723
|
11 |
+
2002/08/12/big/img_821
|
12 |
+
2003/01/17/big/img_610
|
13 |
+
2002/08/13/big/img_1116
|
14 |
+
2002/08/28/big/img_19238
|
15 |
+
2002/08/21/big/img_660
|
16 |
+
2002/08/14/big/img_607
|
17 |
+
2002/08/05/big/img_3708
|
18 |
+
2002/08/19/big/img_511
|
19 |
+
2002/08/07/big/img_1316
|
20 |
+
2002/07/25/big/img_1047
|
21 |
+
2002/07/23/big/img_474
|
22 |
+
2002/07/27/big/img_970
|
23 |
+
2002/09/02/big/img_15752
|
24 |
+
2002/09/01/big/img_16378
|
25 |
+
2002/09/01/big/img_16189
|
26 |
+
2002/08/26/big/img_276
|
27 |
+
2002/07/24/big/img_518
|
28 |
+
2002/08/14/big/img_1027
|
29 |
+
2002/08/24/big/img_733
|
30 |
+
2002/08/15/big/img_249
|
31 |
+
2003/01/15/big/img_1371
|
32 |
+
2002/08/07/big/img_1348
|
33 |
+
2003/01/01/big/img_331
|
34 |
+
2002/08/23/big/img_536
|
35 |
+
2002/07/30/big/img_224
|
36 |
+
2002/08/10/big/img_763
|
37 |
+
2002/08/21/big/img_293
|
38 |
+
2002/08/15/big/img_1211
|
39 |
+
2002/08/15/big/img_1194
|
40 |
+
2003/01/15/big/img_390
|
41 |
+
2002/08/06/big/img_2893
|
42 |
+
2002/08/17/big/img_691
|
43 |
+
2002/08/07/big/img_1695
|
44 |
+
2002/08/16/big/img_829
|
45 |
+
2002/07/25/big/img_201
|
46 |
+
2002/08/23/big/img_36
|
47 |
+
2003/01/15/big/img_763
|
48 |
+
2003/01/15/big/img_637
|
49 |
+
2002/08/22/big/img_592
|
50 |
+
2002/07/25/big/img_817
|
51 |
+
2003/01/15/big/img_1219
|
52 |
+
2002/08/05/big/img_3508
|
53 |
+
2002/08/15/big/img_1108
|
54 |
+
2002/07/19/big/img_488
|
55 |
+
2003/01/16/big/img_704
|
56 |
+
2003/01/13/big/img_1087
|
57 |
+
2002/08/10/big/img_670
|
58 |
+
2002/07/24/big/img_104
|
59 |
+
2002/08/27/big/img_19823
|
60 |
+
2002/09/01/big/img_16229
|
61 |
+
2003/01/13/big/img_846
|
62 |
+
2002/08/04/big/img_412
|
63 |
+
2002/07/22/big/img_554
|
64 |
+
2002/08/12/big/img_331
|
65 |
+
2002/08/02/big/img_533
|
66 |
+
2002/08/12/big/img_259
|
67 |
+
2002/08/18/big/img_328
|
68 |
+
2003/01/14/big/img_630
|
69 |
+
2002/08/05/big/img_3541
|
70 |
+
2002/08/06/big/img_2390
|
71 |
+
2002/08/20/big/img_150
|
72 |
+
2002/08/02/big/img_1231
|
73 |
+
2002/08/16/big/img_710
|
74 |
+
2002/08/19/big/img_591
|
75 |
+
2002/07/22/big/img_725
|
76 |
+
2002/07/24/big/img_820
|
77 |
+
2003/01/13/big/img_568
|
78 |
+
2002/08/22/big/img_853
|
79 |
+
2002/08/09/big/img_648
|
80 |
+
2002/08/23/big/img_528
|
81 |
+
2003/01/14/big/img_888
|
82 |
+
2002/08/30/big/img_18201
|
83 |
+
2002/08/13/big/img_965
|
84 |
+
2003/01/14/big/img_660
|
85 |
+
2002/07/19/big/img_517
|
86 |
+
2003/01/14/big/img_406
|
87 |
+
2002/08/30/big/img_18433
|
88 |
+
2002/08/07/big/img_1630
|
89 |
+
2002/08/06/big/img_2717
|
90 |
+
2002/08/21/big/img_470
|
91 |
+
2002/07/23/big/img_633
|
92 |
+
2002/08/20/big/img_915
|
93 |
+
2002/08/16/big/img_893
|
94 |
+
2002/07/29/big/img_644
|
95 |
+
2002/08/15/big/img_529
|
96 |
+
2002/08/16/big/img_668
|
97 |
+
2002/08/07/big/img_1871
|
98 |
+
2002/07/25/big/img_192
|
99 |
+
2002/07/31/big/img_961
|
100 |
+
2002/08/19/big/img_738
|
101 |
+
2002/07/31/big/img_382
|
102 |
+
2002/08/19/big/img_298
|
103 |
+
2003/01/17/big/img_608
|
104 |
+
2002/08/21/big/img_514
|
105 |
+
2002/07/23/big/img_183
|
106 |
+
2003/01/17/big/img_536
|
107 |
+
2002/07/24/big/img_478
|
108 |
+
2002/08/06/big/img_2997
|
109 |
+
2002/09/02/big/img_15380
|
110 |
+
2002/08/07/big/img_1153
|
111 |
+
2002/07/31/big/img_967
|
112 |
+
2002/07/31/big/img_711
|
113 |
+
2002/08/26/big/img_664
|
114 |
+
2003/01/01/big/img_326
|
115 |
+
2002/08/24/big/img_775
|
116 |
+
2002/08/08/big/img_961
|
117 |
+
2002/08/16/big/img_77
|
118 |
+
2002/08/12/big/img_296
|
119 |
+
2002/07/22/big/img_905
|
120 |
+
2003/01/13/big/img_284
|
121 |
+
2002/08/13/big/img_887
|
122 |
+
2002/08/24/big/img_849
|
123 |
+
2002/07/30/big/img_345
|
124 |
+
2002/08/18/big/img_419
|
125 |
+
2002/08/01/big/img_1347
|
126 |
+
2002/08/05/big/img_3670
|
127 |
+
2002/07/21/big/img_479
|
128 |
+
2002/08/08/big/img_913
|
129 |
+
2002/09/02/big/img_15828
|
130 |
+
2002/08/30/big/img_18194
|
131 |
+
2002/08/08/big/img_471
|
132 |
+
2002/08/22/big/img_734
|
133 |
+
2002/08/09/big/img_586
|
134 |
+
2002/08/09/big/img_454
|
135 |
+
2002/07/29/big/img_47
|
136 |
+
2002/07/19/big/img_381
|
137 |
+
2002/07/29/big/img_733
|
138 |
+
2002/08/20/big/img_327
|
139 |
+
2002/07/21/big/img_96
|
140 |
+
2002/08/06/big/img_2680
|
141 |
+
2002/07/25/big/img_919
|
142 |
+
2002/07/21/big/img_158
|
143 |
+
2002/07/22/big/img_801
|
144 |
+
2002/07/22/big/img_567
|
145 |
+
2002/07/24/big/img_804
|
146 |
+
2002/07/24/big/img_690
|
147 |
+
2003/01/15/big/img_576
|
148 |
+
2002/08/14/big/img_335
|
149 |
+
2003/01/13/big/img_390
|
150 |
+
2002/08/11/big/img_258
|
151 |
+
2002/07/23/big/img_917
|
152 |
+
2002/08/15/big/img_525
|
153 |
+
2003/01/15/big/img_505
|
154 |
+
2002/07/30/big/img_886
|
155 |
+
2003/01/16/big/img_640
|
156 |
+
2003/01/14/big/img_642
|
157 |
+
2003/01/17/big/img_844
|
158 |
+
2002/08/04/big/img_571
|
159 |
+
2002/08/29/big/img_18702
|
160 |
+
2003/01/15/big/img_240
|
161 |
+
2002/07/29/big/img_553
|
162 |
+
2002/08/10/big/img_354
|
163 |
+
2002/08/18/big/img_17
|
164 |
+
2003/01/15/big/img_782
|
165 |
+
2002/07/27/big/img_382
|
166 |
+
2002/08/14/big/img_970
|
167 |
+
2003/01/16/big/img_70
|
168 |
+
2003/01/16/big/img_625
|
169 |
+
2002/08/18/big/img_341
|
170 |
+
2002/08/26/big/img_188
|
171 |
+
2002/08/09/big/img_405
|
172 |
+
2002/08/02/big/img_37
|
173 |
+
2002/08/13/big/img_748
|
174 |
+
2002/07/22/big/img_399
|
175 |
+
2002/07/25/big/img_844
|
176 |
+
2002/08/12/big/img_340
|
177 |
+
2003/01/13/big/img_815
|
178 |
+
2002/08/26/big/img_5
|
179 |
+
2002/08/10/big/img_158
|
180 |
+
2002/08/18/big/img_95
|
181 |
+
2002/07/29/big/img_1297
|
182 |
+
2003/01/13/big/img_508
|
183 |
+
2002/09/01/big/img_16680
|
184 |
+
2003/01/16/big/img_338
|
185 |
+
2002/08/13/big/img_517
|
186 |
+
2002/07/22/big/img_626
|
187 |
+
2002/08/06/big/img_3024
|
188 |
+
2002/07/26/big/img_499
|
189 |
+
2003/01/13/big/img_387
|
190 |
+
2002/08/31/big/img_18025
|
191 |
+
2002/08/13/big/img_520
|
192 |
+
2003/01/16/big/img_576
|
193 |
+
2002/07/26/big/img_121
|
194 |
+
2002/08/25/big/img_703
|
195 |
+
2002/08/26/big/img_615
|
196 |
+
2002/08/17/big/img_434
|
197 |
+
2002/08/02/big/img_677
|
198 |
+
2002/08/18/big/img_276
|
199 |
+
2002/08/05/big/img_3672
|
200 |
+
2002/07/26/big/img_700
|
201 |
+
2002/07/31/big/img_277
|
202 |
+
2003/01/14/big/img_220
|
203 |
+
2002/08/23/big/img_232
|
204 |
+
2002/08/31/big/img_17422
|
205 |
+
2002/07/22/big/img_508
|
206 |
+
2002/08/13/big/img_681
|
207 |
+
2003/01/15/big/img_638
|
208 |
+
2002/08/30/big/img_18408
|
209 |
+
2003/01/14/big/img_533
|
210 |
+
2003/01/17/big/img_12
|
211 |
+
2002/08/28/big/img_19388
|
212 |
+
2002/08/08/big/img_133
|
213 |
+
2002/07/26/big/img_885
|
214 |
+
2002/08/19/big/img_387
|
215 |
+
2002/08/27/big/img_19976
|
216 |
+
2002/08/26/big/img_118
|
217 |
+
2002/08/28/big/img_19146
|
218 |
+
2002/08/05/big/img_3259
|
219 |
+
2002/08/15/big/img_536
|
220 |
+
2002/07/22/big/img_279
|
221 |
+
2002/07/22/big/img_9
|
222 |
+
2002/08/13/big/img_301
|
223 |
+
2002/08/15/big/img_974
|
224 |
+
2002/08/06/big/img_2355
|
225 |
+
2002/08/01/big/img_1526
|
226 |
+
2002/08/03/big/img_417
|
227 |
+
2002/08/04/big/img_407
|
228 |
+
2002/08/15/big/img_1029
|
229 |
+
2002/07/29/big/img_700
|
230 |
+
2002/08/01/big/img_1463
|
231 |
+
2002/08/31/big/img_17365
|
232 |
+
2002/07/28/big/img_223
|
233 |
+
2002/07/19/big/img_827
|
234 |
+
2002/07/27/big/img_531
|
235 |
+
2002/07/19/big/img_845
|
236 |
+
2002/08/20/big/img_382
|
237 |
+
2002/07/31/big/img_268
|
238 |
+
2002/08/27/big/img_19705
|
239 |
+
2002/08/02/big/img_830
|
240 |
+
2002/08/23/big/img_250
|
241 |
+
2002/07/20/big/img_777
|
242 |
+
2002/08/21/big/img_879
|
243 |
+
2002/08/26/big/img_20146
|
244 |
+
2002/08/23/big/img_789
|
245 |
+
2002/08/06/big/img_2683
|
246 |
+
2002/08/25/big/img_576
|
247 |
+
2002/08/09/big/img_498
|
248 |
+
2002/08/08/big/img_384
|
249 |
+
2002/08/26/big/img_592
|
250 |
+
2002/07/29/big/img_1470
|
251 |
+
2002/08/21/big/img_452
|
252 |
+
2002/08/30/big/img_18395
|
253 |
+
2002/08/15/big/img_215
|
254 |
+
2002/07/21/big/img_643
|
255 |
+
2002/07/22/big/img_209
|
256 |
+
2003/01/17/big/img_346
|
257 |
+
2002/08/25/big/img_658
|
258 |
+
2002/08/21/big/img_221
|
259 |
+
2002/08/14/big/img_60
|
260 |
+
2003/01/17/big/img_885
|
261 |
+
2003/01/16/big/img_482
|
262 |
+
2002/08/19/big/img_593
|
263 |
+
2002/08/08/big/img_233
|
264 |
+
2002/07/30/big/img_458
|
265 |
+
2002/07/23/big/img_384
|
266 |
+
2003/01/15/big/img_670
|
267 |
+
2003/01/15/big/img_267
|
268 |
+
2002/08/26/big/img_540
|
269 |
+
2002/07/29/big/img_552
|
270 |
+
2002/07/30/big/img_997
|
271 |
+
2003/01/17/big/img_377
|
272 |
+
2002/08/21/big/img_265
|
273 |
+
2002/08/09/big/img_561
|
274 |
+
2002/07/31/big/img_945
|
275 |
+
2002/09/02/big/img_15252
|
276 |
+
2002/08/11/big/img_276
|
277 |
+
2002/07/22/big/img_491
|
278 |
+
2002/07/26/big/img_517
|
279 |
+
2002/08/14/big/img_726
|
280 |
+
2002/08/08/big/img_46
|
281 |
+
2002/08/28/big/img_19458
|
282 |
+
2002/08/06/big/img_2935
|
283 |
+
2002/07/29/big/img_1392
|
284 |
+
2002/08/13/big/img_776
|
285 |
+
2002/08/24/big/img_616
|
286 |
+
2002/08/14/big/img_1065
|
287 |
+
2002/07/29/big/img_889
|
288 |
+
2002/08/18/big/img_188
|
289 |
+
2002/08/07/big/img_1453
|
290 |
+
2002/08/02/big/img_760
|
291 |
+
2002/07/28/big/img_416
|
292 |
+
2002/08/07/big/img_1393
|
293 |
+
2002/08/26/big/img_292
|
294 |
+
2002/08/26/big/img_301
|
295 |
+
2003/01/13/big/img_195
|
296 |
+
2002/07/26/big/img_532
|
297 |
+
2002/08/20/big/img_550
|
298 |
+
2002/08/05/big/img_3658
|
299 |
+
2002/08/26/big/img_738
|
300 |
+
2002/09/02/big/img_15750
|
301 |
+
2003/01/17/big/img_451
|
302 |
+
2002/07/23/big/img_339
|
303 |
+
2002/08/16/big/img_637
|
304 |
+
2002/08/14/big/img_748
|
305 |
+
2002/08/06/big/img_2739
|
306 |
+
2002/07/25/big/img_482
|
307 |
+
2002/08/19/big/img_191
|
308 |
+
2002/08/26/big/img_537
|
309 |
+
2003/01/15/big/img_716
|
310 |
+
2003/01/15/big/img_767
|
311 |
+
2002/08/02/big/img_452
|
312 |
+
2002/08/08/big/img_1011
|
313 |
+
2002/08/10/big/img_144
|
314 |
+
2003/01/14/big/img_122
|
315 |
+
2002/07/24/big/img_586
|
316 |
+
2002/07/24/big/img_762
|
317 |
+
2002/08/20/big/img_369
|
318 |
+
2002/07/30/big/img_146
|
319 |
+
2002/08/23/big/img_396
|
320 |
+
2003/01/15/big/img_200
|
321 |
+
2002/08/15/big/img_1183
|
322 |
+
2003/01/14/big/img_698
|
323 |
+
2002/08/09/big/img_792
|
324 |
+
2002/08/06/big/img_2347
|
325 |
+
2002/07/31/big/img_911
|
326 |
+
2002/08/26/big/img_722
|
327 |
+
2002/08/23/big/img_621
|
328 |
+
2002/08/05/big/img_3790
|
329 |
+
2003/01/13/big/img_633
|
330 |
+
2002/08/09/big/img_224
|
331 |
+
2002/07/24/big/img_454
|
332 |
+
2002/07/21/big/img_202
|
333 |
+
2002/08/02/big/img_630
|
334 |
+
2002/08/30/big/img_18315
|
335 |
+
2002/07/19/big/img_491
|
336 |
+
2002/09/01/big/img_16456
|
337 |
+
2002/08/09/big/img_242
|
338 |
+
2002/07/25/big/img_595
|
339 |
+
2002/07/22/big/img_522
|
340 |
+
2002/08/01/big/img_1593
|
341 |
+
2002/07/29/big/img_336
|
342 |
+
2002/08/15/big/img_448
|
343 |
+
2002/08/28/big/img_19281
|
344 |
+
2002/07/29/big/img_342
|
345 |
+
2002/08/12/big/img_78
|
346 |
+
2003/01/14/big/img_525
|
347 |
+
2002/07/28/big/img_147
|
348 |
+
2002/08/11/big/img_353
|
349 |
+
2002/08/22/big/img_513
|
350 |
+
2002/08/04/big/img_721
|
351 |
+
2002/08/17/big/img_247
|
352 |
+
2003/01/14/big/img_891
|
353 |
+
2002/08/20/big/img_853
|
354 |
+
2002/07/19/big/img_414
|
355 |
+
2002/08/01/big/img_1530
|
356 |
+
2003/01/14/big/img_924
|
357 |
+
2002/08/22/big/img_468
|
358 |
+
2002/08/18/big/img_354
|
359 |
+
2002/08/30/big/img_18193
|
360 |
+
2002/08/23/big/img_492
|
361 |
+
2002/08/15/big/img_871
|
362 |
+
2002/08/12/big/img_494
|
363 |
+
2002/08/06/big/img_2470
|
364 |
+
2002/07/23/big/img_923
|
365 |
+
2002/08/26/big/img_155
|
366 |
+
2002/08/08/big/img_669
|
367 |
+
2002/07/23/big/img_404
|
368 |
+
2002/08/28/big/img_19421
|
369 |
+
2002/08/29/big/img_18993
|
370 |
+
2002/08/25/big/img_416
|
371 |
+
2003/01/17/big/img_434
|
372 |
+
2002/07/29/big/img_1370
|
373 |
+
2002/07/28/big/img_483
|
374 |
+
2002/08/11/big/img_50
|
375 |
+
2002/08/10/big/img_404
|
376 |
+
2002/09/02/big/img_15057
|
377 |
+
2003/01/14/big/img_911
|
378 |
+
2002/09/01/big/img_16697
|
379 |
+
2003/01/16/big/img_665
|
380 |
+
2002/09/01/big/img_16708
|
381 |
+
2002/08/22/big/img_612
|
382 |
+
2002/08/28/big/img_19471
|
383 |
+
2002/08/02/big/img_198
|
384 |
+
2003/01/16/big/img_527
|
385 |
+
2002/08/22/big/img_209
|
386 |
+
2002/08/30/big/img_18205
|
387 |
+
2003/01/14/big/img_114
|
388 |
+
2003/01/14/big/img_1028
|
389 |
+
2003/01/16/big/img_894
|
390 |
+
2003/01/14/big/img_837
|
391 |
+
2002/07/30/big/img_9
|
392 |
+
2002/08/06/big/img_2821
|
393 |
+
2002/08/04/big/img_85
|
394 |
+
2003/01/13/big/img_884
|
395 |
+
2002/07/22/big/img_570
|
396 |
+
2002/08/07/big/img_1773
|
397 |
+
2002/07/26/big/img_208
|
398 |
+
2003/01/17/big/img_946
|
399 |
+
2002/07/19/big/img_930
|
400 |
+
2003/01/01/big/img_698
|
401 |
+
2003/01/17/big/img_612
|
402 |
+
2002/07/19/big/img_372
|
403 |
+
2002/07/30/big/img_721
|
404 |
+
2003/01/14/big/img_649
|
405 |
+
2002/08/19/big/img_4
|
406 |
+
2002/07/25/big/img_1024
|
407 |
+
2003/01/15/big/img_601
|
408 |
+
2002/08/30/big/img_18470
|
409 |
+
2002/07/22/big/img_29
|
410 |
+
2002/08/07/big/img_1686
|
411 |
+
2002/07/20/big/img_294
|
412 |
+
2002/08/14/big/img_800
|
413 |
+
2002/08/19/big/img_353
|
414 |
+
2002/08/19/big/img_350
|
415 |
+
2002/08/05/big/img_3392
|
416 |
+
2002/08/09/big/img_622
|
417 |
+
2003/01/15/big/img_236
|
418 |
+
2002/08/11/big/img_643
|
419 |
+
2002/08/05/big/img_3458
|
420 |
+
2002/08/12/big/img_413
|
421 |
+
2002/08/22/big/img_415
|
422 |
+
2002/08/13/big/img_635
|
423 |
+
2002/08/07/big/img_1198
|
424 |
+
2002/08/04/big/img_873
|
425 |
+
2002/08/12/big/img_407
|
426 |
+
2003/01/15/big/img_346
|
427 |
+
2002/08/02/big/img_275
|
428 |
+
2002/08/17/big/img_997
|
429 |
+
2002/08/21/big/img_958
|
430 |
+
2002/08/20/big/img_579
|
431 |
+
2002/07/29/big/img_142
|
432 |
+
2003/01/14/big/img_1115
|
433 |
+
2002/08/16/big/img_365
|
434 |
+
2002/07/29/big/img_1414
|
435 |
+
2002/08/17/big/img_489
|
436 |
+
2002/08/13/big/img_1010
|
437 |
+
2002/07/31/big/img_276
|
438 |
+
2002/07/25/big/img_1000
|
439 |
+
2002/08/23/big/img_524
|
440 |
+
2002/08/28/big/img_19147
|
441 |
+
2003/01/13/big/img_433
|
442 |
+
2002/08/20/big/img_205
|
443 |
+
2003/01/01/big/img_458
|
444 |
+
2002/07/29/big/img_1449
|
445 |
+
2003/01/16/big/img_696
|
446 |
+
2002/08/28/big/img_19296
|
447 |
+
2002/08/29/big/img_18688
|
448 |
+
2002/08/21/big/img_767
|
449 |
+
2002/08/20/big/img_532
|
450 |
+
2002/08/26/big/img_187
|
451 |
+
2002/07/26/big/img_183
|
452 |
+
2002/07/27/big/img_890
|
453 |
+
2003/01/13/big/img_576
|
454 |
+
2002/07/30/big/img_15
|
455 |
+
2002/07/31/big/img_889
|
456 |
+
2002/08/31/big/img_17759
|
457 |
+
2003/01/14/big/img_1114
|
458 |
+
2002/07/19/big/img_445
|
459 |
+
2002/08/03/big/img_593
|
460 |
+
2002/07/24/big/img_750
|
461 |
+
2002/07/30/big/img_133
|
462 |
+
2002/08/25/big/img_671
|
463 |
+
2002/07/20/big/img_351
|
464 |
+
2002/08/31/big/img_17276
|
465 |
+
2002/08/05/big/img_3231
|
466 |
+
2002/09/02/big/img_15882
|
467 |
+
2002/08/14/big/img_115
|
468 |
+
2002/08/02/big/img_1148
|
469 |
+
2002/07/25/big/img_936
|
470 |
+
2002/07/31/big/img_639
|
471 |
+
2002/08/04/big/img_427
|
472 |
+
2002/08/22/big/img_843
|
473 |
+
2003/01/17/big/img_17
|
474 |
+
2003/01/13/big/img_690
|
475 |
+
2002/08/13/big/img_472
|
476 |
+
2002/08/09/big/img_425
|
477 |
+
2002/08/05/big/img_3450
|
478 |
+
2003/01/17/big/img_439
|
479 |
+
2002/08/13/big/img_539
|
480 |
+
2002/07/28/big/img_35
|
481 |
+
2002/08/16/big/img_241
|
482 |
+
2002/08/06/big/img_2898
|
483 |
+
2003/01/16/big/img_429
|
484 |
+
2002/08/05/big/img_3817
|
485 |
+
2002/08/27/big/img_19919
|
486 |
+
2002/07/19/big/img_422
|
487 |
+
2002/08/15/big/img_560
|
488 |
+
2002/07/23/big/img_750
|
489 |
+
2002/07/30/big/img_353
|
490 |
+
2002/08/05/big/img_43
|
491 |
+
2002/08/23/big/img_305
|
492 |
+
2002/08/01/big/img_2137
|
493 |
+
2002/08/30/big/img_18097
|
494 |
+
2002/08/01/big/img_1389
|
495 |
+
2002/08/02/big/img_308
|
496 |
+
2003/01/14/big/img_652
|
497 |
+
2002/08/01/big/img_1798
|
498 |
+
2003/01/14/big/img_732
|
499 |
+
2003/01/16/big/img_294
|
500 |
+
2002/08/26/big/img_213
|
501 |
+
2002/07/24/big/img_842
|
502 |
+
2003/01/13/big/img_630
|
503 |
+
2003/01/13/big/img_634
|
504 |
+
2002/08/06/big/img_2285
|
505 |
+
2002/08/01/big/img_2162
|
506 |
+
2002/08/30/big/img_18134
|
507 |
+
2002/08/02/big/img_1045
|
508 |
+
2002/08/01/big/img_2143
|
509 |
+
2002/07/25/big/img_135
|
510 |
+
2002/07/20/big/img_645
|
511 |
+
2002/08/05/big/img_3666
|
512 |
+
2002/08/14/big/img_523
|
513 |
+
2002/08/04/big/img_425
|
514 |
+
2003/01/14/big/img_137
|
515 |
+
2003/01/01/big/img_176
|
516 |
+
2002/08/15/big/img_505
|
517 |
+
2002/08/24/big/img_386
|
518 |
+
2002/08/05/big/img_3187
|
519 |
+
2002/08/15/big/img_419
|
520 |
+
2003/01/13/big/img_520
|
521 |
+
2002/08/04/big/img_444
|
522 |
+
2002/08/26/big/img_483
|
523 |
+
2002/08/05/big/img_3449
|
524 |
+
2002/08/30/big/img_18409
|
525 |
+
2002/08/28/big/img_19455
|
526 |
+
2002/08/27/big/img_20090
|
527 |
+
2002/07/23/big/img_625
|
528 |
+
2002/08/24/big/img_205
|
529 |
+
2002/08/08/big/img_938
|
530 |
+
2003/01/13/big/img_527
|
531 |
+
2002/08/07/big/img_1712
|
532 |
+
2002/07/24/big/img_801
|
533 |
+
2002/08/09/big/img_579
|
534 |
+
2003/01/14/big/img_41
|
535 |
+
2003/01/15/big/img_1130
|
536 |
+
2002/07/21/big/img_672
|
537 |
+
2002/08/07/big/img_1590
|
538 |
+
2003/01/01/big/img_532
|
539 |
+
2002/08/02/big/img_529
|
540 |
+
2002/08/05/big/img_3591
|
541 |
+
2002/08/23/big/img_5
|
542 |
+
2003/01/14/big/img_882
|
543 |
+
2002/08/28/big/img_19234
|
544 |
+
2002/07/24/big/img_398
|
545 |
+
2003/01/14/big/img_592
|
546 |
+
2002/08/22/big/img_548
|
547 |
+
2002/08/12/big/img_761
|
548 |
+
2003/01/16/big/img_497
|
549 |
+
2002/08/18/big/img_133
|
550 |
+
2002/08/08/big/img_874
|
551 |
+
2002/07/19/big/img_247
|
552 |
+
2002/08/15/big/img_170
|
553 |
+
2002/08/27/big/img_19679
|
554 |
+
2002/08/20/big/img_246
|
555 |
+
2002/08/24/big/img_358
|
556 |
+
2002/07/29/big/img_599
|
557 |
+
2002/08/01/big/img_1555
|
558 |
+
2002/07/30/big/img_491
|
559 |
+
2002/07/30/big/img_371
|
560 |
+
2003/01/16/big/img_682
|
561 |
+
2002/07/25/big/img_619
|
562 |
+
2003/01/15/big/img_587
|
563 |
+
2002/08/02/big/img_1212
|
564 |
+
2002/08/01/big/img_2152
|
565 |
+
2002/07/25/big/img_668
|
566 |
+
2003/01/16/big/img_574
|
567 |
+
2002/08/28/big/img_19464
|
568 |
+
2002/08/11/big/img_536
|
569 |
+
2002/07/24/big/img_201
|
570 |
+
2002/08/05/big/img_3488
|
571 |
+
2002/07/25/big/img_887
|
572 |
+
2002/07/22/big/img_789
|
573 |
+
2002/07/30/big/img_432
|
574 |
+
2002/08/16/big/img_166
|
575 |
+
2002/09/01/big/img_16333
|
576 |
+
2002/07/26/big/img_1010
|
577 |
+
2002/07/21/big/img_793
|
578 |
+
2002/07/22/big/img_720
|
579 |
+
2002/07/31/big/img_337
|
580 |
+
2002/07/27/big/img_185
|
581 |
+
2002/08/23/big/img_440
|
582 |
+
2002/07/31/big/img_801
|
583 |
+
2002/07/25/big/img_478
|
584 |
+
2003/01/14/big/img_171
|
585 |
+
2002/08/07/big/img_1054
|
586 |
+
2002/09/02/big/img_15659
|
587 |
+
2002/07/29/big/img_1348
|
588 |
+
2002/08/09/big/img_337
|
589 |
+
2002/08/26/big/img_684
|
590 |
+
2002/07/31/big/img_537
|
591 |
+
2002/08/15/big/img_808
|
592 |
+
2003/01/13/big/img_740
|
593 |
+
2002/08/07/big/img_1667
|
594 |
+
2002/08/03/big/img_404
|
595 |
+
2002/08/06/big/img_2520
|
596 |
+
2002/07/19/big/img_230
|
597 |
+
2002/07/19/big/img_356
|
598 |
+
2003/01/16/big/img_627
|
599 |
+
2002/08/04/big/img_474
|
600 |
+
2002/07/29/big/img_833
|
601 |
+
2002/07/25/big/img_176
|
602 |
+
2002/08/01/big/img_1684
|
603 |
+
2002/08/21/big/img_643
|
604 |
+
2002/08/27/big/img_19673
|
605 |
+
2002/08/02/big/img_838
|
606 |
+
2002/08/06/big/img_2378
|
607 |
+
2003/01/15/big/img_48
|
608 |
+
2002/07/30/big/img_470
|
609 |
+
2002/08/15/big/img_963
|
610 |
+
2002/08/24/big/img_444
|
611 |
+
2002/08/16/big/img_662
|
612 |
+
2002/08/15/big/img_1209
|
613 |
+
2002/07/24/big/img_25
|
614 |
+
2002/08/06/big/img_2740
|
615 |
+
2002/07/29/big/img_996
|
616 |
+
2002/08/31/big/img_18074
|
617 |
+
2002/08/04/big/img_343
|
618 |
+
2003/01/17/big/img_509
|
619 |
+
2003/01/13/big/img_726
|
620 |
+
2002/08/07/big/img_1466
|
621 |
+
2002/07/26/big/img_307
|
622 |
+
2002/08/10/big/img_598
|
623 |
+
2002/08/13/big/img_890
|
624 |
+
2002/08/14/big/img_997
|
625 |
+
2002/07/19/big/img_392
|
626 |
+
2002/08/02/big/img_475
|
627 |
+
2002/08/29/big/img_19038
|
628 |
+
2002/07/29/big/img_538
|
629 |
+
2002/07/29/big/img_502
|
630 |
+
2002/08/02/big/img_364
|
631 |
+
2002/08/31/big/img_17353
|
632 |
+
2002/08/08/big/img_539
|
633 |
+
2002/08/01/big/img_1449
|
634 |
+
2002/07/22/big/img_363
|
635 |
+
2002/08/02/big/img_90
|
636 |
+
2002/09/01/big/img_16867
|
637 |
+
2002/08/05/big/img_3371
|
638 |
+
2002/07/30/big/img_342
|
639 |
+
2002/08/07/big/img_1363
|
640 |
+
2002/08/22/big/img_790
|
641 |
+
2003/01/15/big/img_404
|
642 |
+
2002/08/05/big/img_3447
|
643 |
+
2002/09/01/big/img_16167
|
644 |
+
2003/01/13/big/img_840
|
645 |
+
2002/08/22/big/img_1001
|
646 |
+
2002/08/09/big/img_431
|
647 |
+
2002/07/27/big/img_618
|
648 |
+
2002/07/31/big/img_741
|
649 |
+
2002/07/30/big/img_964
|
650 |
+
2002/07/25/big/img_86
|
651 |
+
2002/07/29/big/img_275
|
652 |
+
2002/08/21/big/img_921
|
653 |
+
2002/07/26/big/img_892
|
654 |
+
2002/08/21/big/img_663
|
655 |
+
2003/01/13/big/img_567
|
656 |
+
2003/01/14/big/img_719
|
657 |
+
2002/07/28/big/img_251
|
658 |
+
2003/01/15/big/img_1123
|
659 |
+
2002/07/29/big/img_260
|
660 |
+
2002/08/24/big/img_337
|
661 |
+
2002/08/01/big/img_1914
|
662 |
+
2002/08/13/big/img_373
|
663 |
+
2003/01/15/big/img_589
|
664 |
+
2002/08/13/big/img_906
|
665 |
+
2002/07/26/big/img_270
|
666 |
+
2002/08/26/big/img_313
|
667 |
+
2002/08/25/big/img_694
|
668 |
+
2003/01/01/big/img_327
|
669 |
+
2002/07/23/big/img_261
|
670 |
+
2002/08/26/big/img_642
|
671 |
+
2002/07/29/big/img_918
|
672 |
+
2002/07/23/big/img_455
|
673 |
+
2002/07/24/big/img_612
|
674 |
+
2002/07/23/big/img_534
|
675 |
+
2002/07/19/big/img_534
|
676 |
+
2002/07/19/big/img_726
|
677 |
+
2002/08/01/big/img_2146
|
678 |
+
2002/08/02/big/img_543
|
679 |
+
2003/01/16/big/img_777
|
680 |
+
2002/07/30/big/img_484
|
681 |
+
2002/08/13/big/img_1161
|
682 |
+
2002/07/21/big/img_390
|
683 |
+
2002/08/06/big/img_2288
|
684 |
+
2002/08/21/big/img_677
|
685 |
+
2002/08/13/big/img_747
|
686 |
+
2002/08/15/big/img_1248
|
687 |
+
2002/07/31/big/img_416
|
688 |
+
2002/09/02/big/img_15259
|
689 |
+
2002/08/16/big/img_781
|
690 |
+
2002/08/24/big/img_754
|
691 |
+
2002/07/24/big/img_803
|
692 |
+
2002/08/20/big/img_609
|
693 |
+
2002/08/28/big/img_19571
|
694 |
+
2002/09/01/big/img_16140
|
695 |
+
2002/08/26/big/img_769
|
696 |
+
2002/07/20/big/img_588
|
697 |
+
2002/08/02/big/img_898
|
698 |
+
2002/07/21/big/img_466
|
699 |
+
2002/08/14/big/img_1046
|
700 |
+
2002/07/25/big/img_212
|
701 |
+
2002/08/26/big/img_353
|
702 |
+
2002/08/19/big/img_810
|
703 |
+
2002/08/31/big/img_17824
|
704 |
+
2002/08/12/big/img_631
|
705 |
+
2002/07/19/big/img_828
|
706 |
+
2002/07/24/big/img_130
|
707 |
+
2002/08/25/big/img_580
|
708 |
+
2002/07/31/big/img_699
|
709 |
+
2002/07/23/big/img_808
|
710 |
+
2002/07/31/big/img_377
|
711 |
+
2003/01/16/big/img_570
|
712 |
+
2002/09/01/big/img_16254
|
713 |
+
2002/07/21/big/img_471
|
714 |
+
2002/08/01/big/img_1548
|
715 |
+
2002/08/18/big/img_252
|
716 |
+
2002/08/19/big/img_576
|
717 |
+
2002/08/20/big/img_464
|
718 |
+
2002/07/27/big/img_735
|
719 |
+
2002/08/21/big/img_589
|
720 |
+
2003/01/15/big/img_1192
|
721 |
+
2002/08/09/big/img_302
|
722 |
+
2002/07/31/big/img_594
|
723 |
+
2002/08/23/big/img_19
|
724 |
+
2002/08/29/big/img_18819
|
725 |
+
2002/08/19/big/img_293
|
726 |
+
2002/07/30/big/img_331
|
727 |
+
2002/08/23/big/img_607
|
728 |
+
2002/07/30/big/img_363
|
729 |
+
2002/08/16/big/img_766
|
730 |
+
2003/01/13/big/img_481
|
731 |
+
2002/08/06/big/img_2515
|
732 |
+
2002/09/02/big/img_15913
|
733 |
+
2002/09/02/big/img_15827
|
734 |
+
2002/09/02/big/img_15053
|
735 |
+
2002/08/07/big/img_1576
|
736 |
+
2002/07/23/big/img_268
|
737 |
+
2002/08/21/big/img_152
|
738 |
+
2003/01/15/big/img_578
|
739 |
+
2002/07/21/big/img_589
|
740 |
+
2002/07/20/big/img_548
|
741 |
+
2002/08/27/big/img_19693
|
742 |
+
2002/08/31/big/img_17252
|
743 |
+
2002/07/31/big/img_138
|
744 |
+
2002/07/23/big/img_372
|
745 |
+
2002/08/16/big/img_695
|
746 |
+
2002/07/27/big/img_287
|
747 |
+
2002/08/15/big/img_315
|
748 |
+
2002/08/10/big/img_361
|
749 |
+
2002/07/29/big/img_899
|
750 |
+
2002/08/13/big/img_771
|
751 |
+
2002/08/21/big/img_92
|
752 |
+
2003/01/15/big/img_425
|
753 |
+
2003/01/16/big/img_450
|
754 |
+
2002/09/01/big/img_16942
|
755 |
+
2002/08/02/big/img_51
|
756 |
+
2002/09/02/big/img_15379
|
757 |
+
2002/08/24/big/img_147
|
758 |
+
2002/08/30/big/img_18122
|
759 |
+
2002/07/26/big/img_950
|
760 |
+
2002/08/07/big/img_1400
|
761 |
+
2002/08/17/big/img_468
|
762 |
+
2002/08/15/big/img_470
|
763 |
+
2002/07/30/big/img_318
|
764 |
+
2002/07/22/big/img_644
|
765 |
+
2002/08/27/big/img_19732
|
766 |
+
2002/07/23/big/img_601
|
767 |
+
2002/08/26/big/img_398
|
768 |
+
2002/08/21/big/img_428
|
769 |
+
2002/08/06/big/img_2119
|
770 |
+
2002/08/29/big/img_19103
|
771 |
+
2003/01/14/big/img_933
|
772 |
+
2002/08/11/big/img_674
|
773 |
+
2002/08/28/big/img_19420
|
774 |
+
2002/08/03/big/img_418
|
775 |
+
2002/08/17/big/img_312
|
776 |
+
2002/07/25/big/img_1044
|
777 |
+
2003/01/17/big/img_671
|
778 |
+
2002/08/30/big/img_18297
|
779 |
+
2002/07/25/big/img_755
|
780 |
+
2002/07/23/big/img_471
|
781 |
+
2002/08/21/big/img_39
|
782 |
+
2002/07/26/big/img_699
|
783 |
+
2003/01/14/big/img_33
|
784 |
+
2002/07/31/big/img_411
|
785 |
+
2002/08/16/big/img_645
|
786 |
+
2003/01/17/big/img_116
|
787 |
+
2002/09/02/big/img_15903
|
788 |
+
2002/08/20/big/img_120
|
789 |
+
2002/08/22/big/img_176
|
790 |
+
2002/07/29/big/img_1316
|
791 |
+
2002/08/27/big/img_19914
|
792 |
+
2002/07/22/big/img_719
|
793 |
+
2002/08/28/big/img_19239
|
794 |
+
2003/01/13/big/img_385
|
795 |
+
2002/08/08/big/img_525
|
796 |
+
2002/07/19/big/img_782
|
797 |
+
2002/08/13/big/img_843
|
798 |
+
2002/07/30/big/img_107
|
799 |
+
2002/08/11/big/img_752
|
800 |
+
2002/07/29/big/img_383
|
801 |
+
2002/08/26/big/img_249
|
802 |
+
2002/08/29/big/img_18860
|
803 |
+
2002/07/30/big/img_70
|
804 |
+
2002/07/26/big/img_194
|
805 |
+
2002/08/15/big/img_530
|
806 |
+
2002/08/08/big/img_816
|
807 |
+
2002/07/31/big/img_286
|
808 |
+
2003/01/13/big/img_294
|
809 |
+
2002/07/31/big/img_251
|
810 |
+
2002/07/24/big/img_13
|
811 |
+
2002/08/31/big/img_17938
|
812 |
+
2002/07/22/big/img_642
|
813 |
+
2003/01/14/big/img_728
|
814 |
+
2002/08/18/big/img_47
|
815 |
+
2002/08/22/big/img_306
|
816 |
+
2002/08/20/big/img_348
|
817 |
+
2002/08/15/big/img_764
|
818 |
+
2002/08/08/big/img_163
|
819 |
+
2002/07/23/big/img_531
|
820 |
+
2002/07/23/big/img_467
|
821 |
+
2003/01/16/big/img_743
|
822 |
+
2003/01/13/big/img_535
|
823 |
+
2002/08/02/big/img_523
|
824 |
+
2002/08/22/big/img_120
|
825 |
+
2002/08/11/big/img_496
|
826 |
+
2002/08/29/big/img_19075
|
827 |
+
2002/08/08/big/img_465
|
828 |
+
2002/08/09/big/img_790
|
829 |
+
2002/08/19/big/img_588
|
830 |
+
2002/08/23/big/img_407
|
831 |
+
2003/01/17/big/img_435
|
832 |
+
2002/08/24/big/img_398
|
833 |
+
2002/08/27/big/img_19899
|
834 |
+
2003/01/15/big/img_335
|
835 |
+
2002/08/13/big/img_493
|
836 |
+
2002/09/02/big/img_15460
|
837 |
+
2002/07/31/big/img_470
|
838 |
+
2002/08/05/big/img_3550
|
839 |
+
2002/07/28/big/img_123
|
840 |
+
2002/08/01/big/img_1498
|
841 |
+
2002/08/04/big/img_504
|
842 |
+
2003/01/17/big/img_427
|
843 |
+
2002/08/27/big/img_19708
|
844 |
+
2002/07/27/big/img_861
|
845 |
+
2002/07/25/big/img_685
|
846 |
+
2002/07/31/big/img_207
|
847 |
+
2003/01/14/big/img_745
|
848 |
+
2002/08/31/big/img_17756
|
849 |
+
2002/08/24/big/img_288
|
850 |
+
2002/08/18/big/img_181
|
851 |
+
2002/08/10/big/img_520
|
852 |
+
2002/08/25/big/img_705
|
853 |
+
2002/08/23/big/img_226
|
854 |
+
2002/08/04/big/img_727
|
855 |
+
2002/07/24/big/img_625
|
856 |
+
2002/08/28/big/img_19157
|
857 |
+
2002/08/23/big/img_586
|
858 |
+
2002/07/31/big/img_232
|
859 |
+
2003/01/13/big/img_240
|
860 |
+
2003/01/14/big/img_321
|
861 |
+
2003/01/15/big/img_533
|
862 |
+
2002/07/23/big/img_480
|
863 |
+
2002/07/24/big/img_371
|
864 |
+
2002/08/21/big/img_702
|
865 |
+
2002/08/31/big/img_17075
|
866 |
+
2002/09/02/big/img_15278
|
867 |
+
2002/07/29/big/img_246
|
868 |
+
2003/01/15/big/img_829
|
869 |
+
2003/01/15/big/img_1213
|
870 |
+
2003/01/16/big/img_441
|
871 |
+
2002/08/14/big/img_921
|
872 |
+
2002/07/23/big/img_425
|
873 |
+
2002/08/15/big/img_296
|
874 |
+
2002/07/19/big/img_135
|
875 |
+
2002/07/26/big/img_402
|
876 |
+
2003/01/17/big/img_88
|
877 |
+
2002/08/20/big/img_872
|
878 |
+
2002/08/13/big/img_1110
|
879 |
+
2003/01/16/big/img_1040
|
880 |
+
2002/07/23/big/img_9
|
881 |
+
2002/08/13/big/img_700
|
882 |
+
2002/08/16/big/img_371
|
883 |
+
2002/08/27/big/img_19966
|
884 |
+
2003/01/17/big/img_391
|
885 |
+
2002/08/18/big/img_426
|
886 |
+
2002/08/01/big/img_1618
|
887 |
+
2002/07/21/big/img_754
|
888 |
+
2003/01/14/big/img_1101
|
889 |
+
2003/01/16/big/img_1022
|
890 |
+
2002/07/22/big/img_275
|
891 |
+
2002/08/24/big/img_86
|
892 |
+
2002/08/17/big/img_582
|
893 |
+
2003/01/15/big/img_765
|
894 |
+
2003/01/17/big/img_449
|
895 |
+
2002/07/28/big/img_265
|
896 |
+
2003/01/13/big/img_552
|
897 |
+
2002/07/28/big/img_115
|
898 |
+
2003/01/16/big/img_56
|
899 |
+
2002/08/02/big/img_1232
|
900 |
+
2003/01/17/big/img_925
|
901 |
+
2002/07/22/big/img_445
|
902 |
+
2002/07/25/big/img_957
|
903 |
+
2002/07/20/big/img_589
|
904 |
+
2002/08/31/big/img_17107
|
905 |
+
2002/07/29/big/img_483
|
906 |
+
2002/08/14/big/img_1063
|
907 |
+
2002/08/07/big/img_1545
|
908 |
+
2002/08/14/big/img_680
|
909 |
+
2002/09/01/big/img_16694
|
910 |
+
2002/08/14/big/img_257
|
911 |
+
2002/08/11/big/img_726
|
912 |
+
2002/07/26/big/img_681
|
913 |
+
2002/07/25/big/img_481
|
914 |
+
2003/01/14/big/img_737
|
915 |
+
2002/08/28/big/img_19480
|
916 |
+
2003/01/16/big/img_362
|
917 |
+
2002/08/27/big/img_19865
|
918 |
+
2003/01/01/big/img_547
|
919 |
+
2002/09/02/big/img_15074
|
920 |
+
2002/08/01/big/img_1453
|
921 |
+
2002/08/22/big/img_594
|
922 |
+
2002/08/28/big/img_19263
|
923 |
+
2002/08/13/big/img_478
|
924 |
+
2002/07/29/big/img_1358
|
925 |
+
2003/01/14/big/img_1022
|
926 |
+
2002/08/16/big/img_450
|
927 |
+
2002/08/02/big/img_159
|
928 |
+
2002/07/26/big/img_781
|
929 |
+
2003/01/13/big/img_601
|
930 |
+
2002/08/20/big/img_407
|
931 |
+
2002/08/15/big/img_468
|
932 |
+
2002/08/31/big/img_17902
|
933 |
+
2002/08/16/big/img_81
|
934 |
+
2002/07/25/big/img_987
|
935 |
+
2002/07/25/big/img_500
|
936 |
+
2002/08/02/big/img_31
|
937 |
+
2002/08/18/big/img_538
|
938 |
+
2002/08/08/big/img_54
|
939 |
+
2002/07/23/big/img_686
|
940 |
+
2002/07/24/big/img_836
|
941 |
+
2003/01/17/big/img_734
|
942 |
+
2002/08/16/big/img_1055
|
943 |
+
2003/01/16/big/img_521
|
944 |
+
2002/07/25/big/img_612
|
945 |
+
2002/08/22/big/img_778
|
946 |
+
2002/08/03/big/img_251
|
947 |
+
2002/08/12/big/img_436
|
948 |
+
2002/08/23/big/img_705
|
949 |
+
2002/07/28/big/img_243
|
950 |
+
2002/07/25/big/img_1029
|
951 |
+
2002/08/20/big/img_287
|
952 |
+
2002/08/29/big/img_18739
|
953 |
+
2002/08/05/big/img_3272
|
954 |
+
2002/07/27/big/img_214
|
955 |
+
2003/01/14/big/img_5
|
956 |
+
2002/08/01/big/img_1380
|
957 |
+
2002/08/29/big/img_19097
|
958 |
+
2002/07/30/big/img_486
|
959 |
+
2002/08/29/big/img_18707
|
960 |
+
2002/08/10/big/img_559
|
961 |
+
2002/08/15/big/img_365
|
962 |
+
2002/08/09/big/img_525
|
963 |
+
2002/08/10/big/img_689
|
964 |
+
2002/07/25/big/img_502
|
965 |
+
2002/08/03/big/img_667
|
966 |
+
2002/08/10/big/img_855
|
967 |
+
2002/08/10/big/img_706
|
968 |
+
2002/08/18/big/img_603
|
969 |
+
2003/01/16/big/img_1055
|
970 |
+
2002/08/31/big/img_17890
|
971 |
+
2002/08/15/big/img_761
|
972 |
+
2003/01/15/big/img_489
|
973 |
+
2002/08/26/big/img_351
|
974 |
+
2002/08/01/big/img_1772
|
975 |
+
2002/08/31/big/img_17729
|
976 |
+
2002/07/25/big/img_609
|
977 |
+
2003/01/13/big/img_539
|
978 |
+
2002/07/27/big/img_686
|
979 |
+
2002/07/31/big/img_311
|
980 |
+
2002/08/22/big/img_799
|
981 |
+
2003/01/16/big/img_936
|
982 |
+
2002/08/31/big/img_17813
|
983 |
+
2002/08/04/big/img_862
|
984 |
+
2002/08/09/big/img_332
|
985 |
+
2002/07/20/big/img_148
|
986 |
+
2002/08/12/big/img_426
|
987 |
+
2002/07/24/big/img_69
|
988 |
+
2002/07/27/big/img_685
|
989 |
+
2002/08/02/big/img_480
|
990 |
+
2002/08/26/big/img_154
|
991 |
+
2002/07/24/big/img_598
|
992 |
+
2002/08/01/big/img_1881
|
993 |
+
2002/08/20/big/img_667
|
994 |
+
2003/01/14/big/img_495
|
995 |
+
2002/07/21/big/img_744
|
996 |
+
2002/07/30/big/img_150
|
997 |
+
2002/07/23/big/img_924
|
998 |
+
2002/08/08/big/img_272
|
999 |
+
2002/07/23/big/img_310
|
1000 |
+
2002/07/25/big/img_1011
|
1001 |
+
2002/09/02/big/img_15725
|
1002 |
+
2002/07/19/big/img_814
|
1003 |
+
2002/08/20/big/img_936
|
1004 |
+
2002/07/25/big/img_85
|
1005 |
+
2002/08/24/big/img_662
|
1006 |
+
2002/08/09/big/img_495
|
1007 |
+
2003/01/15/big/img_196
|
1008 |
+
2002/08/16/big/img_707
|
1009 |
+
2002/08/28/big/img_19370
|
1010 |
+
2002/08/06/big/img_2366
|
1011 |
+
2002/08/06/big/img_3012
|
1012 |
+
2002/08/01/big/img_1452
|
1013 |
+
2002/07/31/big/img_742
|
1014 |
+
2002/07/27/big/img_914
|
1015 |
+
2003/01/13/big/img_290
|
1016 |
+
2002/07/31/big/img_288
|
1017 |
+
2002/08/02/big/img_171
|
1018 |
+
2002/08/22/big/img_191
|
1019 |
+
2002/07/27/big/img_1066
|
1020 |
+
2002/08/12/big/img_383
|
1021 |
+
2003/01/17/big/img_1018
|
1022 |
+
2002/08/01/big/img_1785
|
1023 |
+
2002/08/11/big/img_390
|
1024 |
+
2002/08/27/big/img_20037
|
1025 |
+
2002/08/12/big/img_38
|
1026 |
+
2003/01/15/big/img_103
|
1027 |
+
2002/08/26/big/img_31
|
1028 |
+
2002/08/18/big/img_660
|
1029 |
+
2002/07/22/big/img_694
|
1030 |
+
2002/08/15/big/img_24
|
1031 |
+
2002/07/27/big/img_1077
|
1032 |
+
2002/08/01/big/img_1943
|
1033 |
+
2002/07/22/big/img_292
|
1034 |
+
2002/09/01/big/img_16857
|
1035 |
+
2002/07/22/big/img_892
|
1036 |
+
2003/01/14/big/img_46
|
1037 |
+
2002/08/09/big/img_469
|
1038 |
+
2002/08/09/big/img_414
|
1039 |
+
2003/01/16/big/img_40
|
1040 |
+
2002/08/28/big/img_19231
|
1041 |
+
2002/07/27/big/img_978
|
1042 |
+
2002/07/23/big/img_475
|
1043 |
+
2002/07/25/big/img_92
|
1044 |
+
2002/08/09/big/img_799
|
1045 |
+
2002/07/25/big/img_491
|
1046 |
+
2002/08/03/big/img_654
|
1047 |
+
2003/01/15/big/img_687
|
1048 |
+
2002/08/11/big/img_478
|
1049 |
+
2002/08/07/big/img_1664
|
1050 |
+
2002/08/20/big/img_362
|
1051 |
+
2002/08/01/big/img_1298
|
1052 |
+
2003/01/13/big/img_500
|
1053 |
+
2002/08/06/big/img_2896
|
1054 |
+
2002/08/30/big/img_18529
|
1055 |
+
2002/08/16/big/img_1020
|
1056 |
+
2002/07/29/big/img_892
|
1057 |
+
2002/08/29/big/img_18726
|
1058 |
+
2002/07/21/big/img_453
|
1059 |
+
2002/08/17/big/img_437
|
1060 |
+
2002/07/19/big/img_665
|
1061 |
+
2002/07/22/big/img_440
|
1062 |
+
2002/07/19/big/img_582
|
1063 |
+
2002/07/21/big/img_233
|
1064 |
+
2003/01/01/big/img_82
|
1065 |
+
2002/07/25/big/img_341
|
1066 |
+
2002/07/29/big/img_864
|
1067 |
+
2002/08/02/big/img_276
|
1068 |
+
2002/08/29/big/img_18654
|
1069 |
+
2002/07/27/big/img_1024
|
1070 |
+
2002/08/19/big/img_373
|
1071 |
+
2003/01/15/big/img_241
|
1072 |
+
2002/07/25/big/img_84
|
1073 |
+
2002/08/13/big/img_834
|
1074 |
+
2002/08/10/big/img_511
|
1075 |
+
2002/08/01/big/img_1627
|
1076 |
+
2002/08/08/big/img_607
|
1077 |
+
2002/08/06/big/img_2083
|
1078 |
+
2002/08/01/big/img_1486
|
1079 |
+
2002/08/08/big/img_700
|
1080 |
+
2002/08/01/big/img_1954
|
1081 |
+
2002/08/21/big/img_54
|
1082 |
+
2002/07/30/big/img_847
|
1083 |
+
2002/08/28/big/img_19169
|
1084 |
+
2002/07/21/big/img_549
|
1085 |
+
2002/08/03/big/img_693
|
1086 |
+
2002/07/31/big/img_1002
|
1087 |
+
2003/01/14/big/img_1035
|
1088 |
+
2003/01/16/big/img_622
|
1089 |
+
2002/07/30/big/img_1201
|
1090 |
+
2002/08/10/big/img_444
|
1091 |
+
2002/07/31/big/img_374
|
1092 |
+
2002/08/21/big/img_301
|
1093 |
+
2002/08/13/big/img_1095
|
1094 |
+
2003/01/13/big/img_288
|
1095 |
+
2002/07/25/big/img_232
|
1096 |
+
2003/01/13/big/img_967
|
1097 |
+
2002/08/26/big/img_360
|
1098 |
+
2002/08/05/big/img_67
|
1099 |
+
2002/08/29/big/img_18969
|
1100 |
+
2002/07/28/big/img_16
|
1101 |
+
2002/08/16/big/img_515
|
1102 |
+
2002/07/20/big/img_708
|
1103 |
+
2002/08/18/big/img_178
|
1104 |
+
2003/01/15/big/img_509
|
1105 |
+
2002/07/25/big/img_430
|
1106 |
+
2002/08/21/big/img_738
|
1107 |
+
2002/08/16/big/img_886
|
1108 |
+
2002/09/02/big/img_15605
|
1109 |
+
2002/09/01/big/img_16242
|
1110 |
+
2002/08/24/big/img_711
|
1111 |
+
2002/07/25/big/img_90
|
1112 |
+
2002/08/09/big/img_491
|
1113 |
+
2002/07/30/big/img_534
|
1114 |
+
2003/01/13/big/img_474
|
1115 |
+
2002/08/25/big/img_510
|
1116 |
+
2002/08/15/big/img_555
|
1117 |
+
2002/08/02/big/img_775
|
1118 |
+
2002/07/23/big/img_975
|
1119 |
+
2002/08/19/big/img_229
|
1120 |
+
2003/01/17/big/img_860
|
1121 |
+
2003/01/02/big/img_10
|
1122 |
+
2002/07/23/big/img_542
|
1123 |
+
2002/08/06/big/img_2535
|
1124 |
+
2002/07/22/big/img_37
|
1125 |
+
2002/08/06/big/img_2342
|
1126 |
+
2002/08/25/big/img_515
|
1127 |
+
2002/08/25/big/img_336
|
1128 |
+
2002/08/18/big/img_837
|
1129 |
+
2002/08/21/big/img_616
|
1130 |
+
2003/01/17/big/img_24
|
1131 |
+
2002/07/26/big/img_936
|
1132 |
+
2002/08/14/big/img_896
|
1133 |
+
2002/07/29/big/img_465
|
1134 |
+
2002/07/31/big/img_543
|
1135 |
+
2002/08/01/big/img_1411
|
1136 |
+
2002/08/02/big/img_423
|
1137 |
+
2002/08/21/big/img_44
|
1138 |
+
2002/07/31/big/img_11
|
1139 |
+
2003/01/15/big/img_628
|
1140 |
+
2003/01/15/big/img_605
|
1141 |
+
2002/07/30/big/img_571
|
1142 |
+
2002/07/23/big/img_428
|
1143 |
+
2002/08/15/big/img_942
|
1144 |
+
2002/07/26/big/img_531
|
1145 |
+
2003/01/16/big/img_59
|
1146 |
+
2002/08/02/big/img_410
|
1147 |
+
2002/07/31/big/img_230
|
1148 |
+
2002/08/19/big/img_806
|
1149 |
+
2003/01/14/big/img_462
|
1150 |
+
2002/08/16/big/img_370
|
1151 |
+
2002/08/13/big/img_380
|
1152 |
+
2002/08/16/big/img_932
|
1153 |
+
2002/07/19/big/img_393
|
1154 |
+
2002/08/20/big/img_764
|
1155 |
+
2002/08/15/big/img_616
|
1156 |
+
2002/07/26/big/img_267
|
1157 |
+
2002/07/27/big/img_1069
|
1158 |
+
2002/08/14/big/img_1041
|
1159 |
+
2003/01/13/big/img_594
|
1160 |
+
2002/09/01/big/img_16845
|
1161 |
+
2002/08/09/big/img_229
|
1162 |
+
2003/01/16/big/img_639
|
1163 |
+
2002/08/19/big/img_398
|
1164 |
+
2002/08/18/big/img_978
|
1165 |
+
2002/08/24/big/img_296
|
1166 |
+
2002/07/29/big/img_415
|
1167 |
+
2002/07/30/big/img_923
|
1168 |
+
2002/08/18/big/img_575
|
1169 |
+
2002/08/22/big/img_182
|
1170 |
+
2002/07/25/big/img_806
|
1171 |
+
2002/07/22/big/img_49
|
1172 |
+
2002/07/29/big/img_989
|
1173 |
+
2003/01/17/big/img_789
|
1174 |
+
2003/01/15/big/img_503
|
1175 |
+
2002/09/01/big/img_16062
|
1176 |
+
2003/01/17/big/img_794
|
1177 |
+
2002/08/15/big/img_564
|
1178 |
+
2003/01/15/big/img_222
|
1179 |
+
2002/08/01/big/img_1656
|
1180 |
+
2003/01/13/big/img_432
|
1181 |
+
2002/07/19/big/img_426
|
1182 |
+
2002/08/17/big/img_244
|
1183 |
+
2002/08/13/big/img_805
|
1184 |
+
2002/09/02/big/img_15067
|
1185 |
+
2002/08/11/big/img_58
|
1186 |
+
2002/08/22/big/img_636
|
1187 |
+
2002/07/22/big/img_416
|
1188 |
+
2002/08/13/big/img_836
|
1189 |
+
2002/08/26/big/img_363
|
1190 |
+
2002/07/30/big/img_917
|
1191 |
+
2003/01/14/big/img_206
|
1192 |
+
2002/08/12/big/img_311
|
1193 |
+
2002/08/31/big/img_17623
|
1194 |
+
2002/07/29/big/img_661
|
1195 |
+
2003/01/13/big/img_417
|
1196 |
+
2002/08/02/big/img_463
|
1197 |
+
2002/08/02/big/img_669
|
1198 |
+
2002/08/26/big/img_670
|
1199 |
+
2002/08/02/big/img_375
|
1200 |
+
2002/07/19/big/img_209
|
1201 |
+
2002/08/08/big/img_115
|
1202 |
+
2002/08/21/big/img_399
|
1203 |
+
2002/08/20/big/img_911
|
1204 |
+
2002/08/07/big/img_1212
|
1205 |
+
2002/08/20/big/img_578
|
1206 |
+
2002/08/22/big/img_554
|
1207 |
+
2002/08/21/big/img_484
|
1208 |
+
2002/07/25/big/img_450
|
1209 |
+
2002/08/03/big/img_542
|
1210 |
+
2002/08/15/big/img_561
|
1211 |
+
2002/07/23/big/img_360
|
1212 |
+
2002/08/30/big/img_18137
|
1213 |
+
2002/07/25/big/img_250
|
1214 |
+
2002/08/03/big/img_647
|
1215 |
+
2002/08/20/big/img_375
|
1216 |
+
2002/08/14/big/img_387
|
1217 |
+
2002/09/01/big/img_16990
|
1218 |
+
2002/08/28/big/img_19341
|
1219 |
+
2003/01/15/big/img_239
|
1220 |
+
2002/08/20/big/img_528
|
1221 |
+
2002/08/12/big/img_130
|
1222 |
+
2002/09/02/big/img_15108
|
1223 |
+
2003/01/15/big/img_372
|
1224 |
+
2002/08/16/big/img_678
|
1225 |
+
2002/08/04/big/img_623
|
1226 |
+
2002/07/23/big/img_477
|
1227 |
+
2002/08/28/big/img_19590
|
1228 |
+
2003/01/17/big/img_978
|
1229 |
+
2002/09/01/big/img_16692
|
1230 |
+
2002/07/20/big/img_109
|
1231 |
+
2002/08/06/big/img_2660
|
1232 |
+
2003/01/14/big/img_464
|
1233 |
+
2002/08/09/big/img_618
|
1234 |
+
2002/07/22/big/img_722
|
1235 |
+
2002/08/25/big/img_419
|
1236 |
+
2002/08/03/big/img_314
|
1237 |
+
2002/08/25/big/img_40
|
1238 |
+
2002/07/27/big/img_430
|
1239 |
+
2002/08/10/big/img_569
|
1240 |
+
2002/08/23/big/img_398
|
1241 |
+
2002/07/23/big/img_893
|
1242 |
+
2002/08/16/big/img_261
|
1243 |
+
2002/08/06/big/img_2668
|
1244 |
+
2002/07/22/big/img_835
|
1245 |
+
2002/09/02/big/img_15093
|
1246 |
+
2003/01/16/big/img_65
|
1247 |
+
2002/08/21/big/img_448
|
1248 |
+
2003/01/14/big/img_351
|
1249 |
+
2003/01/17/big/img_133
|
1250 |
+
2002/07/28/big/img_493
|
1251 |
+
2003/01/15/big/img_640
|
1252 |
+
2002/09/01/big/img_16880
|
1253 |
+
2002/08/15/big/img_350
|
1254 |
+
2002/08/20/big/img_624
|
1255 |
+
2002/08/25/big/img_604
|
1256 |
+
2002/08/06/big/img_2200
|
1257 |
+
2002/08/23/big/img_290
|
1258 |
+
2002/08/13/big/img_1152
|
1259 |
+
2003/01/14/big/img_251
|
1260 |
+
2002/08/02/big/img_538
|
1261 |
+
2002/08/22/big/img_613
|
1262 |
+
2003/01/13/big/img_351
|
1263 |
+
2002/08/18/big/img_368
|
1264 |
+
2002/07/23/big/img_392
|
1265 |
+
2002/07/25/big/img_198
|
1266 |
+
2002/07/25/big/img_418
|
1267 |
+
2002/08/26/big/img_614
|
1268 |
+
2002/07/23/big/img_405
|
1269 |
+
2003/01/14/big/img_445
|
1270 |
+
2002/07/25/big/img_326
|
1271 |
+
2002/08/10/big/img_734
|
1272 |
+
2003/01/14/big/img_530
|
1273 |
+
2002/08/08/big/img_561
|
1274 |
+
2002/08/29/big/img_18990
|
1275 |
+
2002/08/10/big/img_576
|
1276 |
+
2002/07/29/big/img_1494
|
1277 |
+
2002/07/19/big/img_198
|
1278 |
+
2002/08/10/big/img_562
|
1279 |
+
2002/07/22/big/img_901
|
1280 |
+
2003/01/14/big/img_37
|
1281 |
+
2002/09/02/big/img_15629
|
1282 |
+
2003/01/14/big/img_58
|
1283 |
+
2002/08/01/big/img_1364
|
1284 |
+
2002/07/27/big/img_636
|
1285 |
+
2003/01/13/big/img_241
|
1286 |
+
2002/09/01/big/img_16988
|
1287 |
+
2003/01/13/big/img_560
|
1288 |
+
2002/08/09/big/img_533
|
1289 |
+
2002/07/31/big/img_249
|
1290 |
+
2003/01/17/big/img_1007
|
1291 |
+
2002/07/21/big/img_64
|
1292 |
+
2003/01/13/big/img_537
|
1293 |
+
2003/01/15/big/img_606
|
1294 |
+
2002/08/18/big/img_651
|
1295 |
+
2002/08/24/big/img_405
|
1296 |
+
2002/07/26/big/img_837
|
1297 |
+
2002/08/09/big/img_562
|
1298 |
+
2002/08/01/big/img_1983
|
1299 |
+
2002/08/03/big/img_514
|
1300 |
+
2002/07/29/big/img_314
|
1301 |
+
2002/08/12/big/img_493
|
1302 |
+
2003/01/14/big/img_121
|
1303 |
+
2003/01/14/big/img_479
|
1304 |
+
2002/08/04/big/img_410
|
1305 |
+
2002/07/22/big/img_607
|
1306 |
+
2003/01/17/big/img_417
|
1307 |
+
2002/07/20/big/img_547
|
1308 |
+
2002/08/13/big/img_396
|
1309 |
+
2002/08/31/big/img_17538
|
1310 |
+
2002/08/13/big/img_187
|
1311 |
+
2002/08/12/big/img_328
|
1312 |
+
2003/01/14/big/img_569
|
1313 |
+
2002/07/27/big/img_1081
|
1314 |
+
2002/08/14/big/img_504
|
1315 |
+
2002/08/23/big/img_785
|
1316 |
+
2002/07/26/big/img_339
|
1317 |
+
2002/08/07/big/img_1156
|
1318 |
+
2002/08/07/big/img_1456
|
1319 |
+
2002/08/23/big/img_378
|
1320 |
+
2002/08/27/big/img_19719
|
1321 |
+
2002/07/31/big/img_39
|
1322 |
+
2002/07/31/big/img_883
|
1323 |
+
2003/01/14/big/img_676
|
1324 |
+
2002/07/29/big/img_214
|
1325 |
+
2002/07/26/big/img_669
|
1326 |
+
2002/07/25/big/img_202
|
1327 |
+
2002/08/08/big/img_259
|
1328 |
+
2003/01/17/big/img_943
|
1329 |
+
2003/01/15/big/img_512
|
1330 |
+
2002/08/05/big/img_3295
|
1331 |
+
2002/08/27/big/img_19685
|
1332 |
+
2002/08/08/big/img_277
|
1333 |
+
2002/08/30/big/img_18154
|
1334 |
+
2002/07/22/big/img_663
|
1335 |
+
2002/08/29/big/img_18914
|
1336 |
+
2002/07/31/big/img_908
|
1337 |
+
2002/08/27/big/img_19926
|
1338 |
+
2003/01/13/big/img_791
|
1339 |
+
2003/01/15/big/img_827
|
1340 |
+
2002/08/18/big/img_878
|
1341 |
+
2002/08/14/big/img_670
|
1342 |
+
2002/07/20/big/img_182
|
1343 |
+
2002/08/15/big/img_291
|
1344 |
+
2002/08/06/big/img_2600
|
1345 |
+
2002/07/23/big/img_587
|
1346 |
+
2002/08/14/big/img_577
|
1347 |
+
2003/01/15/big/img_585
|
1348 |
+
2002/07/30/big/img_310
|
1349 |
+
2002/08/03/big/img_658
|
1350 |
+
2002/08/10/big/img_157
|
1351 |
+
2002/08/19/big/img_811
|
1352 |
+
2002/07/29/big/img_1318
|
1353 |
+
2002/08/04/big/img_104
|
1354 |
+
2002/07/30/big/img_332
|
1355 |
+
2002/07/24/big/img_789
|
1356 |
+
2002/07/29/big/img_516
|
1357 |
+
2002/07/23/big/img_843
|
1358 |
+
2002/08/01/big/img_1528
|
1359 |
+
2002/08/13/big/img_798
|
1360 |
+
2002/08/07/big/img_1729
|
1361 |
+
2002/08/28/big/img_19448
|
1362 |
+
2003/01/16/big/img_95
|
1363 |
+
2002/08/12/big/img_473
|
1364 |
+
2002/07/27/big/img_269
|
1365 |
+
2003/01/16/big/img_621
|
1366 |
+
2002/07/29/big/img_772
|
1367 |
+
2002/07/24/big/img_171
|
1368 |
+
2002/07/19/big/img_429
|
1369 |
+
2002/08/07/big/img_1933
|
1370 |
+
2002/08/27/big/img_19629
|
1371 |
+
2002/08/05/big/img_3688
|
1372 |
+
2002/08/07/big/img_1691
|
1373 |
+
2002/07/23/big/img_600
|
1374 |
+
2002/07/29/big/img_666
|
1375 |
+
2002/08/25/big/img_566
|
1376 |
+
2002/08/06/big/img_2659
|
1377 |
+
2002/08/29/big/img_18929
|
1378 |
+
2002/08/16/big/img_407
|
1379 |
+
2002/08/18/big/img_774
|
1380 |
+
2002/08/19/big/img_249
|
1381 |
+
2002/08/06/big/img_2427
|
1382 |
+
2002/08/29/big/img_18899
|
1383 |
+
2002/08/01/big/img_1818
|
1384 |
+
2002/07/31/big/img_108
|
1385 |
+
2002/07/29/big/img_500
|
1386 |
+
2002/08/11/big/img_115
|
1387 |
+
2002/07/19/big/img_521
|
1388 |
+
2002/08/02/big/img_1163
|
1389 |
+
2002/07/22/big/img_62
|
1390 |
+
2002/08/13/big/img_466
|
1391 |
+
2002/08/21/big/img_956
|
1392 |
+
2002/08/23/big/img_602
|
1393 |
+
2002/08/20/big/img_858
|
1394 |
+
2002/07/25/big/img_690
|
1395 |
+
2002/07/19/big/img_130
|
1396 |
+
2002/08/04/big/img_874
|
1397 |
+
2002/07/26/big/img_489
|
1398 |
+
2002/07/22/big/img_548
|
1399 |
+
2002/08/10/big/img_191
|
1400 |
+
2002/07/25/big/img_1051
|
1401 |
+
2002/08/18/big/img_473
|
1402 |
+
2002/08/12/big/img_755
|
1403 |
+
2002/08/18/big/img_413
|
1404 |
+
2002/08/08/big/img_1044
|
1405 |
+
2002/08/17/big/img_680
|
1406 |
+
2002/08/26/big/img_235
|
1407 |
+
2002/08/20/big/img_330
|
1408 |
+
2002/08/22/big/img_344
|
1409 |
+
2002/08/09/big/img_593
|
1410 |
+
2002/07/31/big/img_1006
|
1411 |
+
2002/08/14/big/img_337
|
1412 |
+
2002/08/16/big/img_728
|
1413 |
+
2002/07/24/big/img_834
|
1414 |
+
2002/08/04/big/img_552
|
1415 |
+
2002/09/02/big/img_15213
|
1416 |
+
2002/07/25/big/img_725
|
1417 |
+
2002/08/30/big/img_18290
|
1418 |
+
2003/01/01/big/img_475
|
1419 |
+
2002/07/27/big/img_1083
|
1420 |
+
2002/08/29/big/img_18955
|
1421 |
+
2002/08/31/big/img_17232
|
1422 |
+
2002/08/08/big/img_480
|
1423 |
+
2002/08/01/big/img_1311
|
1424 |
+
2002/07/30/big/img_745
|
1425 |
+
2002/08/03/big/img_649
|
1426 |
+
2002/08/12/big/img_193
|
1427 |
+
2002/07/29/big/img_228
|
1428 |
+
2002/07/25/big/img_836
|
1429 |
+
2002/08/20/big/img_400
|
1430 |
+
2002/07/30/big/img_507
|
1431 |
+
2002/09/02/big/img_15072
|
1432 |
+
2002/07/26/big/img_658
|
1433 |
+
2002/07/28/big/img_503
|
1434 |
+
2002/08/05/big/img_3814
|
1435 |
+
2002/08/24/big/img_745
|
1436 |
+
2003/01/13/big/img_817
|
1437 |
+
2002/08/08/big/img_579
|
1438 |
+
2002/07/22/big/img_251
|
1439 |
+
2003/01/13/big/img_689
|
1440 |
+
2002/07/25/big/img_407
|
1441 |
+
2002/08/13/big/img_1050
|
1442 |
+
2002/08/14/big/img_733
|
1443 |
+
2002/07/24/big/img_82
|
1444 |
+
2003/01/17/big/img_288
|
1445 |
+
2003/01/15/big/img_475
|
1446 |
+
2002/08/14/big/img_620
|
1447 |
+
2002/08/21/big/img_167
|
1448 |
+
2002/07/19/big/img_300
|
1449 |
+
2002/07/26/big/img_219
|
1450 |
+
2002/08/01/big/img_1468
|
1451 |
+
2002/07/23/big/img_260
|
1452 |
+
2002/08/09/big/img_555
|
1453 |
+
2002/07/19/big/img_160
|
1454 |
+
2002/08/02/big/img_1060
|
1455 |
+
2003/01/14/big/img_149
|
1456 |
+
2002/08/15/big/img_346
|
1457 |
+
2002/08/24/big/img_597
|
1458 |
+
2002/08/22/big/img_502
|
1459 |
+
2002/08/30/big/img_18228
|
1460 |
+
2002/07/21/big/img_766
|
1461 |
+
2003/01/15/big/img_841
|
1462 |
+
2002/07/24/big/img_516
|
1463 |
+
2002/08/02/big/img_265
|
1464 |
+
2002/08/15/big/img_1243
|
1465 |
+
2003/01/15/big/img_223
|
1466 |
+
2002/08/04/big/img_236
|
1467 |
+
2002/07/22/big/img_309
|
1468 |
+
2002/07/20/big/img_656
|
1469 |
+
2002/07/31/big/img_412
|
1470 |
+
2002/09/01/big/img_16462
|
1471 |
+
2003/01/16/big/img_431
|
1472 |
+
2002/07/22/big/img_793
|
1473 |
+
2002/08/15/big/img_877
|
1474 |
+
2002/07/26/big/img_282
|
1475 |
+
2002/07/25/big/img_529
|
1476 |
+
2002/08/24/big/img_613
|
1477 |
+
2003/01/17/big/img_700
|
1478 |
+
2002/08/06/big/img_2526
|
1479 |
+
2002/08/24/big/img_394
|
1480 |
+
2002/08/21/big/img_521
|
1481 |
+
2002/08/25/big/img_560
|
1482 |
+
2002/07/29/big/img_966
|
1483 |
+
2002/07/25/big/img_448
|
1484 |
+
2003/01/13/big/img_782
|
1485 |
+
2002/08/21/big/img_296
|
1486 |
+
2002/09/01/big/img_16755
|
1487 |
+
2002/08/05/big/img_3552
|
1488 |
+
2002/09/02/big/img_15823
|
1489 |
+
2003/01/14/big/img_193
|
1490 |
+
2002/07/21/big/img_159
|
1491 |
+
2002/08/02/big/img_564
|
1492 |
+
2002/08/16/big/img_300
|
1493 |
+
2002/07/19/big/img_269
|
1494 |
+
2002/08/13/big/img_676
|
1495 |
+
2002/07/28/big/img_57
|
1496 |
+
2002/08/05/big/img_3318
|
1497 |
+
2002/07/31/big/img_218
|
1498 |
+
2002/08/21/big/img_898
|
1499 |
+
2002/07/29/big/img_109
|
1500 |
+
2002/07/19/big/img_854
|
1501 |
+
2002/08/23/big/img_311
|
1502 |
+
2002/08/14/big/img_318
|
1503 |
+
2002/07/25/big/img_523
|
1504 |
+
2002/07/21/big/img_678
|
1505 |
+
2003/01/17/big/img_690
|
1506 |
+
2002/08/28/big/img_19503
|
1507 |
+
2002/08/18/big/img_251
|
1508 |
+
2002/08/22/big/img_672
|
1509 |
+
2002/08/20/big/img_663
|
1510 |
+
2002/08/02/big/img_148
|
1511 |
+
2002/09/02/big/img_15580
|
1512 |
+
2002/07/25/big/img_778
|
1513 |
+
2002/08/14/big/img_565
|
1514 |
+
2002/08/12/big/img_374
|
1515 |
+
2002/08/13/big/img_1018
|
1516 |
+
2002/08/20/big/img_474
|
1517 |
+
2002/08/25/big/img_33
|
1518 |
+
2002/08/02/big/img_1190
|
1519 |
+
2002/08/08/big/img_864
|
1520 |
+
2002/08/14/big/img_1071
|
1521 |
+
2002/08/30/big/img_18103
|
1522 |
+
2002/08/18/big/img_533
|
1523 |
+
2003/01/16/big/img_650
|
1524 |
+
2002/07/25/big/img_108
|
1525 |
+
2002/07/26/big/img_81
|
1526 |
+
2002/07/27/big/img_543
|
1527 |
+
2002/07/29/big/img_521
|
1528 |
+
2003/01/13/big/img_434
|
1529 |
+
2002/08/26/big/img_674
|
1530 |
+
2002/08/06/big/img_2932
|
1531 |
+
2002/08/07/big/img_1262
|
1532 |
+
2003/01/15/big/img_201
|
1533 |
+
2003/01/16/big/img_673
|
1534 |
+
2002/09/02/big/img_15988
|
1535 |
+
2002/07/29/big/img_1306
|
1536 |
+
2003/01/14/big/img_1072
|
1537 |
+
2002/08/30/big/img_18232
|
1538 |
+
2002/08/05/big/img_3711
|
1539 |
+
2002/07/23/big/img_775
|
1540 |
+
2002/08/01/big/img_16
|
1541 |
+
2003/01/16/big/img_630
|
1542 |
+
2002/08/22/big/img_695
|
1543 |
+
2002/08/14/big/img_51
|
1544 |
+
2002/08/14/big/img_782
|
1545 |
+
2002/08/24/big/img_742
|
1546 |
+
2003/01/14/big/img_512
|
1547 |
+
2003/01/15/big/img_1183
|
1548 |
+
2003/01/15/big/img_714
|
1549 |
+
2002/08/01/big/img_2078
|
1550 |
+
2002/07/31/big/img_682
|
1551 |
+
2002/09/02/big/img_15687
|
1552 |
+
2002/07/26/big/img_518
|
1553 |
+
2002/08/27/big/img_19676
|
1554 |
+
2002/09/02/big/img_15969
|
1555 |
+
2002/08/02/big/img_931
|
1556 |
+
2002/08/25/big/img_508
|
1557 |
+
2002/08/29/big/img_18616
|
1558 |
+
2002/07/22/big/img_839
|
1559 |
+
2002/07/28/big/img_313
|
1560 |
+
2003/01/14/big/img_155
|
1561 |
+
2002/08/02/big/img_1105
|
1562 |
+
2002/08/09/big/img_53
|
1563 |
+
2002/08/16/big/img_469
|
1564 |
+
2002/08/15/big/img_502
|
1565 |
+
2002/08/20/big/img_575
|
1566 |
+
2002/07/25/big/img_138
|
1567 |
+
2003/01/16/big/img_579
|
1568 |
+
2002/07/19/big/img_352
|
1569 |
+
2003/01/14/big/img_762
|
1570 |
+
2003/01/01/big/img_588
|
1571 |
+
2002/08/02/big/img_981
|
1572 |
+
2002/08/21/big/img_447
|
1573 |
+
2002/09/01/big/img_16151
|
1574 |
+
2003/01/14/big/img_769
|
1575 |
+
2002/08/23/big/img_461
|
1576 |
+
2002/08/17/big/img_240
|
1577 |
+
2002/09/02/big/img_15220
|
1578 |
+
2002/07/19/big/img_408
|
1579 |
+
2002/09/02/big/img_15496
|
1580 |
+
2002/07/29/big/img_758
|
1581 |
+
2002/08/28/big/img_19392
|
1582 |
+
2002/08/06/big/img_2723
|
1583 |
+
2002/08/31/big/img_17752
|
1584 |
+
2002/08/23/big/img_469
|
1585 |
+
2002/08/13/big/img_515
|
1586 |
+
2002/09/02/big/img_15551
|
1587 |
+
2002/08/03/big/img_462
|
1588 |
+
2002/07/24/big/img_613
|
1589 |
+
2002/07/22/big/img_61
|
1590 |
+
2002/08/08/big/img_171
|
1591 |
+
2002/08/21/big/img_177
|
1592 |
+
2003/01/14/big/img_105
|
1593 |
+
2002/08/02/big/img_1017
|
1594 |
+
2002/08/22/big/img_106
|
1595 |
+
2002/07/27/big/img_542
|
1596 |
+
2002/07/21/big/img_665
|
1597 |
+
2002/07/23/big/img_595
|
1598 |
+
2002/08/04/big/img_657
|
1599 |
+
2002/08/29/big/img_19002
|
1600 |
+
2003/01/15/big/img_550
|
1601 |
+
2002/08/14/big/img_662
|
1602 |
+
2002/07/20/big/img_425
|
1603 |
+
2002/08/30/big/img_18528
|
1604 |
+
2002/07/26/big/img_611
|
1605 |
+
2002/07/22/big/img_849
|
1606 |
+
2002/08/07/big/img_1655
|
1607 |
+
2002/08/21/big/img_638
|
1608 |
+
2003/01/17/big/img_732
|
1609 |
+
2003/01/01/big/img_496
|
1610 |
+
2002/08/18/big/img_713
|
1611 |
+
2002/08/08/big/img_109
|
1612 |
+
2002/07/27/big/img_1008
|
1613 |
+
2002/07/20/big/img_559
|
1614 |
+
2002/08/16/big/img_699
|
1615 |
+
2002/08/31/big/img_17702
|
1616 |
+
2002/07/31/big/img_1013
|
1617 |
+
2002/08/01/big/img_2027
|
1618 |
+
2002/08/02/big/img_1001
|
1619 |
+
2002/08/03/big/img_210
|
1620 |
+
2002/08/01/big/img_2087
|
1621 |
+
2003/01/14/big/img_199
|
1622 |
+
2002/07/29/big/img_48
|
1623 |
+
2002/07/19/big/img_727
|
1624 |
+
2002/08/09/big/img_249
|
1625 |
+
2002/08/04/big/img_632
|
1626 |
+
2002/08/22/big/img_620
|
1627 |
+
2003/01/01/big/img_457
|
1628 |
+
2002/08/05/big/img_3223
|
1629 |
+
2002/07/27/big/img_240
|
1630 |
+
2002/07/25/big/img_797
|
1631 |
+
2002/08/13/big/img_430
|
1632 |
+
2002/07/25/big/img_615
|
1633 |
+
2002/08/12/big/img_28
|
1634 |
+
2002/07/30/big/img_220
|
1635 |
+
2002/07/24/big/img_89
|
1636 |
+
2002/08/21/big/img_357
|
1637 |
+
2002/08/09/big/img_590
|
1638 |
+
2003/01/13/big/img_525
|
1639 |
+
2002/08/17/big/img_818
|
1640 |
+
2003/01/02/big/img_7
|
1641 |
+
2002/07/26/big/img_636
|
1642 |
+
2003/01/13/big/img_1122
|
1643 |
+
2002/07/23/big/img_810
|
1644 |
+
2002/08/20/big/img_888
|
1645 |
+
2002/07/27/big/img_3
|
1646 |
+
2002/08/15/big/img_451
|
1647 |
+
2002/09/02/big/img_15787
|
1648 |
+
2002/07/31/big/img_281
|
1649 |
+
2002/08/05/big/img_3274
|
1650 |
+
2002/08/07/big/img_1254
|
1651 |
+
2002/07/31/big/img_27
|
1652 |
+
2002/08/01/big/img_1366
|
1653 |
+
2002/07/30/big/img_182
|
1654 |
+
2002/08/27/big/img_19690
|
1655 |
+
2002/07/29/big/img_68
|
1656 |
+
2002/08/23/big/img_754
|
1657 |
+
2002/07/30/big/img_540
|
1658 |
+
2002/08/27/big/img_20063
|
1659 |
+
2002/08/14/big/img_471
|
1660 |
+
2002/08/02/big/img_615
|
1661 |
+
2002/07/30/big/img_186
|
1662 |
+
2002/08/25/big/img_150
|
1663 |
+
2002/07/27/big/img_626
|
1664 |
+
2002/07/20/big/img_225
|
1665 |
+
2003/01/15/big/img_1252
|
1666 |
+
2002/07/19/big/img_367
|
1667 |
+
2003/01/15/big/img_582
|
1668 |
+
2002/08/09/big/img_572
|
1669 |
+
2002/08/08/big/img_428
|
1670 |
+
2003/01/15/big/img_639
|
1671 |
+
2002/08/28/big/img_19245
|
1672 |
+
2002/07/24/big/img_321
|
1673 |
+
2002/08/02/big/img_662
|
1674 |
+
2002/08/08/big/img_1033
|
1675 |
+
2003/01/17/big/img_867
|
1676 |
+
2002/07/22/big/img_652
|
1677 |
+
2003/01/14/big/img_224
|
1678 |
+
2002/08/18/big/img_49
|
1679 |
+
2002/07/26/big/img_46
|
1680 |
+
2002/08/31/big/img_18021
|
1681 |
+
2002/07/25/big/img_151
|
1682 |
+
2002/08/23/big/img_540
|
1683 |
+
2002/08/25/big/img_693
|
1684 |
+
2002/07/23/big/img_340
|
1685 |
+
2002/07/28/big/img_117
|
1686 |
+
2002/09/02/big/img_15768
|
1687 |
+
2002/08/26/big/img_562
|
1688 |
+
2002/07/24/big/img_480
|
1689 |
+
2003/01/15/big/img_341
|
1690 |
+
2002/08/10/big/img_783
|
1691 |
+
2002/08/20/big/img_132
|
1692 |
+
2003/01/14/big/img_370
|
1693 |
+
2002/07/20/big/img_720
|
1694 |
+
2002/08/03/big/img_144
|
1695 |
+
2002/08/20/big/img_538
|
1696 |
+
2002/08/01/big/img_1745
|
1697 |
+
2002/08/11/big/img_683
|
1698 |
+
2002/08/03/big/img_328
|
1699 |
+
2002/08/10/big/img_793
|
1700 |
+
2002/08/14/big/img_689
|
1701 |
+
2002/08/02/big/img_162
|
1702 |
+
2003/01/17/big/img_411
|
1703 |
+
2002/07/31/big/img_361
|
1704 |
+
2002/08/15/big/img_289
|
1705 |
+
2002/08/08/big/img_254
|
1706 |
+
2002/08/15/big/img_996
|
1707 |
+
2002/08/20/big/img_785
|
1708 |
+
2002/07/24/big/img_511
|
1709 |
+
2002/08/06/big/img_2614
|
1710 |
+
2002/08/29/big/img_18733
|
1711 |
+
2002/08/17/big/img_78
|
1712 |
+
2002/07/30/big/img_378
|
1713 |
+
2002/08/31/big/img_17947
|
1714 |
+
2002/08/26/big/img_88
|
1715 |
+
2002/07/30/big/img_558
|
1716 |
+
2002/08/02/big/img_67
|
1717 |
+
2003/01/14/big/img_325
|
1718 |
+
2002/07/29/big/img_1357
|
1719 |
+
2002/07/19/big/img_391
|
1720 |
+
2002/07/30/big/img_307
|
1721 |
+
2003/01/13/big/img_219
|
1722 |
+
2002/07/24/big/img_807
|
1723 |
+
2002/08/23/big/img_543
|
1724 |
+
2002/08/29/big/img_18620
|
1725 |
+
2002/07/22/big/img_769
|
1726 |
+
2002/08/26/big/img_503
|
1727 |
+
2002/07/30/big/img_78
|
1728 |
+
2002/08/14/big/img_1036
|
1729 |
+
2002/08/09/big/img_58
|
1730 |
+
2002/07/24/big/img_616
|
1731 |
+
2002/08/02/big/img_464
|
1732 |
+
2002/07/26/big/img_576
|
1733 |
+
2002/07/22/big/img_273
|
1734 |
+
2003/01/16/big/img_470
|
1735 |
+
2002/07/29/big/img_329
|
1736 |
+
2002/07/30/big/img_1086
|
1737 |
+
2002/07/31/big/img_353
|
1738 |
+
2002/09/02/big/img_15275
|
1739 |
+
2003/01/17/big/img_555
|
1740 |
+
2002/08/26/big/img_212
|
1741 |
+
2002/08/01/big/img_1692
|
1742 |
+
2003/01/15/big/img_600
|
1743 |
+
2002/07/29/big/img_825
|
1744 |
+
2002/08/08/big/img_68
|
1745 |
+
2002/08/10/big/img_719
|
1746 |
+
2002/07/31/big/img_636
|
1747 |
+
2002/07/29/big/img_325
|
1748 |
+
2002/07/21/big/img_515
|
1749 |
+
2002/07/22/big/img_705
|
1750 |
+
2003/01/13/big/img_818
|
1751 |
+
2002/08/09/big/img_486
|
1752 |
+
2002/08/22/big/img_141
|
1753 |
+
2002/07/22/big/img_303
|
1754 |
+
2002/08/09/big/img_393
|
1755 |
+
2002/07/29/big/img_963
|
1756 |
+
2002/08/02/big/img_1215
|
1757 |
+
2002/08/19/big/img_674
|
1758 |
+
2002/08/12/big/img_690
|
1759 |
+
2002/08/21/big/img_637
|
1760 |
+
2002/08/21/big/img_841
|
1761 |
+
2002/08/24/big/img_71
|
1762 |
+
2002/07/25/big/img_596
|
1763 |
+
2002/07/24/big/img_864
|
1764 |
+
2002/08/18/big/img_293
|
1765 |
+
2003/01/14/big/img_657
|
1766 |
+
2002/08/15/big/img_411
|
1767 |
+
2002/08/16/big/img_348
|
1768 |
+
2002/08/05/big/img_3157
|
1769 |
+
2002/07/20/big/img_663
|
1770 |
+
2003/01/13/big/img_654
|
1771 |
+
2003/01/16/big/img_433
|
1772 |
+
2002/08/30/big/img_18200
|
1773 |
+
2002/08/12/big/img_226
|
1774 |
+
2003/01/16/big/img_491
|
1775 |
+
2002/08/08/big/img_666
|
1776 |
+
2002/07/19/big/img_576
|
1777 |
+
2003/01/15/big/img_776
|
1778 |
+
2003/01/16/big/img_899
|
1779 |
+
2002/07/19/big/img_397
|
1780 |
+
2002/08/14/big/img_44
|
1781 |
+
2003/01/15/big/img_762
|
1782 |
+
2002/08/02/big/img_982
|
1783 |
+
2002/09/02/big/img_15234
|
1784 |
+
2002/08/17/big/img_556
|
1785 |
+
2002/08/21/big/img_410
|
1786 |
+
2002/08/21/big/img_386
|
1787 |
+
2002/07/19/big/img_690
|
1788 |
+
2002/08/05/big/img_3052
|
1789 |
+
2002/08/14/big/img_219
|
1790 |
+
2002/08/16/big/img_273
|
1791 |
+
2003/01/15/big/img_752
|
1792 |
+
2002/08/08/big/img_184
|
1793 |
+
2002/07/31/big/img_743
|
1794 |
+
2002/08/23/big/img_338
|
1795 |
+
2003/01/14/big/img_1055
|
1796 |
+
2002/08/05/big/img_3405
|
1797 |
+
2003/01/15/big/img_17
|
1798 |
+
2002/08/03/big/img_141
|
1799 |
+
2002/08/14/big/img_549
|
1800 |
+
2002/07/27/big/img_1034
|
1801 |
+
2002/07/31/big/img_932
|
1802 |
+
2002/08/30/big/img_18487
|
1803 |
+
2002/09/02/big/img_15814
|
1804 |
+
2002/08/01/big/img_2086
|
1805 |
+
2002/09/01/big/img_16535
|
1806 |
+
2002/07/22/big/img_500
|
1807 |
+
2003/01/13/big/img_400
|
1808 |
+
2002/08/25/big/img_607
|
1809 |
+
2002/08/30/big/img_18384
|
1810 |
+
2003/01/14/big/img_951
|
1811 |
+
2002/08/13/big/img_1150
|
1812 |
+
2002/08/08/big/img_1022
|
1813 |
+
2002/08/10/big/img_428
|
1814 |
+
2002/08/28/big/img_19242
|
1815 |
+
2002/08/05/big/img_3098
|
1816 |
+
2002/07/23/big/img_400
|
1817 |
+
2002/08/26/big/img_365
|
1818 |
+
2002/07/20/big/img_318
|
1819 |
+
2002/08/13/big/img_740
|
1820 |
+
2003/01/16/big/img_37
|
1821 |
+
2002/08/26/big/img_274
|
1822 |
+
2002/08/02/big/img_205
|
1823 |
+
2002/08/21/big/img_695
|
1824 |
+
2002/08/06/big/img_2289
|
1825 |
+
2002/08/20/big/img_794
|
1826 |
+
2002/08/18/big/img_438
|
1827 |
+
2002/08/07/big/img_1380
|
1828 |
+
2002/08/02/big/img_737
|
1829 |
+
2002/08/07/big/img_1651
|
1830 |
+
2002/08/15/big/img_1238
|
1831 |
+
2002/08/01/big/img_1681
|
1832 |
+
2002/08/06/big/img_3017
|
1833 |
+
2002/07/23/big/img_706
|
1834 |
+
2002/07/31/big/img_392
|
1835 |
+
2002/08/09/big/img_539
|
1836 |
+
2002/07/29/big/img_835
|
1837 |
+
2002/08/26/big/img_723
|
1838 |
+
2002/08/28/big/img_19235
|
1839 |
+
2003/01/16/big/img_353
|
1840 |
+
2002/08/10/big/img_150
|
1841 |
+
2002/08/29/big/img_19025
|
1842 |
+
2002/08/21/big/img_310
|
1843 |
+
2002/08/10/big/img_823
|
1844 |
+
2002/07/26/big/img_981
|
1845 |
+
2002/08/11/big/img_288
|
1846 |
+
2002/08/19/big/img_534
|
1847 |
+
2002/08/21/big/img_300
|
1848 |
+
2002/07/31/big/img_49
|
1849 |
+
2002/07/30/big/img_469
|
1850 |
+
2002/08/28/big/img_19197
|
1851 |
+
2002/08/25/big/img_205
|
1852 |
+
2002/08/10/big/img_390
|
1853 |
+
2002/08/23/big/img_291
|
1854 |
+
2002/08/26/big/img_230
|
1855 |
+
2002/08/18/big/img_76
|
1856 |
+
2002/07/23/big/img_409
|
1857 |
+
2002/08/14/big/img_1053
|
1858 |
+
2003/01/14/big/img_291
|
1859 |
+
2002/08/10/big/img_503
|
1860 |
+
2002/08/27/big/img_19928
|
1861 |
+
2002/08/03/big/img_563
|
1862 |
+
2002/08/17/big/img_250
|
1863 |
+
2002/08/06/big/img_2381
|
1864 |
+
2002/08/17/big/img_948
|
1865 |
+
2002/08/06/big/img_2710
|
1866 |
+
2002/07/22/big/img_696
|
1867 |
+
2002/07/31/big/img_670
|
1868 |
+
2002/08/12/big/img_594
|
1869 |
+
2002/07/29/big/img_624
|
1870 |
+
2003/01/17/big/img_934
|
1871 |
+
2002/08/03/big/img_584
|
1872 |
+
2002/08/22/big/img_1003
|
1873 |
+
2002/08/05/big/img_3396
|
1874 |
+
2003/01/13/big/img_570
|
1875 |
+
2002/08/02/big/img_219
|
1876 |
+
2002/09/02/big/img_15774
|
1877 |
+
2002/08/16/big/img_818
|
1878 |
+
2002/08/23/big/img_402
|
1879 |
+
2003/01/14/big/img_552
|
1880 |
+
2002/07/29/big/img_71
|
1881 |
+
2002/08/05/big/img_3592
|
1882 |
+
2002/08/16/big/img_80
|
1883 |
+
2002/07/27/big/img_672
|
1884 |
+
2003/01/13/big/img_470
|
1885 |
+
2003/01/16/big/img_702
|
1886 |
+
2002/09/01/big/img_16130
|
1887 |
+
2002/08/08/big/img_240
|
1888 |
+
2002/09/01/big/img_16338
|
1889 |
+
2002/07/26/big/img_312
|
1890 |
+
2003/01/14/big/img_538
|
1891 |
+
2002/07/20/big/img_695
|
1892 |
+
2002/08/30/big/img_18098
|
1893 |
+
2002/08/25/big/img_259
|
1894 |
+
2002/08/16/big/img_1042
|
1895 |
+
2002/08/09/big/img_837
|
1896 |
+
2002/08/31/big/img_17760
|
1897 |
+
2002/07/31/big/img_14
|
1898 |
+
2002/08/09/big/img_361
|
1899 |
+
2003/01/16/big/img_107
|
1900 |
+
2002/08/14/big/img_124
|
1901 |
+
2002/07/19/big/img_463
|
1902 |
+
2003/01/15/big/img_275
|
1903 |
+
2002/07/25/big/img_1151
|
1904 |
+
2002/07/29/big/img_1501
|
1905 |
+
2002/08/27/big/img_19889
|
1906 |
+
2002/08/29/big/img_18603
|
1907 |
+
2003/01/17/big/img_601
|
1908 |
+
2002/08/25/big/img_355
|
1909 |
+
2002/08/08/big/img_297
|
1910 |
+
2002/08/20/big/img_290
|
1911 |
+
2002/07/31/big/img_195
|
1912 |
+
2003/01/01/big/img_336
|
1913 |
+
2002/08/18/big/img_369
|
1914 |
+
2002/07/25/big/img_621
|
1915 |
+
2002/08/11/big/img_508
|
1916 |
+
2003/01/14/big/img_458
|
1917 |
+
2003/01/15/big/img_795
|
1918 |
+
2002/08/12/big/img_498
|
1919 |
+
2002/08/01/big/img_1734
|
1920 |
+
2002/08/02/big/img_246
|
1921 |
+
2002/08/16/big/img_565
|
1922 |
+
2002/08/11/big/img_475
|
1923 |
+
2002/08/22/big/img_408
|
1924 |
+
2002/07/28/big/img_78
|
1925 |
+
2002/07/21/big/img_81
|
1926 |
+
2003/01/14/big/img_697
|
1927 |
+
2002/08/14/big/img_661
|
1928 |
+
2002/08/15/big/img_507
|
1929 |
+
2002/08/19/big/img_55
|
1930 |
+
2002/07/22/big/img_152
|
1931 |
+
2003/01/14/big/img_470
|
1932 |
+
2002/08/03/big/img_379
|
1933 |
+
2002/08/22/big/img_506
|
1934 |
+
2003/01/16/big/img_966
|
1935 |
+
2002/08/18/big/img_698
|
1936 |
+
2002/08/24/big/img_528
|
1937 |
+
2002/08/23/big/img_10
|
1938 |
+
2002/08/01/big/img_1655
|
1939 |
+
2002/08/22/big/img_953
|
1940 |
+
2002/07/19/big/img_630
|
1941 |
+
2002/07/22/big/img_889
|
1942 |
+
2002/08/16/big/img_351
|
1943 |
+
2003/01/16/big/img_83
|
1944 |
+
2002/07/19/big/img_805
|
1945 |
+
2002/08/14/big/img_704
|
1946 |
+
2002/07/19/big/img_389
|
1947 |
+
2002/08/31/big/img_17765
|
1948 |
+
2002/07/29/big/img_606
|
1949 |
+
2003/01/17/big/img_939
|
1950 |
+
2002/09/02/big/img_15081
|
1951 |
+
2002/08/21/big/img_181
|
1952 |
+
2002/07/29/big/img_1321
|
1953 |
+
2002/07/21/big/img_497
|
1954 |
+
2002/07/20/big/img_539
|
1955 |
+
2002/08/24/big/img_119
|
1956 |
+
2002/08/01/big/img_1281
|
1957 |
+
2002/07/26/big/img_207
|
1958 |
+
2002/07/26/big/img_432
|
1959 |
+
2002/07/27/big/img_1006
|
1960 |
+
2002/08/05/big/img_3087
|
1961 |
+
2002/08/14/big/img_252
|
1962 |
+
2002/08/14/big/img_798
|
1963 |
+
2002/07/24/big/img_538
|
1964 |
+
2002/09/02/big/img_15507
|
1965 |
+
2002/08/08/big/img_901
|
1966 |
+
2003/01/14/big/img_557
|
1967 |
+
2002/08/07/big/img_1819
|
1968 |
+
2002/08/04/big/img_470
|
1969 |
+
2002/08/01/big/img_1504
|
1970 |
+
2002/08/16/big/img_1070
|
1971 |
+
2002/08/16/big/img_372
|
1972 |
+
2002/08/23/big/img_416
|
1973 |
+
2002/08/30/big/img_18208
|
1974 |
+
2002/08/01/big/img_2043
|
1975 |
+
2002/07/22/big/img_385
|
1976 |
+
2002/08/22/big/img_466
|
1977 |
+
2002/08/21/big/img_869
|
1978 |
+
2002/08/28/big/img_19429
|
1979 |
+
2002/08/02/big/img_770
|
1980 |
+
2002/07/23/big/img_433
|
1981 |
+
2003/01/14/big/img_13
|
1982 |
+
2002/07/27/big/img_953
|
1983 |
+
2002/09/02/big/img_15728
|
1984 |
+
2002/08/01/big/img_1361
|
1985 |
+
2002/08/29/big/img_18897
|
1986 |
+
2002/08/26/big/img_534
|
1987 |
+
2002/08/11/big/img_121
|
1988 |
+
2002/08/26/big/img_20130
|
1989 |
+
2002/07/31/big/img_363
|
1990 |
+
2002/08/13/big/img_978
|
1991 |
+
2002/07/25/big/img_835
|
1992 |
+
2002/08/02/big/img_906
|
1993 |
+
2003/01/14/big/img_548
|
1994 |
+
2002/07/30/big/img_80
|
1995 |
+
2002/07/26/big/img_982
|
1996 |
+
2003/01/16/big/img_99
|
1997 |
+
2002/08/19/big/img_362
|
1998 |
+
2002/08/24/big/img_376
|
1999 |
+
2002/08/07/big/img_1264
|
2000 |
+
2002/07/27/big/img_938
|
2001 |
+
2003/01/17/big/img_535
|
2002 |
+
2002/07/26/big/img_457
|
2003 |
+
2002/08/08/big/img_848
|
2004 |
+
2003/01/15/big/img_859
|
2005 |
+
2003/01/15/big/img_622
|
2006 |
+
2002/07/30/big/img_403
|
2007 |
+
2002/07/29/big/img_217
|
2008 |
+
2002/07/26/big/img_891
|
2009 |
+
2002/07/24/big/img_70
|
2010 |
+
2002/08/25/big/img_619
|
2011 |
+
2002/08/05/big/img_3375
|
2012 |
+
2002/08/01/big/img_2160
|
2013 |
+
2002/08/06/big/img_2227
|
2014 |
+
2003/01/14/big/img_117
|
2015 |
+
2002/08/14/big/img_227
|
2016 |
+
2002/08/13/big/img_565
|
2017 |
+
2002/08/19/big/img_625
|
2018 |
+
2002/08/03/big/img_812
|
2019 |
+
2002/07/24/big/img_41
|
2020 |
+
2002/08/16/big/img_235
|
2021 |
+
2002/07/29/big/img_759
|
2022 |
+
2002/07/21/big/img_433
|
2023 |
+
2002/07/29/big/img_190
|
2024 |
+
2003/01/16/big/img_435
|
2025 |
+
2003/01/13/big/img_708
|
2026 |
+
2002/07/30/big/img_57
|
2027 |
+
2002/08/22/big/img_162
|
2028 |
+
2003/01/01/big/img_558
|
2029 |
+
2003/01/15/big/img_604
|
2030 |
+
2002/08/16/big/img_935
|
2031 |
+
2002/08/20/big/img_394
|
2032 |
+
2002/07/28/big/img_465
|
2033 |
+
2002/09/02/big/img_15534
|
2034 |
+
2002/08/16/big/img_87
|
2035 |
+
2002/07/22/big/img_469
|
2036 |
+
2002/08/12/big/img_245
|
2037 |
+
2003/01/13/big/img_236
|
2038 |
+
2002/08/06/big/img_2736
|
2039 |
+
2002/08/03/big/img_348
|
2040 |
+
2003/01/14/big/img_218
|
2041 |
+
2002/07/26/big/img_232
|
2042 |
+
2003/01/15/big/img_244
|
2043 |
+
2002/07/25/big/img_1121
|
2044 |
+
2002/08/01/big/img_1484
|
2045 |
+
2002/07/26/big/img_541
|
2046 |
+
2002/08/07/big/img_1244
|
2047 |
+
2002/07/31/big/img_3
|
2048 |
+
2002/08/30/big/img_18437
|
2049 |
+
2002/08/29/big/img_19094
|
2050 |
+
2002/08/01/big/img_1355
|
2051 |
+
2002/08/19/big/img_338
|
2052 |
+
2002/07/19/big/img_255
|
2053 |
+
2002/07/21/big/img_76
|
2054 |
+
2002/08/25/big/img_199
|
2055 |
+
2002/08/12/big/img_740
|
2056 |
+
2002/07/30/big/img_852
|
2057 |
+
2002/08/15/big/img_599
|
2058 |
+
2002/08/23/big/img_254
|
2059 |
+
2002/08/19/big/img_125
|
2060 |
+
2002/07/24/big/img_2
|
2061 |
+
2002/08/04/big/img_145
|
2062 |
+
2002/08/05/big/img_3137
|
2063 |
+
2002/07/28/big/img_463
|
2064 |
+
2003/01/14/big/img_801
|
2065 |
+
2002/07/23/big/img_366
|
2066 |
+
2002/08/26/big/img_600
|
2067 |
+
2002/08/26/big/img_649
|
2068 |
+
2002/09/02/big/img_15849
|
2069 |
+
2002/07/26/big/img_248
|
2070 |
+
2003/01/13/big/img_200
|
2071 |
+
2002/08/07/big/img_1794
|
2072 |
+
2002/08/31/big/img_17270
|
2073 |
+
2002/08/23/big/img_608
|
2074 |
+
2003/01/13/big/img_837
|
2075 |
+
2002/08/23/big/img_581
|
2076 |
+
2002/08/20/big/img_754
|
2077 |
+
2002/08/18/big/img_183
|
2078 |
+
2002/08/20/big/img_328
|
2079 |
+
2002/07/22/big/img_494
|
2080 |
+
2002/07/29/big/img_399
|
2081 |
+
2002/08/28/big/img_19284
|
2082 |
+
2002/08/08/big/img_566
|
2083 |
+
2002/07/25/big/img_376
|
2084 |
+
2002/07/23/big/img_138
|
2085 |
+
2002/07/25/big/img_435
|
2086 |
+
2002/08/17/big/img_685
|
2087 |
+
2002/07/19/big/img_90
|
2088 |
+
2002/07/20/big/img_716
|
2089 |
+
2002/08/31/big/img_17458
|
2090 |
+
2002/08/26/big/img_461
|
2091 |
+
2002/07/25/big/img_355
|
2092 |
+
2002/08/06/big/img_2152
|
2093 |
+
2002/07/27/big/img_932
|
2094 |
+
2002/07/23/big/img_232
|
2095 |
+
2002/08/08/big/img_1020
|
2096 |
+
2002/07/31/big/img_366
|
2097 |
+
2002/08/06/big/img_2667
|
2098 |
+
2002/08/21/big/img_465
|
2099 |
+
2002/08/15/big/img_305
|
2100 |
+
2002/08/02/big/img_247
|
2101 |
+
2002/07/28/big/img_46
|
2102 |
+
2002/08/27/big/img_19922
|
2103 |
+
2002/08/23/big/img_643
|
2104 |
+
2003/01/13/big/img_624
|
2105 |
+
2002/08/23/big/img_625
|
2106 |
+
2002/08/05/big/img_3787
|
2107 |
+
2003/01/13/big/img_627
|
2108 |
+
2002/09/01/big/img_16381
|
2109 |
+
2002/08/05/big/img_3668
|
2110 |
+
2002/07/21/big/img_535
|
2111 |
+
2002/08/27/big/img_19680
|
2112 |
+
2002/07/22/big/img_413
|
2113 |
+
2002/07/29/big/img_481
|
2114 |
+
2003/01/15/big/img_496
|
2115 |
+
2002/07/23/big/img_701
|
2116 |
+
2002/08/29/big/img_18670
|
2117 |
+
2002/07/28/big/img_319
|
2118 |
+
2003/01/14/big/img_517
|
2119 |
+
2002/07/26/big/img_256
|
2120 |
+
2003/01/16/big/img_593
|
2121 |
+
2002/07/30/big/img_956
|
2122 |
+
2002/07/30/big/img_667
|
2123 |
+
2002/07/25/big/img_100
|
2124 |
+
2002/08/11/big/img_570
|
2125 |
+
2002/07/26/big/img_745
|
2126 |
+
2002/08/04/big/img_834
|
2127 |
+
2002/08/25/big/img_521
|
2128 |
+
2002/08/01/big/img_2148
|
2129 |
+
2002/09/02/big/img_15183
|
2130 |
+
2002/08/22/big/img_514
|
2131 |
+
2002/08/23/big/img_477
|
2132 |
+
2002/07/23/big/img_336
|
2133 |
+
2002/07/26/big/img_481
|
2134 |
+
2002/08/20/big/img_409
|
2135 |
+
2002/07/23/big/img_918
|
2136 |
+
2002/08/09/big/img_474
|
2137 |
+
2002/08/02/big/img_929
|
2138 |
+
2002/08/31/big/img_17932
|
2139 |
+
2002/08/19/big/img_161
|
2140 |
+
2002/08/09/big/img_667
|
2141 |
+
2002/07/31/big/img_805
|
2142 |
+
2002/09/02/big/img_15678
|
2143 |
+
2002/08/31/big/img_17509
|
2144 |
+
2002/08/29/big/img_18998
|
2145 |
+
2002/07/23/big/img_301
|
2146 |
+
2002/08/07/big/img_1612
|
2147 |
+
2002/08/06/big/img_2472
|
2148 |
+
2002/07/23/big/img_466
|
2149 |
+
2002/08/27/big/img_19634
|
2150 |
+
2003/01/16/big/img_16
|
2151 |
+
2002/08/14/big/img_193
|
2152 |
+
2002/08/21/big/img_340
|
2153 |
+
2002/08/27/big/img_19799
|
2154 |
+
2002/08/01/big/img_1345
|
2155 |
+
2002/08/07/big/img_1448
|
2156 |
+
2002/08/11/big/img_324
|
2157 |
+
2003/01/16/big/img_754
|
2158 |
+
2002/08/13/big/img_418
|
2159 |
+
2003/01/16/big/img_544
|
2160 |
+
2002/08/19/big/img_135
|
2161 |
+
2002/08/10/big/img_455
|
2162 |
+
2002/08/10/big/img_693
|
2163 |
+
2002/08/31/big/img_17967
|
2164 |
+
2002/08/28/big/img_19229
|
2165 |
+
2002/08/04/big/img_811
|
2166 |
+
2002/09/01/big/img_16225
|
2167 |
+
2003/01/16/big/img_428
|
2168 |
+
2002/09/02/big/img_15295
|
2169 |
+
2002/07/26/big/img_108
|
2170 |
+
2002/07/21/big/img_477
|
2171 |
+
2002/08/07/big/img_1354
|
2172 |
+
2002/08/23/big/img_246
|
2173 |
+
2002/08/16/big/img_652
|
2174 |
+
2002/07/27/big/img_553
|
2175 |
+
2002/07/31/big/img_346
|
2176 |
+
2002/08/04/big/img_537
|
2177 |
+
2002/08/08/big/img_498
|
2178 |
+
2002/08/29/big/img_18956
|
2179 |
+
2003/01/13/big/img_922
|
2180 |
+
2002/08/31/big/img_17425
|
2181 |
+
2002/07/26/big/img_438
|
2182 |
+
2002/08/19/big/img_185
|
2183 |
+
2003/01/16/big/img_33
|
2184 |
+
2002/08/10/big/img_252
|
2185 |
+
2002/07/29/big/img_598
|
2186 |
+
2002/08/27/big/img_19820
|
2187 |
+
2002/08/06/big/img_2664
|
2188 |
+
2002/08/20/big/img_705
|
2189 |
+
2003/01/14/big/img_816
|
2190 |
+
2002/08/03/big/img_552
|
2191 |
+
2002/07/25/big/img_561
|
2192 |
+
2002/07/25/big/img_934
|
2193 |
+
2002/08/01/big/img_1893
|
2194 |
+
2003/01/14/big/img_746
|
2195 |
+
2003/01/16/big/img_519
|
2196 |
+
2002/08/03/big/img_681
|
2197 |
+
2002/07/24/big/img_808
|
2198 |
+
2002/08/14/big/img_803
|
2199 |
+
2002/08/25/big/img_155
|
2200 |
+
2002/07/30/big/img_1107
|
2201 |
+
2002/08/29/big/img_18882
|
2202 |
+
2003/01/15/big/img_598
|
2203 |
+
2002/08/19/big/img_122
|
2204 |
+
2002/07/30/big/img_428
|
2205 |
+
2002/07/24/big/img_684
|
2206 |
+
2002/08/22/big/img_192
|
2207 |
+
2002/08/22/big/img_543
|
2208 |
+
2002/08/07/big/img_1318
|
2209 |
+
2002/08/18/big/img_25
|
2210 |
+
2002/07/26/big/img_583
|
2211 |
+
2002/07/20/big/img_464
|
2212 |
+
2002/08/19/big/img_664
|
2213 |
+
2002/08/24/big/img_861
|
2214 |
+
2002/09/01/big/img_16136
|
2215 |
+
2002/08/22/big/img_400
|
2216 |
+
2002/08/12/big/img_445
|
2217 |
+
2003/01/14/big/img_174
|
2218 |
+
2002/08/27/big/img_19677
|
2219 |
+
2002/08/31/big/img_17214
|
2220 |
+
2002/08/30/big/img_18175
|
2221 |
+
2003/01/17/big/img_402
|
2222 |
+
2002/08/06/big/img_2396
|
2223 |
+
2002/08/18/big/img_448
|
2224 |
+
2002/08/21/big/img_165
|
2225 |
+
2002/08/31/big/img_17609
|
2226 |
+
2003/01/01/big/img_151
|
2227 |
+
2002/08/26/big/img_372
|
2228 |
+
2002/09/02/big/img_15994
|
2229 |
+
2002/07/26/big/img_660
|
2230 |
+
2002/09/02/big/img_15197
|
2231 |
+
2002/07/29/big/img_258
|
2232 |
+
2002/08/30/big/img_18525
|
2233 |
+
2003/01/13/big/img_368
|
2234 |
+
2002/07/29/big/img_1538
|
2235 |
+
2002/07/21/big/img_787
|
2236 |
+
2002/08/18/big/img_152
|
2237 |
+
2002/08/06/big/img_2379
|
2238 |
+
2003/01/17/big/img_864
|
2239 |
+
2002/08/27/big/img_19998
|
2240 |
+
2002/08/01/big/img_1634
|
2241 |
+
2002/07/25/big/img_414
|
2242 |
+
2002/08/22/big/img_627
|
2243 |
+
2002/08/07/big/img_1669
|
2244 |
+
2002/08/16/big/img_1052
|
2245 |
+
2002/08/31/big/img_17796
|
2246 |
+
2002/08/18/big/img_199
|
2247 |
+
2002/09/02/big/img_15147
|
2248 |
+
2002/08/09/big/img_460
|
2249 |
+
2002/08/14/big/img_581
|
2250 |
+
2002/08/30/big/img_18286
|
2251 |
+
2002/07/26/big/img_337
|
2252 |
+
2002/08/18/big/img_589
|
2253 |
+
2003/01/14/big/img_866
|
2254 |
+
2002/07/20/big/img_624
|
2255 |
+
2002/08/01/big/img_1801
|
2256 |
+
2002/07/24/big/img_683
|
2257 |
+
2002/08/09/big/img_725
|
2258 |
+
2003/01/14/big/img_34
|
2259 |
+
2002/07/30/big/img_144
|
2260 |
+
2002/07/30/big/img_706
|
2261 |
+
2002/08/08/big/img_394
|
2262 |
+
2002/08/19/big/img_619
|
2263 |
+
2002/08/06/big/img_2703
|
2264 |
+
2002/08/29/big/img_19034
|
2265 |
+
2002/07/24/big/img_67
|
2266 |
+
2002/08/27/big/img_19841
|
2267 |
+
2002/08/19/big/img_427
|
2268 |
+
2003/01/14/big/img_333
|
2269 |
+
2002/09/01/big/img_16406
|
2270 |
+
2002/07/19/big/img_882
|
2271 |
+
2002/08/17/big/img_238
|
2272 |
+
2003/01/14/big/img_739
|
2273 |
+
2002/07/22/big/img_151
|
2274 |
+
2002/08/21/big/img_743
|
2275 |
+
2002/07/25/big/img_1048
|
2276 |
+
2002/07/30/big/img_395
|
2277 |
+
2003/01/13/big/img_584
|
2278 |
+
2002/08/13/big/img_742
|
2279 |
+
2002/08/13/big/img_1168
|
2280 |
+
2003/01/14/big/img_147
|
2281 |
+
2002/07/26/big/img_803
|
2282 |
+
2002/08/05/big/img_3298
|
2283 |
+
2002/08/07/big/img_1451
|
2284 |
+
2002/08/16/big/img_424
|
2285 |
+
2002/07/29/big/img_1069
|
2286 |
+
2002/09/01/big/img_16735
|
2287 |
+
2002/07/21/big/img_637
|
2288 |
+
2003/01/14/big/img_585
|
2289 |
+
2002/08/02/big/img_358
|
2290 |
+
2003/01/13/big/img_358
|
2291 |
+
2002/08/14/big/img_198
|
2292 |
+
2002/08/17/big/img_935
|
2293 |
+
2002/08/04/big/img_42
|
2294 |
+
2002/08/30/big/img_18245
|
2295 |
+
2002/07/25/big/img_158
|
2296 |
+
2002/08/22/big/img_744
|
2297 |
+
2002/08/06/big/img_2291
|
2298 |
+
2002/08/05/big/img_3044
|
2299 |
+
2002/07/30/big/img_272
|
2300 |
+
2002/08/23/big/img_641
|
2301 |
+
2002/07/24/big/img_797
|
2302 |
+
2002/07/30/big/img_392
|
2303 |
+
2003/01/14/big/img_447
|
2304 |
+
2002/07/31/big/img_898
|
2305 |
+
2002/08/06/big/img_2812
|
2306 |
+
2002/08/13/big/img_564
|
2307 |
+
2002/07/22/big/img_43
|
2308 |
+
2002/07/26/big/img_634
|
2309 |
+
2002/07/19/big/img_843
|
2310 |
+
2002/08/26/big/img_58
|
2311 |
+
2002/07/21/big/img_375
|
2312 |
+
2002/08/25/big/img_729
|
2313 |
+
2002/07/19/big/img_561
|
2314 |
+
2003/01/15/big/img_884
|
2315 |
+
2002/07/25/big/img_891
|
2316 |
+
2002/08/09/big/img_558
|
2317 |
+
2002/08/26/big/img_587
|
2318 |
+
2002/08/13/big/img_1146
|
2319 |
+
2002/09/02/big/img_15153
|
2320 |
+
2002/07/26/big/img_316
|
2321 |
+
2002/08/01/big/img_1940
|
2322 |
+
2002/08/26/big/img_90
|
2323 |
+
2003/01/13/big/img_347
|
2324 |
+
2002/07/25/big/img_520
|
2325 |
+
2002/08/29/big/img_18718
|
2326 |
+
2002/08/28/big/img_19219
|
2327 |
+
2002/08/13/big/img_375
|
2328 |
+
2002/07/20/big/img_719
|
2329 |
+
2002/08/31/big/img_17431
|
2330 |
+
2002/07/28/big/img_192
|
2331 |
+
2002/08/26/big/img_259
|
2332 |
+
2002/08/18/big/img_484
|
2333 |
+
2002/07/29/big/img_580
|
2334 |
+
2002/07/26/big/img_84
|
2335 |
+
2002/08/02/big/img_302
|
2336 |
+
2002/08/31/big/img_17007
|
2337 |
+
2003/01/15/big/img_543
|
2338 |
+
2002/09/01/big/img_16488
|
2339 |
+
2002/08/22/big/img_798
|
2340 |
+
2002/07/30/big/img_383
|
2341 |
+
2002/08/04/big/img_668
|
2342 |
+
2002/08/13/big/img_156
|
2343 |
+
2002/08/07/big/img_1353
|
2344 |
+
2002/07/25/big/img_281
|
2345 |
+
2003/01/14/big/img_587
|
2346 |
+
2003/01/15/big/img_524
|
2347 |
+
2002/08/19/big/img_726
|
2348 |
+
2002/08/21/big/img_709
|
2349 |
+
2002/08/26/big/img_465
|
2350 |
+
2002/07/31/big/img_658
|
2351 |
+
2002/08/28/big/img_19148
|
2352 |
+
2002/07/23/big/img_423
|
2353 |
+
2002/08/16/big/img_758
|
2354 |
+
2002/08/22/big/img_523
|
2355 |
+
2002/08/16/big/img_591
|
2356 |
+
2002/08/23/big/img_845
|
2357 |
+
2002/07/26/big/img_678
|
2358 |
+
2002/08/09/big/img_806
|
2359 |
+
2002/08/06/big/img_2369
|
2360 |
+
2002/07/29/big/img_457
|
2361 |
+
2002/07/19/big/img_278
|
2362 |
+
2002/08/30/big/img_18107
|
2363 |
+
2002/07/26/big/img_444
|
2364 |
+
2002/08/20/big/img_278
|
2365 |
+
2002/08/26/big/img_92
|
2366 |
+
2002/08/26/big/img_257
|
2367 |
+
2002/07/25/big/img_266
|
2368 |
+
2002/08/05/big/img_3829
|
2369 |
+
2002/07/26/big/img_757
|
2370 |
+
2002/07/29/big/img_1536
|
2371 |
+
2002/08/09/big/img_472
|
2372 |
+
2003/01/17/big/img_480
|
2373 |
+
2002/08/28/big/img_19355
|
2374 |
+
2002/07/26/big/img_97
|
2375 |
+
2002/08/06/big/img_2503
|
2376 |
+
2002/07/19/big/img_254
|
2377 |
+
2002/08/01/big/img_1470
|
2378 |
+
2002/08/21/big/img_42
|
2379 |
+
2002/08/20/big/img_217
|
2380 |
+
2002/08/06/big/img_2459
|
2381 |
+
2002/07/19/big/img_552
|
2382 |
+
2002/08/13/big/img_717
|
2383 |
+
2002/08/12/big/img_586
|
2384 |
+
2002/08/20/big/img_411
|
2385 |
+
2003/01/13/big/img_768
|
2386 |
+
2002/08/07/big/img_1747
|
2387 |
+
2002/08/15/big/img_385
|
2388 |
+
2002/08/01/big/img_1648
|
2389 |
+
2002/08/15/big/img_311
|
2390 |
+
2002/08/21/big/img_95
|
2391 |
+
2002/08/09/big/img_108
|
2392 |
+
2002/08/21/big/img_398
|
2393 |
+
2002/08/17/big/img_340
|
2394 |
+
2002/08/14/big/img_474
|
2395 |
+
2002/08/13/big/img_294
|
2396 |
+
2002/08/24/big/img_840
|
2397 |
+
2002/08/09/big/img_808
|
2398 |
+
2002/08/23/big/img_491
|
2399 |
+
2002/07/28/big/img_33
|
2400 |
+
2003/01/13/big/img_664
|
2401 |
+
2002/08/02/big/img_261
|
2402 |
+
2002/08/09/big/img_591
|
2403 |
+
2002/07/26/big/img_309
|
2404 |
+
2003/01/14/big/img_372
|
2405 |
+
2002/08/19/big/img_581
|
2406 |
+
2002/08/19/big/img_168
|
2407 |
+
2002/08/26/big/img_422
|
2408 |
+
2002/07/24/big/img_106
|
2409 |
+
2002/08/01/big/img_1936
|
2410 |
+
2002/08/05/big/img_3764
|
2411 |
+
2002/08/21/big/img_266
|
2412 |
+
2002/08/31/big/img_17968
|
2413 |
+
2002/08/01/big/img_1941
|
2414 |
+
2002/08/15/big/img_550
|
2415 |
+
2002/08/14/big/img_13
|
2416 |
+
2002/07/30/big/img_171
|
2417 |
+
2003/01/13/big/img_490
|
2418 |
+
2002/07/25/big/img_427
|
2419 |
+
2002/07/19/big/img_770
|
2420 |
+
2002/08/12/big/img_759
|
2421 |
+
2003/01/15/big/img_1360
|
2422 |
+
2002/08/05/big/img_3692
|
2423 |
+
2003/01/16/big/img_30
|
2424 |
+
2002/07/25/big/img_1026
|
2425 |
+
2002/07/22/big/img_288
|
2426 |
+
2002/08/29/big/img_18801
|
2427 |
+
2002/07/24/big/img_793
|
2428 |
+
2002/08/13/big/img_178
|
2429 |
+
2002/08/06/big/img_2322
|
2430 |
+
2003/01/14/big/img_560
|
2431 |
+
2002/08/18/big/img_408
|
2432 |
+
2003/01/16/big/img_915
|
2433 |
+
2003/01/16/big/img_679
|
2434 |
+
2002/08/07/big/img_1552
|
2435 |
+
2002/08/29/big/img_19050
|
2436 |
+
2002/08/01/big/img_2172
|
2437 |
+
2002/07/31/big/img_30
|
2438 |
+
2002/07/30/big/img_1019
|
2439 |
+
2002/07/30/big/img_587
|
2440 |
+
2003/01/13/big/img_773
|
2441 |
+
2002/07/30/big/img_410
|
2442 |
+
2002/07/28/big/img_65
|
2443 |
+
2002/08/05/big/img_3138
|
2444 |
+
2002/07/23/big/img_541
|
2445 |
+
2002/08/22/big/img_963
|
2446 |
+
2002/07/27/big/img_657
|
2447 |
+
2002/07/30/big/img_1051
|
2448 |
+
2003/01/16/big/img_150
|
2449 |
+
2002/07/31/big/img_519
|
2450 |
+
2002/08/01/big/img_1961
|
2451 |
+
2002/08/05/big/img_3752
|
2452 |
+
2002/07/23/big/img_631
|
2453 |
+
2003/01/14/big/img_237
|
2454 |
+
2002/07/28/big/img_21
|
2455 |
+
2002/07/22/big/img_813
|
2456 |
+
2002/08/05/big/img_3563
|
2457 |
+
2003/01/17/big/img_620
|
2458 |
+
2002/07/19/big/img_523
|
2459 |
+
2002/07/30/big/img_904
|
2460 |
+
2002/08/29/big/img_18642
|
2461 |
+
2002/08/11/big/img_492
|
2462 |
+
2002/08/01/big/img_2130
|
2463 |
+
2002/07/25/big/img_618
|
2464 |
+
2002/08/17/big/img_305
|
2465 |
+
2003/01/16/big/img_520
|
2466 |
+
2002/07/26/big/img_495
|
2467 |
+
2002/08/17/big/img_164
|
2468 |
+
2002/08/03/big/img_440
|
2469 |
+
2002/07/24/big/img_441
|
2470 |
+
2002/08/06/big/img_2146
|
2471 |
+
2002/08/11/big/img_558
|
2472 |
+
2002/08/02/big/img_545
|
2473 |
+
2002/08/31/big/img_18090
|
2474 |
+
2003/01/01/big/img_136
|
2475 |
+
2002/07/25/big/img_1099
|
2476 |
+
2003/01/13/big/img_728
|
2477 |
+
2003/01/16/big/img_197
|
2478 |
+
2002/07/26/big/img_651
|
2479 |
+
2002/08/11/big/img_676
|
2480 |
+
2003/01/15/big/img_10
|
2481 |
+
2002/08/21/big/img_250
|
2482 |
+
2002/08/14/big/img_325
|
2483 |
+
2002/08/04/big/img_390
|
2484 |
+
2002/07/24/big/img_554
|
2485 |
+
2003/01/16/big/img_333
|
2486 |
+
2002/07/31/big/img_922
|
2487 |
+
2002/09/02/big/img_15586
|
2488 |
+
2003/01/16/big/img_184
|
2489 |
+
2002/07/22/big/img_766
|
2490 |
+
2002/07/21/big/img_608
|
2491 |
+
2002/08/07/big/img_1578
|
2492 |
+
2002/08/17/big/img_961
|
2493 |
+
2002/07/27/big/img_324
|
2494 |
+
2002/08/05/big/img_3765
|
2495 |
+
2002/08/23/big/img_462
|
2496 |
+
2003/01/16/big/img_382
|
2497 |
+
2002/08/27/big/img_19838
|
2498 |
+
2002/08/01/big/img_1505
|
2499 |
+
2002/08/21/big/img_662
|
2500 |
+
2002/08/14/big/img_605
|
2501 |
+
2002/08/19/big/img_816
|
2502 |
+
2002/07/29/big/img_136
|
2503 |
+
2002/08/20/big/img_719
|
2504 |
+
2002/08/06/big/img_2826
|
2505 |
+
2002/08/10/big/img_630
|
2506 |
+
2003/01/17/big/img_973
|
2507 |
+
2002/08/14/big/img_116
|
2508 |
+
2002/08/02/big/img_666
|
2509 |
+
2002/08/21/big/img_710
|
2510 |
+
2002/08/05/big/img_55
|
2511 |
+
2002/07/31/big/img_229
|
2512 |
+
2002/08/01/big/img_1549
|
2513 |
+
2002/07/23/big/img_432
|
2514 |
+
2002/07/21/big/img_430
|
2515 |
+
2002/08/21/big/img_549
|
2516 |
+
2002/08/08/big/img_985
|
2517 |
+
2002/07/20/big/img_610
|
2518 |
+
2002/07/23/big/img_978
|
2519 |
+
2002/08/23/big/img_219
|
2520 |
+
2002/07/25/big/img_175
|
2521 |
+
2003/01/15/big/img_230
|
2522 |
+
2002/08/23/big/img_385
|
2523 |
+
2002/07/31/big/img_879
|
2524 |
+
2002/08/12/big/img_495
|
2525 |
+
2002/08/22/big/img_499
|
2526 |
+
2002/08/30/big/img_18322
|
2527 |
+
2002/08/15/big/img_795
|
2528 |
+
2002/08/13/big/img_835
|
2529 |
+
2003/01/17/big/img_930
|
2530 |
+
2002/07/30/big/img_873
|
2531 |
+
2002/08/11/big/img_257
|
2532 |
+
2002/07/31/big/img_593
|
2533 |
+
2002/08/21/big/img_916
|
2534 |
+
2003/01/13/big/img_814
|
2535 |
+
2002/07/25/big/img_722
|
2536 |
+
2002/08/16/big/img_379
|
2537 |
+
2002/07/31/big/img_497
|
2538 |
+
2002/07/22/big/img_602
|
2539 |
+
2002/08/21/big/img_642
|
2540 |
+
2002/08/21/big/img_614
|
2541 |
+
2002/08/23/big/img_482
|
2542 |
+
2002/07/29/big/img_603
|
2543 |
+
2002/08/13/big/img_705
|
2544 |
+
2002/07/23/big/img_833
|
2545 |
+
2003/01/14/big/img_511
|
2546 |
+
2002/07/24/big/img_376
|
2547 |
+
2002/08/17/big/img_1030
|
2548 |
+
2002/08/05/big/img_3576
|
2549 |
+
2002/08/16/big/img_540
|
2550 |
+
2002/07/22/big/img_630
|
2551 |
+
2002/08/10/big/img_180
|
2552 |
+
2002/08/14/big/img_905
|
2553 |
+
2002/08/29/big/img_18777
|
2554 |
+
2002/08/22/big/img_693
|
2555 |
+
2003/01/16/big/img_933
|
2556 |
+
2002/08/20/big/img_555
|
2557 |
+
2002/08/15/big/img_549
|
2558 |
+
2003/01/14/big/img_830
|
2559 |
+
2003/01/16/big/img_64
|
2560 |
+
2002/08/27/big/img_19670
|
2561 |
+
2002/08/22/big/img_729
|
2562 |
+
2002/07/27/big/img_981
|
2563 |
+
2002/08/09/big/img_458
|
2564 |
+
2003/01/17/big/img_884
|
2565 |
+
2002/07/25/big/img_639
|
2566 |
+
2002/08/31/big/img_18008
|
2567 |
+
2002/08/22/big/img_249
|
2568 |
+
2002/08/17/big/img_971
|
2569 |
+
2002/08/04/big/img_308
|
2570 |
+
2002/07/28/big/img_362
|
2571 |
+
2002/08/12/big/img_142
|
2572 |
+
2002/08/26/big/img_61
|
2573 |
+
2002/08/14/big/img_422
|
2574 |
+
2002/07/19/big/img_607
|
2575 |
+
2003/01/15/big/img_717
|
2576 |
+
2002/08/01/big/img_1475
|
2577 |
+
2002/08/29/big/img_19061
|
2578 |
+
2003/01/01/big/img_346
|
2579 |
+
2002/07/20/big/img_315
|
2580 |
+
2003/01/15/big/img_756
|
2581 |
+
2002/08/15/big/img_879
|
2582 |
+
2002/08/08/big/img_615
|
2583 |
+
2003/01/13/big/img_431
|
2584 |
+
2002/08/05/big/img_3233
|
2585 |
+
2002/08/24/big/img_526
|
2586 |
+
2003/01/13/big/img_717
|
2587 |
+
2002/09/01/big/img_16408
|
2588 |
+
2002/07/22/big/img_217
|
2589 |
+
2002/07/31/big/img_960
|
2590 |
+
2002/08/21/big/img_610
|
2591 |
+
2002/08/05/big/img_3753
|
2592 |
+
2002/08/03/big/img_151
|
2593 |
+
2002/08/21/big/img_267
|
2594 |
+
2002/08/01/big/img_2175
|
2595 |
+
2002/08/04/big/img_556
|
2596 |
+
2002/08/21/big/img_527
|
2597 |
+
2002/09/02/big/img_15800
|
2598 |
+
2002/07/27/big/img_156
|
2599 |
+
2002/07/20/big/img_590
|
2600 |
+
2002/08/15/big/img_700
|
2601 |
+
2002/08/08/big/img_444
|
2602 |
+
2002/07/25/big/img_94
|
2603 |
+
2002/07/24/big/img_778
|
2604 |
+
2002/08/14/big/img_694
|
2605 |
+
2002/07/20/big/img_666
|
2606 |
+
2002/08/02/big/img_200
|
2607 |
+
2002/08/02/big/img_578
|
2608 |
+
2003/01/17/big/img_332
|
2609 |
+
2002/09/01/big/img_16352
|
2610 |
+
2002/08/27/big/img_19668
|
2611 |
+
2002/07/23/big/img_823
|
2612 |
+
2002/08/13/big/img_431
|
2613 |
+
2003/01/16/big/img_463
|
2614 |
+
2002/08/27/big/img_19711
|
2615 |
+
2002/08/23/big/img_154
|
2616 |
+
2002/07/31/big/img_360
|
2617 |
+
2002/08/23/big/img_555
|
2618 |
+
2002/08/10/big/img_561
|
2619 |
+
2003/01/14/big/img_550
|
2620 |
+
2002/08/07/big/img_1370
|
2621 |
+
2002/07/30/big/img_1184
|
2622 |
+
2002/08/01/big/img_1445
|
2623 |
+
2002/08/23/big/img_22
|
2624 |
+
2002/07/30/big/img_606
|
2625 |
+
2003/01/17/big/img_271
|
2626 |
+
2002/08/31/big/img_17316
|
2627 |
+
2002/08/16/big/img_973
|
2628 |
+
2002/07/26/big/img_77
|
2629 |
+
2002/07/20/big/img_788
|
2630 |
+
2002/08/06/big/img_2426
|
2631 |
+
2002/08/07/big/img_1498
|
2632 |
+
2002/08/16/big/img_358
|
2633 |
+
2002/08/06/big/img_2851
|
2634 |
+
2002/08/12/big/img_359
|
2635 |
+
2002/08/01/big/img_1521
|
2636 |
+
2002/08/02/big/img_709
|
2637 |
+
2002/08/20/big/img_935
|
2638 |
+
2002/08/12/big/img_188
|
2639 |
+
2002/08/24/big/img_411
|
2640 |
+
2002/08/22/big/img_680
|
2641 |
+
2002/08/06/big/img_2480
|
2642 |
+
2002/07/20/big/img_627
|
2643 |
+
2002/07/30/big/img_214
|
2644 |
+
2002/07/25/big/img_354
|
2645 |
+
2002/08/02/big/img_636
|
2646 |
+
2003/01/15/big/img_661
|
2647 |
+
2002/08/07/big/img_1327
|
2648 |
+
2002/08/01/big/img_2108
|
2649 |
+
2002/08/31/big/img_17919
|
2650 |
+
2002/08/29/big/img_18768
|
2651 |
+
2002/08/05/big/img_3840
|
2652 |
+
2002/07/26/big/img_242
|
2653 |
+
2003/01/14/big/img_451
|
2654 |
+
2002/08/20/big/img_923
|
2655 |
+
2002/08/27/big/img_19908
|
2656 |
+
2002/08/16/big/img_282
|
2657 |
+
2002/08/19/big/img_440
|
2658 |
+
2003/01/01/big/img_230
|
2659 |
+
2002/08/08/big/img_212
|
2660 |
+
2002/07/20/big/img_443
|
2661 |
+
2002/08/25/big/img_635
|
2662 |
+
2003/01/13/big/img_1169
|
2663 |
+
2002/07/26/big/img_998
|
2664 |
+
2002/08/15/big/img_995
|
2665 |
+
2002/08/06/big/img_3002
|
2666 |
+
2002/07/29/big/img_460
|
2667 |
+
2003/01/14/big/img_925
|
2668 |
+
2002/07/23/big/img_539
|
2669 |
+
2002/08/16/big/img_694
|
2670 |
+
2003/01/13/big/img_459
|
2671 |
+
2002/07/23/big/img_249
|
2672 |
+
2002/08/20/big/img_539
|
2673 |
+
2002/08/04/big/img_186
|
2674 |
+
2002/08/26/big/img_264
|
2675 |
+
2002/07/22/big/img_704
|
2676 |
+
2002/08/25/big/img_277
|
2677 |
+
2002/08/22/big/img_988
|
2678 |
+
2002/07/29/big/img_504
|
2679 |
+
2002/08/05/big/img_3600
|
2680 |
+
2002/08/30/big/img_18380
|
2681 |
+
2003/01/14/big/img_937
|
2682 |
+
2002/08/21/big/img_254
|
2683 |
+
2002/08/10/big/img_130
|
2684 |
+
2002/08/20/big/img_339
|
2685 |
+
2003/01/14/big/img_428
|
2686 |
+
2002/08/20/big/img_889
|
2687 |
+
2002/08/31/big/img_17637
|
2688 |
+
2002/07/26/big/img_644
|
2689 |
+
2002/09/01/big/img_16776
|
2690 |
+
2002/08/06/big/img_2239
|
2691 |
+
2002/08/06/big/img_2646
|
2692 |
+
2003/01/13/big/img_491
|
2693 |
+
2002/08/10/big/img_579
|
2694 |
+
2002/08/21/big/img_713
|
2695 |
+
2002/08/22/big/img_482
|
2696 |
+
2002/07/22/big/img_167
|
2697 |
+
2002/07/24/big/img_539
|
2698 |
+
2002/08/14/big/img_721
|
2699 |
+
2002/07/25/big/img_389
|
2700 |
+
2002/09/01/big/img_16591
|
2701 |
+
2002/08/13/big/img_543
|
2702 |
+
2003/01/14/big/img_432
|
2703 |
+
2002/08/09/big/img_287
|
2704 |
+
2002/07/26/big/img_126
|
2705 |
+
2002/08/23/big/img_412
|
2706 |
+
2002/08/15/big/img_1034
|
2707 |
+
2002/08/28/big/img_19485
|
2708 |
+
2002/07/31/big/img_236
|
2709 |
+
2002/07/30/big/img_523
|
2710 |
+
2002/07/19/big/img_141
|
2711 |
+
2003/01/17/big/img_957
|
2712 |
+
2002/08/04/big/img_81
|
2713 |
+
2002/07/25/big/img_206
|
2714 |
+
2002/08/15/big/img_716
|
2715 |
+
2002/08/13/big/img_403
|
2716 |
+
2002/08/15/big/img_685
|
2717 |
+
2002/07/26/big/img_884
|
2718 |
+
2002/07/19/big/img_499
|
2719 |
+
2002/07/23/big/img_772
|
2720 |
+
2002/07/27/big/img_752
|
2721 |
+
2003/01/14/big/img_493
|
2722 |
+
2002/08/25/big/img_664
|
2723 |
+
2002/07/31/big/img_334
|
2724 |
+
2002/08/26/big/img_678
|
2725 |
+
2002/09/01/big/img_16541
|
2726 |
+
2003/01/14/big/img_347
|
2727 |
+
2002/07/23/big/img_187
|
2728 |
+
2002/07/30/big/img_1163
|
2729 |
+
2002/08/05/big/img_35
|
2730 |
+
2002/08/22/big/img_944
|
2731 |
+
2002/08/07/big/img_1239
|
2732 |
+
2002/07/29/big/img_1215
|
2733 |
+
2002/08/03/big/img_312
|
2734 |
+
2002/08/05/big/img_3523
|
2735 |
+
2002/07/29/big/img_218
|
2736 |
+
2002/08/13/big/img_672
|
2737 |
+
2002/08/16/big/img_205
|
2738 |
+
2002/08/17/big/img_594
|
2739 |
+
2002/07/29/big/img_1411
|
2740 |
+
2002/07/30/big/img_942
|
2741 |
+
2003/01/16/big/img_312
|
2742 |
+
2002/08/08/big/img_312
|
2743 |
+
2002/07/25/big/img_15
|
2744 |
+
2002/08/09/big/img_839
|
2745 |
+
2002/08/01/big/img_2069
|
2746 |
+
2002/08/31/big/img_17512
|
2747 |
+
2002/08/01/big/img_3
|
2748 |
+
2002/07/31/big/img_320
|
2749 |
+
2003/01/15/big/img_1265
|
2750 |
+
2002/08/14/big/img_563
|
2751 |
+
2002/07/31/big/img_167
|
2752 |
+
2002/08/20/big/img_374
|
2753 |
+
2002/08/13/big/img_406
|
2754 |
+
2002/08/08/big/img_625
|
2755 |
+
2002/08/02/big/img_314
|
2756 |
+
2002/08/27/big/img_19964
|
2757 |
+
2002/09/01/big/img_16670
|
2758 |
+
2002/07/31/big/img_599
|
2759 |
+
2002/08/29/big/img_18906
|
2760 |
+
2002/07/24/big/img_373
|
2761 |
+
2002/07/26/big/img_513
|
2762 |
+
2002/09/02/big/img_15497
|
2763 |
+
2002/08/19/big/img_117
|
2764 |
+
2003/01/01/big/img_158
|
2765 |
+
2002/08/24/big/img_178
|
2766 |
+
2003/01/13/big/img_935
|
2767 |
+
2002/08/13/big/img_609
|
2768 |
+
2002/08/30/big/img_18341
|
2769 |
+
2002/08/25/big/img_674
|
2770 |
+
2003/01/13/big/img_209
|
2771 |
+
2002/08/13/big/img_258
|
2772 |
+
2002/08/05/big/img_3543
|
2773 |
+
2002/08/07/big/img_1970
|
2774 |
+
2002/08/06/big/img_3004
|
2775 |
+
2003/01/17/big/img_487
|
2776 |
+
2002/08/24/big/img_873
|
2777 |
+
2002/08/29/big/img_18730
|
2778 |
+
2002/08/09/big/img_375
|
2779 |
+
2003/01/16/big/img_751
|
2780 |
+
2002/08/02/big/img_603
|
2781 |
+
2002/08/19/big/img_325
|
2782 |
+
2002/09/01/big/img_16420
|
2783 |
+
2002/08/05/big/img_3633
|
2784 |
+
2002/08/21/big/img_516
|
2785 |
+
2002/07/19/big/img_501
|
2786 |
+
2002/07/26/big/img_688
|
2787 |
+
2002/07/24/big/img_256
|
2788 |
+
2002/07/25/big/img_438
|
2789 |
+
2002/07/31/big/img_1017
|
2790 |
+
2002/08/22/big/img_512
|
2791 |
+
2002/07/21/big/img_543
|
2792 |
+
2002/08/08/big/img_223
|
2793 |
+
2002/08/19/big/img_189
|
2794 |
+
2002/08/12/big/img_630
|
2795 |
+
2002/07/30/big/img_958
|
2796 |
+
2002/07/28/big/img_208
|
2797 |
+
2002/08/31/big/img_17691
|
2798 |
+
2002/07/22/big/img_542
|
2799 |
+
2002/07/19/big/img_741
|
2800 |
+
2002/07/19/big/img_158
|
2801 |
+
2002/08/15/big/img_399
|
2802 |
+
2002/08/01/big/img_2159
|
2803 |
+
2002/08/14/big/img_455
|
2804 |
+
2002/08/17/big/img_1011
|
2805 |
+
2002/08/26/big/img_744
|
2806 |
+
2002/08/12/big/img_624
|
2807 |
+
2003/01/17/big/img_821
|
2808 |
+
2002/08/16/big/img_980
|
2809 |
+
2002/07/28/big/img_281
|
2810 |
+
2002/07/25/big/img_171
|
2811 |
+
2002/08/03/big/img_116
|
2812 |
+
2002/07/22/big/img_467
|
2813 |
+
2002/07/31/big/img_750
|
2814 |
+
2002/07/26/big/img_435
|
2815 |
+
2002/07/19/big/img_822
|
2816 |
+
2002/08/13/big/img_626
|
2817 |
+
2002/08/11/big/img_344
|
2818 |
+
2002/08/02/big/img_473
|
2819 |
+
2002/09/01/big/img_16817
|
2820 |
+
2002/08/01/big/img_1275
|
2821 |
+
2002/08/28/big/img_19270
|
2822 |
+
2002/07/23/big/img_607
|
2823 |
+
2002/08/09/big/img_316
|
2824 |
+
2002/07/29/big/img_626
|
2825 |
+
2002/07/24/big/img_824
|
2826 |
+
2002/07/22/big/img_342
|
2827 |
+
2002/08/08/big/img_794
|
2828 |
+
2002/08/07/big/img_1209
|
2829 |
+
2002/07/19/big/img_18
|
2830 |
+
2002/08/25/big/img_634
|
2831 |
+
2002/07/24/big/img_730
|
2832 |
+
2003/01/17/big/img_356
|
2833 |
+
2002/07/23/big/img_305
|
2834 |
+
2002/07/30/big/img_453
|
2835 |
+
2003/01/13/big/img_972
|
2836 |
+
2002/08/06/big/img_2610
|
2837 |
+
2002/08/29/big/img_18920
|
2838 |
+
2002/07/31/big/img_123
|
2839 |
+
2002/07/26/big/img_979
|
2840 |
+
2002/08/24/big/img_635
|
2841 |
+
2002/08/05/big/img_3704
|
2842 |
+
2002/08/07/big/img_1358
|
2843 |
+
2002/07/22/big/img_306
|
2844 |
+
2002/08/13/big/img_619
|
2845 |
+
2002/08/02/big/img_366
|
face_vid2vid/GPEN/retinaface/data/__init__.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from .wider_face import WiderFaceDetection, detection_collate
|
2 |
+
from .data_augment import *
|
3 |
+
from .config import *
|
face_vid2vid/GPEN/retinaface/data/config.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# config.py
|
2 |
+
|
3 |
+
cfg_mnet = {
|
4 |
+
'name': 'mobilenet0.25',
|
5 |
+
'min_sizes': [[16, 32], [64, 128], [256, 512]],
|
6 |
+
'steps': [8, 16, 32],
|
7 |
+
'variance': [0.1, 0.2],
|
8 |
+
'clip': False,
|
9 |
+
'loc_weight': 2.0,
|
10 |
+
'gpu_train': True,
|
11 |
+
'batch_size': 32,
|
12 |
+
'ngpu': 1,
|
13 |
+
'epoch': 250,
|
14 |
+
'decay1': 190,
|
15 |
+
'decay2': 220,
|
16 |
+
'image_size': 640,
|
17 |
+
'pretrain': False,
|
18 |
+
'return_layers': {'stage1': 1, 'stage2': 2, 'stage3': 3},
|
19 |
+
'in_channel': 32,
|
20 |
+
'out_channel': 64
|
21 |
+
}
|
22 |
+
|
23 |
+
cfg_re50 = {
|
24 |
+
'name': 'Resnet50',
|
25 |
+
'min_sizes': [[16, 32], [64, 128], [256, 512]],
|
26 |
+
'steps': [8, 16, 32],
|
27 |
+
'variance': [0.1, 0.2],
|
28 |
+
'clip': False,
|
29 |
+
'loc_weight': 2.0,
|
30 |
+
'gpu_train': True,
|
31 |
+
'batch_size': 24,
|
32 |
+
'ngpu': 4,
|
33 |
+
'epoch': 100,
|
34 |
+
'decay1': 70,
|
35 |
+
'decay2': 90,
|
36 |
+
'image_size': 840,
|
37 |
+
'pretrain': False,
|
38 |
+
'return_layers': {'layer2': 1, 'layer3': 2, 'layer4': 3},
|
39 |
+
'in_channel': 256,
|
40 |
+
'out_channel': 256
|
41 |
+
}
|
42 |
+
|
face_vid2vid/GPEN/retinaface/data/data_augment.py
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import numpy as np
|
3 |
+
import random
|
4 |
+
from utils.box_utils import matrix_iof
|
5 |
+
|
6 |
+
|
7 |
+
def _crop(image, boxes, labels, landm, img_dim):
|
8 |
+
height, width, _ = image.shape
|
9 |
+
pad_image_flag = True
|
10 |
+
|
11 |
+
for _ in range(250):
|
12 |
+
"""
|
13 |
+
if random.uniform(0, 1) <= 0.2:
|
14 |
+
scale = 1.0
|
15 |
+
else:
|
16 |
+
scale = random.uniform(0.3, 1.0)
|
17 |
+
"""
|
18 |
+
PRE_SCALES = [0.3, 0.45, 0.6, 0.8, 1.0]
|
19 |
+
scale = random.choice(PRE_SCALES)
|
20 |
+
short_side = min(width, height)
|
21 |
+
w = int(scale * short_side)
|
22 |
+
h = w
|
23 |
+
|
24 |
+
if width == w:
|
25 |
+
l = 0
|
26 |
+
else:
|
27 |
+
l = random.randrange(width - w)
|
28 |
+
if height == h:
|
29 |
+
t = 0
|
30 |
+
else:
|
31 |
+
t = random.randrange(height - h)
|
32 |
+
roi = np.array((l, t, l + w, t + h))
|
33 |
+
|
34 |
+
value = matrix_iof(boxes, roi[np.newaxis])
|
35 |
+
flag = (value >= 1)
|
36 |
+
if not flag.any():
|
37 |
+
continue
|
38 |
+
|
39 |
+
centers = (boxes[:, :2] + boxes[:, 2:]) / 2
|
40 |
+
mask_a = np.logical_and(roi[:2] < centers, centers < roi[2:]).all(axis=1)
|
41 |
+
boxes_t = boxes[mask_a].copy()
|
42 |
+
labels_t = labels[mask_a].copy()
|
43 |
+
landms_t = landm[mask_a].copy()
|
44 |
+
landms_t = landms_t.reshape([-1, 5, 2])
|
45 |
+
|
46 |
+
if boxes_t.shape[0] == 0:
|
47 |
+
continue
|
48 |
+
|
49 |
+
image_t = image[roi[1]:roi[3], roi[0]:roi[2]]
|
50 |
+
|
51 |
+
boxes_t[:, :2] = np.maximum(boxes_t[:, :2], roi[:2])
|
52 |
+
boxes_t[:, :2] -= roi[:2]
|
53 |
+
boxes_t[:, 2:] = np.minimum(boxes_t[:, 2:], roi[2:])
|
54 |
+
boxes_t[:, 2:] -= roi[:2]
|
55 |
+
|
56 |
+
# landm
|
57 |
+
landms_t[:, :, :2] = landms_t[:, :, :2] - roi[:2]
|
58 |
+
landms_t[:, :, :2] = np.maximum(landms_t[:, :, :2], np.array([0, 0]))
|
59 |
+
landms_t[:, :, :2] = np.minimum(landms_t[:, :, :2], roi[2:] - roi[:2])
|
60 |
+
landms_t = landms_t.reshape([-1, 10])
|
61 |
+
|
62 |
+
|
63 |
+
# make sure that the cropped image contains at least one face > 16 pixel at training image scale
|
64 |
+
b_w_t = (boxes_t[:, 2] - boxes_t[:, 0] + 1) / w * img_dim
|
65 |
+
b_h_t = (boxes_t[:, 3] - boxes_t[:, 1] + 1) / h * img_dim
|
66 |
+
mask_b = np.minimum(b_w_t, b_h_t) > 0.0
|
67 |
+
boxes_t = boxes_t[mask_b]
|
68 |
+
labels_t = labels_t[mask_b]
|
69 |
+
landms_t = landms_t[mask_b]
|
70 |
+
|
71 |
+
if boxes_t.shape[0] == 0:
|
72 |
+
continue
|
73 |
+
|
74 |
+
pad_image_flag = False
|
75 |
+
|
76 |
+
return image_t, boxes_t, labels_t, landms_t, pad_image_flag
|
77 |
+
return image, boxes, labels, landm, pad_image_flag
|
78 |
+
|
79 |
+
|
80 |
+
def _distort(image):
|
81 |
+
|
82 |
+
def _convert(image, alpha=1, beta=0):
|
83 |
+
tmp = image.astype(float) * alpha + beta
|
84 |
+
tmp[tmp < 0] = 0
|
85 |
+
tmp[tmp > 255] = 255
|
86 |
+
image[:] = tmp
|
87 |
+
|
88 |
+
image = image.copy()
|
89 |
+
|
90 |
+
if random.randrange(2):
|
91 |
+
|
92 |
+
#brightness distortion
|
93 |
+
if random.randrange(2):
|
94 |
+
_convert(image, beta=random.uniform(-32, 32))
|
95 |
+
|
96 |
+
#contrast distortion
|
97 |
+
if random.randrange(2):
|
98 |
+
_convert(image, alpha=random.uniform(0.5, 1.5))
|
99 |
+
|
100 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|
101 |
+
|
102 |
+
#saturation distortion
|
103 |
+
if random.randrange(2):
|
104 |
+
_convert(image[:, :, 1], alpha=random.uniform(0.5, 1.5))
|
105 |
+
|
106 |
+
#hue distortion
|
107 |
+
if random.randrange(2):
|
108 |
+
tmp = image[:, :, 0].astype(int) + random.randint(-18, 18)
|
109 |
+
tmp %= 180
|
110 |
+
image[:, :, 0] = tmp
|
111 |
+
|
112 |
+
image = cv2.cvtColor(image, cv2.COLOR_HSV2BGR)
|
113 |
+
|
114 |
+
else:
|
115 |
+
|
116 |
+
#brightness distortion
|
117 |
+
if random.randrange(2):
|
118 |
+
_convert(image, beta=random.uniform(-32, 32))
|
119 |
+
|
120 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
|
121 |
+
|
122 |
+
#saturation distortion
|
123 |
+
if random.randrange(2):
|
124 |
+
_convert(image[:, :, 1], alpha=random.uniform(0.5, 1.5))
|
125 |
+
|
126 |
+
#hue distortion
|
127 |
+
if random.randrange(2):
|
128 |
+
tmp = image[:, :, 0].astype(int) + random.randint(-18, 18)
|
129 |
+
tmp %= 180
|
130 |
+
image[:, :, 0] = tmp
|
131 |
+
|
132 |
+
image = cv2.cvtColor(image, cv2.COLOR_HSV2BGR)
|
133 |
+
|
134 |
+
#contrast distortion
|
135 |
+
if random.randrange(2):
|
136 |
+
_convert(image, alpha=random.uniform(0.5, 1.5))
|
137 |
+
|
138 |
+
return image
|
139 |
+
|
140 |
+
|
141 |
+
def _expand(image, boxes, fill, p):
|
142 |
+
if random.randrange(2):
|
143 |
+
return image, boxes
|
144 |
+
|
145 |
+
height, width, depth = image.shape
|
146 |
+
|
147 |
+
scale = random.uniform(1, p)
|
148 |
+
w = int(scale * width)
|
149 |
+
h = int(scale * height)
|
150 |
+
|
151 |
+
left = random.randint(0, w - width)
|
152 |
+
top = random.randint(0, h - height)
|
153 |
+
|
154 |
+
boxes_t = boxes.copy()
|
155 |
+
boxes_t[:, :2] += (left, top)
|
156 |
+
boxes_t[:, 2:] += (left, top)
|
157 |
+
expand_image = np.empty(
|
158 |
+
(h, w, depth),
|
159 |
+
dtype=image.dtype)
|
160 |
+
expand_image[:, :] = fill
|
161 |
+
expand_image[top:top + height, left:left + width] = image
|
162 |
+
image = expand_image
|
163 |
+
|
164 |
+
return image, boxes_t
|
165 |
+
|
166 |
+
|
167 |
+
def _mirror(image, boxes, landms):
|
168 |
+
_, width, _ = image.shape
|
169 |
+
if random.randrange(2):
|
170 |
+
image = image[:, ::-1]
|
171 |
+
boxes = boxes.copy()
|
172 |
+
boxes[:, 0::2] = width - boxes[:, 2::-2]
|
173 |
+
|
174 |
+
# landm
|
175 |
+
landms = landms.copy()
|
176 |
+
landms = landms.reshape([-1, 5, 2])
|
177 |
+
landms[:, :, 0] = width - landms[:, :, 0]
|
178 |
+
tmp = landms[:, 1, :].copy()
|
179 |
+
landms[:, 1, :] = landms[:, 0, :]
|
180 |
+
landms[:, 0, :] = tmp
|
181 |
+
tmp1 = landms[:, 4, :].copy()
|
182 |
+
landms[:, 4, :] = landms[:, 3, :]
|
183 |
+
landms[:, 3, :] = tmp1
|
184 |
+
landms = landms.reshape([-1, 10])
|
185 |
+
|
186 |
+
return image, boxes, landms
|
187 |
+
|
188 |
+
|
189 |
+
def _pad_to_square(image, rgb_mean, pad_image_flag):
|
190 |
+
if not pad_image_flag:
|
191 |
+
return image
|
192 |
+
height, width, _ = image.shape
|
193 |
+
long_side = max(width, height)
|
194 |
+
image_t = np.empty((long_side, long_side, 3), dtype=image.dtype)
|
195 |
+
image_t[:, :] = rgb_mean
|
196 |
+
image_t[0:0 + height, 0:0 + width] = image
|
197 |
+
return image_t
|
198 |
+
|
199 |
+
|
200 |
+
def _resize_subtract_mean(image, insize, rgb_mean):
|
201 |
+
interp_methods = [cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_NEAREST, cv2.INTER_LANCZOS4]
|
202 |
+
interp_method = interp_methods[random.randrange(5)]
|
203 |
+
image = cv2.resize(image, (insize, insize), interpolation=interp_method)
|
204 |
+
image = image.astype(np.float32)
|
205 |
+
image -= rgb_mean
|
206 |
+
return image.transpose(2, 0, 1)
|
207 |
+
|
208 |
+
|
209 |
+
class preproc(object):
|
210 |
+
|
211 |
+
def __init__(self, img_dim, rgb_means):
|
212 |
+
self.img_dim = img_dim
|
213 |
+
self.rgb_means = rgb_means
|
214 |
+
|
215 |
+
def __call__(self, image, targets):
|
216 |
+
assert targets.shape[0] > 0, "this image does not have gt"
|
217 |
+
|
218 |
+
boxes = targets[:, :4].copy()
|
219 |
+
labels = targets[:, -1].copy()
|
220 |
+
landm = targets[:, 4:-1].copy()
|
221 |
+
|
222 |
+
image_t, boxes_t, labels_t, landm_t, pad_image_flag = _crop(image, boxes, labels, landm, self.img_dim)
|
223 |
+
image_t = _distort(image_t)
|
224 |
+
image_t = _pad_to_square(image_t,self.rgb_means, pad_image_flag)
|
225 |
+
image_t, boxes_t, landm_t = _mirror(image_t, boxes_t, landm_t)
|
226 |
+
height, width, _ = image_t.shape
|
227 |
+
image_t = _resize_subtract_mean(image_t, self.img_dim, self.rgb_means)
|
228 |
+
boxes_t[:, 0::2] /= width
|
229 |
+
boxes_t[:, 1::2] /= height
|
230 |
+
|
231 |
+
landm_t[:, 0::2] /= width
|
232 |
+
landm_t[:, 1::2] /= height
|
233 |
+
|
234 |
+
labels_t = np.expand_dims(labels_t, 1)
|
235 |
+
targets_t = np.hstack((boxes_t, landm_t, labels_t))
|
236 |
+
|
237 |
+
return image_t, targets_t
|
face_vid2vid/GPEN/retinaface/data/wider_face.py
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import os.path
|
3 |
+
import sys
|
4 |
+
import torch
|
5 |
+
import torch.utils.data as data
|
6 |
+
import cv2
|
7 |
+
import numpy as np
|
8 |
+
|
9 |
+
class WiderFaceDetection(data.Dataset):
|
10 |
+
def __init__(self, txt_path, preproc=None):
|
11 |
+
self.preproc = preproc
|
12 |
+
self.imgs_path = []
|
13 |
+
self.words = []
|
14 |
+
f = open(txt_path,'r')
|
15 |
+
lines = f.readlines()
|
16 |
+
isFirst = True
|
17 |
+
labels = []
|
18 |
+
for line in lines:
|
19 |
+
line = line.rstrip()
|
20 |
+
if line.startswith('#'):
|
21 |
+
if isFirst is True:
|
22 |
+
isFirst = False
|
23 |
+
else:
|
24 |
+
labels_copy = labels.copy()
|
25 |
+
self.words.append(labels_copy)
|
26 |
+
labels.clear()
|
27 |
+
path = line[2:]
|
28 |
+
path = txt_path.replace('label.txt','images/') + path
|
29 |
+
self.imgs_path.append(path)
|
30 |
+
else:
|
31 |
+
line = line.split(' ')
|
32 |
+
label = [float(x) for x in line]
|
33 |
+
labels.append(label)
|
34 |
+
|
35 |
+
self.words.append(labels)
|
36 |
+
|
37 |
+
def __len__(self):
|
38 |
+
return len(self.imgs_path)
|
39 |
+
|
40 |
+
def __getitem__(self, index):
|
41 |
+
img = cv2.imread(self.imgs_path[index])
|
42 |
+
height, width, _ = img.shape
|
43 |
+
|
44 |
+
labels = self.words[index]
|
45 |
+
annotations = np.zeros((0, 15))
|
46 |
+
if len(labels) == 0:
|
47 |
+
return annotations
|
48 |
+
for idx, label in enumerate(labels):
|
49 |
+
annotation = np.zeros((1, 15))
|
50 |
+
# bbox
|
51 |
+
annotation[0, 0] = label[0] # x1
|
52 |
+
annotation[0, 1] = label[1] # y1
|
53 |
+
annotation[0, 2] = label[0] + label[2] # x2
|
54 |
+
annotation[0, 3] = label[1] + label[3] # y2
|
55 |
+
|
56 |
+
# landmarks
|
57 |
+
annotation[0, 4] = label[4] # l0_x
|
58 |
+
annotation[0, 5] = label[5] # l0_y
|
59 |
+
annotation[0, 6] = label[7] # l1_x
|
60 |
+
annotation[0, 7] = label[8] # l1_y
|
61 |
+
annotation[0, 8] = label[10] # l2_x
|
62 |
+
annotation[0, 9] = label[11] # l2_y
|
63 |
+
annotation[0, 10] = label[13] # l3_x
|
64 |
+
annotation[0, 11] = label[14] # l3_y
|
65 |
+
annotation[0, 12] = label[16] # l4_x
|
66 |
+
annotation[0, 13] = label[17] # l4_y
|
67 |
+
if (annotation[0, 4]<0):
|
68 |
+
annotation[0, 14] = -1
|
69 |
+
else:
|
70 |
+
annotation[0, 14] = 1
|
71 |
+
|
72 |
+
annotations = np.append(annotations, annotation, axis=0)
|
73 |
+
target = np.array(annotations)
|
74 |
+
if self.preproc is not None:
|
75 |
+
img, target = self.preproc(img, target)
|
76 |
+
|
77 |
+
return torch.from_numpy(img), target
|
78 |
+
|
79 |
+
def detection_collate(batch):
|
80 |
+
"""Custom collate fn for dealing with batches of images that have a different
|
81 |
+
number of associated object annotations (bounding boxes).
|
82 |
+
|
83 |
+
Arguments:
|
84 |
+
batch: (tuple) A tuple of tensor images and lists of annotations
|
85 |
+
|
86 |
+
Return:
|
87 |
+
A tuple containing:
|
88 |
+
1) (tensor) batch of images stacked on their 0 dim
|
89 |
+
2) (list of tensors) annotations for a given image are stacked on 0 dim
|
90 |
+
"""
|
91 |
+
targets = []
|
92 |
+
imgs = []
|
93 |
+
for _, sample in enumerate(batch):
|
94 |
+
for _, tup in enumerate(sample):
|
95 |
+
if torch.is_tensor(tup):
|
96 |
+
imgs.append(tup)
|
97 |
+
elif isinstance(tup, type(np.empty(0))):
|
98 |
+
annos = torch.from_numpy(tup).float()
|
99 |
+
targets.append(annos)
|
100 |
+
|
101 |
+
return (torch.stack(imgs, 0), targets)
|
face_vid2vid/GPEN/retinaface/facemodels/__init__.py
ADDED
File without changes
|
face_vid2vid/GPEN/retinaface/facemodels/net.py
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
import torch
|
3 |
+
import torch.nn as nn
|
4 |
+
import torchvision.models._utils as _utils
|
5 |
+
import torchvision.models as models
|
6 |
+
import torch.nn.functional as F
|
7 |
+
from torch.autograd import Variable
|
8 |
+
|
9 |
+
def conv_bn(inp, oup, stride = 1, leaky = 0):
|
10 |
+
return nn.Sequential(
|
11 |
+
nn.Conv2d(inp, oup, 3, stride, 1, bias=False),
|
12 |
+
nn.BatchNorm2d(oup),
|
13 |
+
nn.LeakyReLU(negative_slope=leaky, inplace=True)
|
14 |
+
)
|
15 |
+
|
16 |
+
def conv_bn_no_relu(inp, oup, stride):
|
17 |
+
return nn.Sequential(
|
18 |
+
nn.Conv2d(inp, oup, 3, stride, 1, bias=False),
|
19 |
+
nn.BatchNorm2d(oup),
|
20 |
+
)
|
21 |
+
|
22 |
+
def conv_bn1X1(inp, oup, stride, leaky=0):
|
23 |
+
return nn.Sequential(
|
24 |
+
nn.Conv2d(inp, oup, 1, stride, padding=0, bias=False),
|
25 |
+
nn.BatchNorm2d(oup),
|
26 |
+
nn.LeakyReLU(negative_slope=leaky, inplace=True)
|
27 |
+
)
|
28 |
+
|
29 |
+
def conv_dw(inp, oup, stride, leaky=0.1):
|
30 |
+
return nn.Sequential(
|
31 |
+
nn.Conv2d(inp, inp, 3, stride, 1, groups=inp, bias=False),
|
32 |
+
nn.BatchNorm2d(inp),
|
33 |
+
nn.LeakyReLU(negative_slope= leaky,inplace=True),
|
34 |
+
|
35 |
+
nn.Conv2d(inp, oup, 1, 1, 0, bias=False),
|
36 |
+
nn.BatchNorm2d(oup),
|
37 |
+
nn.LeakyReLU(negative_slope= leaky,inplace=True),
|
38 |
+
)
|
39 |
+
|
40 |
+
class SSH(nn.Module):
|
41 |
+
def __init__(self, in_channel, out_channel):
|
42 |
+
super(SSH, self).__init__()
|
43 |
+
assert out_channel % 4 == 0
|
44 |
+
leaky = 0
|
45 |
+
if (out_channel <= 64):
|
46 |
+
leaky = 0.1
|
47 |
+
self.conv3X3 = conv_bn_no_relu(in_channel, out_channel//2, stride=1)
|
48 |
+
|
49 |
+
self.conv5X5_1 = conv_bn(in_channel, out_channel//4, stride=1, leaky = leaky)
|
50 |
+
self.conv5X5_2 = conv_bn_no_relu(out_channel//4, out_channel//4, stride=1)
|
51 |
+
|
52 |
+
self.conv7X7_2 = conv_bn(out_channel//4, out_channel//4, stride=1, leaky = leaky)
|
53 |
+
self.conv7x7_3 = conv_bn_no_relu(out_channel//4, out_channel//4, stride=1)
|
54 |
+
|
55 |
+
def forward(self, input):
|
56 |
+
conv3X3 = self.conv3X3(input)
|
57 |
+
|
58 |
+
conv5X5_1 = self.conv5X5_1(input)
|
59 |
+
conv5X5 = self.conv5X5_2(conv5X5_1)
|
60 |
+
|
61 |
+
conv7X7_2 = self.conv7X7_2(conv5X5_1)
|
62 |
+
conv7X7 = self.conv7x7_3(conv7X7_2)
|
63 |
+
|
64 |
+
out = torch.cat([conv3X3, conv5X5, conv7X7], dim=1)
|
65 |
+
out = F.relu(out)
|
66 |
+
return out
|
67 |
+
|
68 |
+
class FPN(nn.Module):
|
69 |
+
def __init__(self,in_channels_list,out_channels):
|
70 |
+
super(FPN,self).__init__()
|
71 |
+
leaky = 0
|
72 |
+
if (out_channels <= 64):
|
73 |
+
leaky = 0.1
|
74 |
+
self.output1 = conv_bn1X1(in_channels_list[0], out_channels, stride = 1, leaky = leaky)
|
75 |
+
self.output2 = conv_bn1X1(in_channels_list[1], out_channels, stride = 1, leaky = leaky)
|
76 |
+
self.output3 = conv_bn1X1(in_channels_list[2], out_channels, stride = 1, leaky = leaky)
|
77 |
+
|
78 |
+
self.merge1 = conv_bn(out_channels, out_channels, leaky = leaky)
|
79 |
+
self.merge2 = conv_bn(out_channels, out_channels, leaky = leaky)
|
80 |
+
|
81 |
+
def forward(self, input):
|
82 |
+
# names = list(input.keys())
|
83 |
+
input = list(input.values())
|
84 |
+
|
85 |
+
output1 = self.output1(input[0])
|
86 |
+
output2 = self.output2(input[1])
|
87 |
+
output3 = self.output3(input[2])
|
88 |
+
|
89 |
+
up3 = F.interpolate(output3, size=[output2.size(2), output2.size(3)], mode="nearest")
|
90 |
+
output2 = output2 + up3
|
91 |
+
output2 = self.merge2(output2)
|
92 |
+
|
93 |
+
up2 = F.interpolate(output2, size=[output1.size(2), output1.size(3)], mode="nearest")
|
94 |
+
output1 = output1 + up2
|
95 |
+
output1 = self.merge1(output1)
|
96 |
+
|
97 |
+
out = [output1, output2, output3]
|
98 |
+
return out
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
class MobileNetV1(nn.Module):
|
103 |
+
def __init__(self):
|
104 |
+
super(MobileNetV1, self).__init__()
|
105 |
+
self.stage1 = nn.Sequential(
|
106 |
+
conv_bn(3, 8, 2, leaky = 0.1), # 3
|
107 |
+
conv_dw(8, 16, 1), # 7
|
108 |
+
conv_dw(16, 32, 2), # 11
|
109 |
+
conv_dw(32, 32, 1), # 19
|
110 |
+
conv_dw(32, 64, 2), # 27
|
111 |
+
conv_dw(64, 64, 1), # 43
|
112 |
+
)
|
113 |
+
self.stage2 = nn.Sequential(
|
114 |
+
conv_dw(64, 128, 2), # 43 + 16 = 59
|
115 |
+
conv_dw(128, 128, 1), # 59 + 32 = 91
|
116 |
+
conv_dw(128, 128, 1), # 91 + 32 = 123
|
117 |
+
conv_dw(128, 128, 1), # 123 + 32 = 155
|
118 |
+
conv_dw(128, 128, 1), # 155 + 32 = 187
|
119 |
+
conv_dw(128, 128, 1), # 187 + 32 = 219
|
120 |
+
)
|
121 |
+
self.stage3 = nn.Sequential(
|
122 |
+
conv_dw(128, 256, 2), # 219 +3 2 = 241
|
123 |
+
conv_dw(256, 256, 1), # 241 + 64 = 301
|
124 |
+
)
|
125 |
+
self.avg = nn.AdaptiveAvgPool2d((1,1))
|
126 |
+
self.fc = nn.Linear(256, 1000)
|
127 |
+
|
128 |
+
def forward(self, x):
|
129 |
+
x = self.stage1(x)
|
130 |
+
x = self.stage2(x)
|
131 |
+
x = self.stage3(x)
|
132 |
+
x = self.avg(x)
|
133 |
+
# x = self.model(x)
|
134 |
+
x = x.view(-1, 256)
|
135 |
+
x = self.fc(x)
|
136 |
+
return x
|
137 |
+
|
face_vid2vid/GPEN/retinaface/facemodels/retinaface.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torchvision.models.detection.backbone_utils as backbone_utils
|
4 |
+
import torchvision.models._utils as _utils
|
5 |
+
import torch.nn.functional as F
|
6 |
+
from collections import OrderedDict
|
7 |
+
|
8 |
+
from facemodels.net import MobileNetV1 as MobileNetV1
|
9 |
+
from facemodels.net import FPN as FPN
|
10 |
+
from facemodels.net import SSH as SSH
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
class ClassHead(nn.Module):
|
15 |
+
def __init__(self,inchannels=512,num_anchors=3):
|
16 |
+
super(ClassHead,self).__init__()
|
17 |
+
self.num_anchors = num_anchors
|
18 |
+
self.conv1x1 = nn.Conv2d(inchannels,self.num_anchors*2,kernel_size=(1,1),stride=1,padding=0)
|
19 |
+
|
20 |
+
def forward(self,x):
|
21 |
+
out = self.conv1x1(x)
|
22 |
+
out = out.permute(0,2,3,1).contiguous()
|
23 |
+
|
24 |
+
return out.view(out.shape[0], -1, 2)
|
25 |
+
|
26 |
+
class BboxHead(nn.Module):
|
27 |
+
def __init__(self,inchannels=512,num_anchors=3):
|
28 |
+
super(BboxHead,self).__init__()
|
29 |
+
self.conv1x1 = nn.Conv2d(inchannels,num_anchors*4,kernel_size=(1,1),stride=1,padding=0)
|
30 |
+
|
31 |
+
def forward(self,x):
|
32 |
+
out = self.conv1x1(x)
|
33 |
+
out = out.permute(0,2,3,1).contiguous()
|
34 |
+
|
35 |
+
return out.view(out.shape[0], -1, 4)
|
36 |
+
|
37 |
+
class LandmarkHead(nn.Module):
|
38 |
+
def __init__(self,inchannels=512,num_anchors=3):
|
39 |
+
super(LandmarkHead,self).__init__()
|
40 |
+
self.conv1x1 = nn.Conv2d(inchannels,num_anchors*10,kernel_size=(1,1),stride=1,padding=0)
|
41 |
+
|
42 |
+
def forward(self,x):
|
43 |
+
out = self.conv1x1(x)
|
44 |
+
out = out.permute(0,2,3,1).contiguous()
|
45 |
+
|
46 |
+
return out.view(out.shape[0], -1, 10)
|
47 |
+
|
48 |
+
class RetinaFace(nn.Module):
|
49 |
+
def __init__(self, cfg = None, phase = 'train'):
|
50 |
+
"""
|
51 |
+
:param cfg: Network related settings.
|
52 |
+
:param phase: train or test.
|
53 |
+
"""
|
54 |
+
super(RetinaFace,self).__init__()
|
55 |
+
self.phase = phase
|
56 |
+
backbone = None
|
57 |
+
if cfg['name'] == 'mobilenet0.25':
|
58 |
+
backbone = MobileNetV1()
|
59 |
+
if cfg['pretrain']:
|
60 |
+
checkpoint = torch.load("./weights/mobilenetV1X0.25_pretrain.tar", map_location=torch.device('cpu'))
|
61 |
+
from collections import OrderedDict
|
62 |
+
new_state_dict = OrderedDict()
|
63 |
+
for k, v in checkpoint['state_dict'].items():
|
64 |
+
name = k[7:] # remove module.
|
65 |
+
new_state_dict[name] = v
|
66 |
+
# load params
|
67 |
+
backbone.load_state_dict(new_state_dict)
|
68 |
+
elif cfg['name'] == 'Resnet50':
|
69 |
+
import torchvision.models as models
|
70 |
+
backbone = models.resnet50(pretrained=cfg['pretrain'])
|
71 |
+
|
72 |
+
self.body = _utils.IntermediateLayerGetter(backbone, cfg['return_layers'])
|
73 |
+
in_channels_stage2 = cfg['in_channel']
|
74 |
+
in_channels_list = [
|
75 |
+
in_channels_stage2 * 2,
|
76 |
+
in_channels_stage2 * 4,
|
77 |
+
in_channels_stage2 * 8,
|
78 |
+
]
|
79 |
+
out_channels = cfg['out_channel']
|
80 |
+
self.fpn = FPN(in_channels_list,out_channels)
|
81 |
+
self.ssh1 = SSH(out_channels, out_channels)
|
82 |
+
self.ssh2 = SSH(out_channels, out_channels)
|
83 |
+
self.ssh3 = SSH(out_channels, out_channels)
|
84 |
+
|
85 |
+
self.ClassHead = self._make_class_head(fpn_num=3, inchannels=cfg['out_channel'])
|
86 |
+
self.BboxHead = self._make_bbox_head(fpn_num=3, inchannels=cfg['out_channel'])
|
87 |
+
self.LandmarkHead = self._make_landmark_head(fpn_num=3, inchannels=cfg['out_channel'])
|
88 |
+
|
89 |
+
def _make_class_head(self,fpn_num=3,inchannels=64,anchor_num=2):
|
90 |
+
classhead = nn.ModuleList()
|
91 |
+
for i in range(fpn_num):
|
92 |
+
classhead.append(ClassHead(inchannels,anchor_num))
|
93 |
+
return classhead
|
94 |
+
|
95 |
+
def _make_bbox_head(self,fpn_num=3,inchannels=64,anchor_num=2):
|
96 |
+
bboxhead = nn.ModuleList()
|
97 |
+
for i in range(fpn_num):
|
98 |
+
bboxhead.append(BboxHead(inchannels,anchor_num))
|
99 |
+
return bboxhead
|
100 |
+
|
101 |
+
def _make_landmark_head(self,fpn_num=3,inchannels=64,anchor_num=2):
|
102 |
+
landmarkhead = nn.ModuleList()
|
103 |
+
for i in range(fpn_num):
|
104 |
+
landmarkhead.append(LandmarkHead(inchannels,anchor_num))
|
105 |
+
return landmarkhead
|
106 |
+
|
107 |
+
def forward(self,inputs):
|
108 |
+
out = self.body(inputs)
|
109 |
+
|
110 |
+
# FPN
|
111 |
+
fpn = self.fpn(out)
|
112 |
+
|
113 |
+
# SSH
|
114 |
+
feature1 = self.ssh1(fpn[0])
|
115 |
+
feature2 = self.ssh2(fpn[1])
|
116 |
+
feature3 = self.ssh3(fpn[2])
|
117 |
+
features = [feature1, feature2, feature3]
|
118 |
+
|
119 |
+
bbox_regressions = torch.cat([self.BboxHead[i](feature) for i, feature in enumerate(features)], dim=1)
|
120 |
+
classifications = torch.cat([self.ClassHead[i](feature) for i, feature in enumerate(features)],dim=1)
|
121 |
+
ldm_regressions = torch.cat([self.LandmarkHead[i](feature) for i, feature in enumerate(features)], dim=1)
|
122 |
+
|
123 |
+
if self.phase == 'train':
|
124 |
+
output = (bbox_regressions, classifications, ldm_regressions)
|
125 |
+
else:
|
126 |
+
output = (bbox_regressions, F.softmax(classifications, dim=-1), ldm_regressions)
|
127 |
+
return output
|
face_vid2vid/GPEN/retinaface/layers/__init__.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
from .functions import *
|
2 |
+
from .modules import *
|
face_vid2vid/GPEN/retinaface/layers/functions/prior_box.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from itertools import product as product
|
3 |
+
import numpy as np
|
4 |
+
from math import ceil
|
5 |
+
|
6 |
+
|
7 |
+
class PriorBox(object):
|
8 |
+
def __init__(self, cfg, image_size=None, phase='train'):
|
9 |
+
super(PriorBox, self).__init__()
|
10 |
+
self.min_sizes = cfg['min_sizes']
|
11 |
+
self.steps = cfg['steps']
|
12 |
+
self.clip = cfg['clip']
|
13 |
+
self.image_size = image_size
|
14 |
+
self.feature_maps = [[ceil(self.image_size[0]/step), ceil(self.image_size[1]/step)] for step in self.steps]
|
15 |
+
self.name = "s"
|
16 |
+
|
17 |
+
def forward(self):
|
18 |
+
anchors = []
|
19 |
+
for k, f in enumerate(self.feature_maps):
|
20 |
+
min_sizes = self.min_sizes[k]
|
21 |
+
for i, j in product(range(f[0]), range(f[1])):
|
22 |
+
for min_size in min_sizes:
|
23 |
+
s_kx = min_size / self.image_size[1]
|
24 |
+
s_ky = min_size / self.image_size[0]
|
25 |
+
dense_cx = [x * self.steps[k] / self.image_size[1] for x in [j + 0.5]]
|
26 |
+
dense_cy = [y * self.steps[k] / self.image_size[0] for y in [i + 0.5]]
|
27 |
+
for cy, cx in product(dense_cy, dense_cx):
|
28 |
+
anchors += [cx, cy, s_kx, s_ky]
|
29 |
+
|
30 |
+
# back to torch land
|
31 |
+
output = torch.Tensor(anchors).view(-1, 4)
|
32 |
+
if self.clip:
|
33 |
+
output.clamp_(max=1, min=0)
|
34 |
+
return output
|
face_vid2vid/GPEN/retinaface/layers/modules/__init__.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from .multibox_loss import MultiBoxLoss
|
2 |
+
|
3 |
+
__all__ = ['MultiBoxLoss']
|
face_vid2vid/GPEN/retinaface/layers/modules/multibox_loss.py
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.nn.functional as F
|
4 |
+
from torch.autograd import Variable
|
5 |
+
from utils.box_utils import match, log_sum_exp
|
6 |
+
from data import cfg_mnet
|
7 |
+
GPU = cfg_mnet['gpu_train']
|
8 |
+
|
9 |
+
class MultiBoxLoss(nn.Module):
|
10 |
+
"""SSD Weighted Loss Function
|
11 |
+
Compute Targets:
|
12 |
+
1) Produce Confidence Target Indices by matching ground truth boxes
|
13 |
+
with (default) 'priorboxes' that have jaccard index > threshold parameter
|
14 |
+
(default threshold: 0.5).
|
15 |
+
2) Produce localization target by 'encoding' variance into offsets of ground
|
16 |
+
truth boxes and their matched 'priorboxes'.
|
17 |
+
3) Hard negative mining to filter the excessive number of negative examples
|
18 |
+
that comes with using a large number of default bounding boxes.
|
19 |
+
(default negative:positive ratio 3:1)
|
20 |
+
Objective Loss:
|
21 |
+
L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
|
22 |
+
Where, Lconf is the CrossEntropy Loss and Lloc is the SmoothL1 Loss
|
23 |
+
weighted by α which is set to 1 by cross val.
|
24 |
+
Args:
|
25 |
+
c: class confidences,
|
26 |
+
l: predicted boxes,
|
27 |
+
g: ground truth boxes
|
28 |
+
N: number of matched default boxes
|
29 |
+
See: https://arxiv.org/pdf/1512.02325.pdf for more details.
|
30 |
+
"""
|
31 |
+
|
32 |
+
def __init__(self, num_classes, overlap_thresh, prior_for_matching, bkg_label, neg_mining, neg_pos, neg_overlap, encode_target):
|
33 |
+
super(MultiBoxLoss, self).__init__()
|
34 |
+
self.num_classes = num_classes
|
35 |
+
self.threshold = overlap_thresh
|
36 |
+
self.background_label = bkg_label
|
37 |
+
self.encode_target = encode_target
|
38 |
+
self.use_prior_for_matching = prior_for_matching
|
39 |
+
self.do_neg_mining = neg_mining
|
40 |
+
self.negpos_ratio = neg_pos
|
41 |
+
self.neg_overlap = neg_overlap
|
42 |
+
self.variance = [0.1, 0.2]
|
43 |
+
|
44 |
+
def forward(self, predictions, priors, targets):
|
45 |
+
"""Multibox Loss
|
46 |
+
Args:
|
47 |
+
predictions (tuple): A tuple containing loc preds, conf preds,
|
48 |
+
and prior boxes from SSD net.
|
49 |
+
conf shape: torch.size(batch_size,num_priors,num_classes)
|
50 |
+
loc shape: torch.size(batch_size,num_priors,4)
|
51 |
+
priors shape: torch.size(num_priors,4)
|
52 |
+
|
53 |
+
ground_truth (tensor): Ground truth boxes and labels for a batch,
|
54 |
+
shape: [batch_size,num_objs,5] (last idx is the label).
|
55 |
+
"""
|
56 |
+
|
57 |
+
loc_data, conf_data, landm_data = predictions
|
58 |
+
priors = priors
|
59 |
+
num = loc_data.size(0)
|
60 |
+
num_priors = (priors.size(0))
|
61 |
+
|
62 |
+
# match priors (default boxes) and ground truth boxes
|
63 |
+
loc_t = torch.Tensor(num, num_priors, 4)
|
64 |
+
landm_t = torch.Tensor(num, num_priors, 10)
|
65 |
+
conf_t = torch.LongTensor(num, num_priors)
|
66 |
+
for idx in range(num):
|
67 |
+
truths = targets[idx][:, :4].data
|
68 |
+
labels = targets[idx][:, -1].data
|
69 |
+
landms = targets[idx][:, 4:14].data
|
70 |
+
defaults = priors.data
|
71 |
+
match(self.threshold, truths, defaults, self.variance, labels, landms, loc_t, conf_t, landm_t, idx)
|
72 |
+
if GPU:
|
73 |
+
loc_t = loc_t.cuda()
|
74 |
+
conf_t = conf_t.cuda()
|
75 |
+
landm_t = landm_t.cuda()
|
76 |
+
|
77 |
+
zeros = torch.tensor(0).cuda()
|
78 |
+
# landm Loss (Smooth L1)
|
79 |
+
# Shape: [batch,num_priors,10]
|
80 |
+
pos1 = conf_t > zeros
|
81 |
+
num_pos_landm = pos1.long().sum(1, keepdim=True)
|
82 |
+
N1 = max(num_pos_landm.data.sum().float(), 1)
|
83 |
+
pos_idx1 = pos1.unsqueeze(pos1.dim()).expand_as(landm_data)
|
84 |
+
landm_p = landm_data[pos_idx1].view(-1, 10)
|
85 |
+
landm_t = landm_t[pos_idx1].view(-1, 10)
|
86 |
+
loss_landm = F.smooth_l1_loss(landm_p, landm_t, reduction='sum')
|
87 |
+
|
88 |
+
|
89 |
+
pos = conf_t != zeros
|
90 |
+
conf_t[pos] = 1
|
91 |
+
|
92 |
+
# Localization Loss (Smooth L1)
|
93 |
+
# Shape: [batch,num_priors,4]
|
94 |
+
pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
|
95 |
+
loc_p = loc_data[pos_idx].view(-1, 4)
|
96 |
+
loc_t = loc_t[pos_idx].view(-1, 4)
|
97 |
+
loss_l = F.smooth_l1_loss(loc_p, loc_t, reduction='sum')
|
98 |
+
|
99 |
+
# Compute max conf across batch for hard negative mining
|
100 |
+
batch_conf = conf_data.view(-1, self.num_classes)
|
101 |
+
loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1, 1))
|
102 |
+
|
103 |
+
# Hard Negative Mining
|
104 |
+
loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
|
105 |
+
loss_c = loss_c.view(num, -1)
|
106 |
+
_, loss_idx = loss_c.sort(1, descending=True)
|
107 |
+
_, idx_rank = loss_idx.sort(1)
|
108 |
+
num_pos = pos.long().sum(1, keepdim=True)
|
109 |
+
num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
|
110 |
+
neg = idx_rank < num_neg.expand_as(idx_rank)
|
111 |
+
|
112 |
+
# Confidence Loss Including Positive and Negative Examples
|
113 |
+
pos_idx = pos.unsqueeze(2).expand_as(conf_data)
|
114 |
+
neg_idx = neg.unsqueeze(2).expand_as(conf_data)
|
115 |
+
conf_p = conf_data[(pos_idx+neg_idx).gt(0)].view(-1,self.num_classes)
|
116 |
+
targets_weighted = conf_t[(pos+neg).gt(0)]
|
117 |
+
loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')
|
118 |
+
|
119 |
+
# Sum of losses: L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
|
120 |
+
N = max(num_pos.data.sum().float(), 1)
|
121 |
+
loss_l /= N
|
122 |
+
loss_c /= N
|
123 |
+
loss_landm /= N1
|
124 |
+
|
125 |
+
return loss_l, loss_c, loss_landm
|
face_vid2vid/GPEN/retinaface/retinaface_detection.py
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
@paper: GAN Prior Embedded Network for Blind Face Restoration in the Wild (CVPR2021)
|
3 |
+
@author: yangxy ([email protected])
|
4 |
+
'''
|
5 |
+
import os
|
6 |
+
import torch
|
7 |
+
import torch.backends.cudnn as cudnn
|
8 |
+
import numpy as np
|
9 |
+
from data import cfg_re50
|
10 |
+
from layers.functions.prior_box import PriorBox
|
11 |
+
from utils.nms.py_cpu_nms import py_cpu_nms
|
12 |
+
import cv2
|
13 |
+
from facemodels.retinaface import RetinaFace
|
14 |
+
from utils.box_utils import decode, decode_landm
|
15 |
+
import time
|
16 |
+
import torch
|
17 |
+
|
18 |
+
class RetinaFaceDetection(object):
|
19 |
+
def __init__(self, base_dir, network='RetinaFace-R50'):
|
20 |
+
torch.set_grad_enabled(False)
|
21 |
+
cudnn.benchmark = True
|
22 |
+
self.pretrained_path = os.path.join(base_dir, 'weights', network+'.pth')
|
23 |
+
self.device = torch.cuda.current_device()
|
24 |
+
self.cfg = cfg_re50
|
25 |
+
self.net = RetinaFace(cfg=self.cfg, phase='test')
|
26 |
+
self.load_model()
|
27 |
+
self.net = self.net.cuda()
|
28 |
+
self.net_trt = None
|
29 |
+
|
30 |
+
def check_keys(self, pretrained_state_dict):
|
31 |
+
ckpt_keys = set(pretrained_state_dict.keys())
|
32 |
+
model_keys = set(self.net.state_dict().keys())
|
33 |
+
used_pretrained_keys = model_keys & ckpt_keys
|
34 |
+
unused_pretrained_keys = ckpt_keys - model_keys
|
35 |
+
missing_keys = model_keys - ckpt_keys
|
36 |
+
assert len(used_pretrained_keys) > 0, 'load NONE from pretrained checkpoint'
|
37 |
+
return True
|
38 |
+
|
39 |
+
def remove_prefix(self, state_dict, prefix):
|
40 |
+
''' Old style model is stored with all names of parameters sharing common prefix 'module.' '''
|
41 |
+
f = lambda x: x.split(prefix, 1)[-1] if x.startswith(prefix) else x
|
42 |
+
return {f(key): value for key, value in state_dict.items()}
|
43 |
+
|
44 |
+
def load_model(self, load_to_cpu=False):
|
45 |
+
if load_to_cpu:
|
46 |
+
pretrained_dict = torch.load(self.pretrained_path, map_location=torch.device('cpu'))
|
47 |
+
else:
|
48 |
+
pretrained_dict = torch.load(self.pretrained_path, map_location=torch.device('cpu'))
|
49 |
+
if "state_dict" in pretrained_dict.keys():
|
50 |
+
pretrained_dict = self.remove_prefix(pretrained_dict['state_dict'], 'module.')
|
51 |
+
else:
|
52 |
+
pretrained_dict = self.remove_prefix(pretrained_dict, 'module.')
|
53 |
+
self.check_keys(pretrained_dict)
|
54 |
+
self.net.load_state_dict(pretrained_dict, strict=False)
|
55 |
+
self.net.eval()
|
56 |
+
|
57 |
+
def build_trt(self, img_raw):
|
58 |
+
img = np.float32(img_raw)
|
59 |
+
|
60 |
+
img -= (104, 117, 123)
|
61 |
+
img = img.transpose(2, 0, 1)
|
62 |
+
img = torch.from_numpy(img).unsqueeze(0)
|
63 |
+
img = img.cuda()
|
64 |
+
|
65 |
+
print('building trt model FaceGAN')
|
66 |
+
from torch2trt import torch2trt
|
67 |
+
self.net_trt = torch2trt(self.net, [img], fp16_mode=True)
|
68 |
+
del self.net
|
69 |
+
print('sucessfully built')
|
70 |
+
|
71 |
+
def detect_trt(self, img_raw, resize=1, confidence_threshold=0.9, nms_threshold=0.4, top_k=5000, keep_top_k=750, save_image=False):
|
72 |
+
img = np.float32(img_raw)
|
73 |
+
|
74 |
+
im_height, im_width = img.shape[:2]
|
75 |
+
scale = torch.Tensor([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
|
76 |
+
img -= (104, 117, 123)
|
77 |
+
img = img.transpose(2, 0, 1)
|
78 |
+
img = torch.from_numpy(img).unsqueeze(0)
|
79 |
+
img = img.cuda()
|
80 |
+
scale = scale.cuda()
|
81 |
+
|
82 |
+
loc, conf, landms = self.net_trt(img) # forward pass
|
83 |
+
|
84 |
+
priorbox = PriorBox(self.cfg, image_size=(im_height, im_width))
|
85 |
+
priors = priorbox.forward()
|
86 |
+
priors = priors.cuda()
|
87 |
+
prior_data = priors.data
|
88 |
+
boxes = decode(loc.data.squeeze(0), prior_data, self.cfg['variance'])
|
89 |
+
boxes = boxes * scale / resize
|
90 |
+
boxes = boxes.cpu().numpy()
|
91 |
+
scores = conf.squeeze(0).data.cpu().numpy()[:, 1]
|
92 |
+
landms = decode_landm(landms.data.squeeze(0), prior_data, self.cfg['variance'])
|
93 |
+
scale1 = torch.Tensor([img.shape[3], img.shape[2], img.shape[3], img.shape[2],
|
94 |
+
img.shape[3], img.shape[2], img.shape[3], img.shape[2],
|
95 |
+
img.shape[3], img.shape[2]])
|
96 |
+
scale1 = scale1.cuda()
|
97 |
+
landms = landms * scale1 / resize
|
98 |
+
landms = landms.cpu().numpy()
|
99 |
+
|
100 |
+
# ignore low scores
|
101 |
+
inds = np.where(scores > confidence_threshold)[0]
|
102 |
+
boxes = boxes[inds]
|
103 |
+
landms = landms[inds]
|
104 |
+
scores = scores[inds]
|
105 |
+
|
106 |
+
# keep top-K before NMS
|
107 |
+
order = scores.argsort()[::-1][:top_k]
|
108 |
+
boxes = boxes[order]
|
109 |
+
landms = landms[order]
|
110 |
+
scores = scores[order]
|
111 |
+
|
112 |
+
# do NMS
|
113 |
+
dets = np.hstack((boxes, scores[:, np.newaxis])).astype(np.float32, copy=False)
|
114 |
+
keep = py_cpu_nms(dets, nms_threshold)
|
115 |
+
# keep = nms(dets, nms_threshold,force_cpu=args.cpu)
|
116 |
+
dets = dets[keep, :]
|
117 |
+
landms = landms[keep]
|
118 |
+
|
119 |
+
# keep top-K faster NMS
|
120 |
+
dets = dets[:keep_top_k, :]
|
121 |
+
landms = landms[:keep_top_k, :]
|
122 |
+
|
123 |
+
# sort faces(delete)
|
124 |
+
'''
|
125 |
+
fscores = [det[4] for det in dets]
|
126 |
+
sorted_idx = sorted(range(len(fscores)), key=lambda k:fscores[k], reverse=False) # sort index
|
127 |
+
tmp = [landms[idx] for idx in sorted_idx]
|
128 |
+
landms = np.asarray(tmp)
|
129 |
+
'''
|
130 |
+
|
131 |
+
landms = landms.reshape((-1, 5, 2))
|
132 |
+
landms = landms.transpose((0, 2, 1))
|
133 |
+
landms = landms.reshape(-1, 10, )
|
134 |
+
return dets, landms
|
135 |
+
|
136 |
+
|
137 |
+
def detect(self, img_raw, resize=1, confidence_threshold=0.9, nms_threshold=0.4, top_k=5000, keep_top_k=750, save_image=False):
|
138 |
+
img = np.float32(img_raw)
|
139 |
+
|
140 |
+
im_height, im_width = img.shape[:2]
|
141 |
+
scale = torch.Tensor([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
|
142 |
+
img -= (104, 117, 123)
|
143 |
+
img = img.transpose(2, 0, 1)
|
144 |
+
img = torch.from_numpy(img).unsqueeze(0)
|
145 |
+
img = img.cuda()
|
146 |
+
scale = scale.cuda()
|
147 |
+
|
148 |
+
loc, conf, landms = self.net(img) # forward pass
|
149 |
+
|
150 |
+
priorbox = PriorBox(self.cfg, image_size=(im_height, im_width))
|
151 |
+
priors = priorbox.forward()
|
152 |
+
priors = priors.cuda()
|
153 |
+
prior_data = priors.data
|
154 |
+
boxes = decode(loc.data.squeeze(0), prior_data, self.cfg['variance'])
|
155 |
+
boxes = boxes * scale / resize
|
156 |
+
boxes = boxes.cpu().numpy()
|
157 |
+
scores = conf.squeeze(0).data.cpu().numpy()[:, 1]
|
158 |
+
landms = decode_landm(landms.data.squeeze(0), prior_data, self.cfg['variance'])
|
159 |
+
scale1 = torch.Tensor([img.shape[3], img.shape[2], img.shape[3], img.shape[2],
|
160 |
+
img.shape[3], img.shape[2], img.shape[3], img.shape[2],
|
161 |
+
img.shape[3], img.shape[2]])
|
162 |
+
scale1 = scale1.cuda()
|
163 |
+
landms = landms * scale1 / resize
|
164 |
+
landms = landms.cpu().numpy()
|
165 |
+
|
166 |
+
# ignore low scores
|
167 |
+
inds = np.where(scores > confidence_threshold)[0]
|
168 |
+
boxes = boxes[inds]
|
169 |
+
landms = landms[inds]
|
170 |
+
scores = scores[inds]
|
171 |
+
|
172 |
+
# keep top-K before NMS
|
173 |
+
order = scores.argsort()[::-1][:top_k]
|
174 |
+
boxes = boxes[order]
|
175 |
+
landms = landms[order]
|
176 |
+
scores = scores[order]
|
177 |
+
|
178 |
+
# do NMS
|
179 |
+
dets = np.hstack((boxes, scores[:, np.newaxis])).astype(np.float32, copy=False)
|
180 |
+
keep = py_cpu_nms(dets, nms_threshold)
|
181 |
+
# keep = nms(dets, nms_threshold,force_cpu=args.cpu)
|
182 |
+
dets = dets[keep, :]
|
183 |
+
landms = landms[keep]
|
184 |
+
|
185 |
+
# keep top-K faster NMS
|
186 |
+
dets = dets[:keep_top_k, :]
|
187 |
+
landms = landms[:keep_top_k, :]
|
188 |
+
|
189 |
+
# sort faces(delete)
|
190 |
+
'''
|
191 |
+
fscores = [det[4] for det in dets]
|
192 |
+
sorted_idx = sorted(range(len(fscores)), key=lambda k:fscores[k], reverse=False) # sort index
|
193 |
+
tmp = [landms[idx] for idx in sorted_idx]
|
194 |
+
landms = np.asarray(tmp)
|
195 |
+
'''
|
196 |
+
|
197 |
+
landms = landms.reshape((-1, 5, 2))
|
198 |
+
landms = landms.transpose((0, 2, 1))
|
199 |
+
landms = landms.reshape(-1, 10, )
|
200 |
+
return dets, landms
|
face_vid2vid/GPEN/retinaface/utils/__init__.py
ADDED
File without changes
|
face_vid2vid/GPEN/retinaface/utils/box_utils.py
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
|
5 |
+
def point_form(boxes):
|
6 |
+
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
|
7 |
+
representation for comparison to point form ground truth data.
|
8 |
+
Args:
|
9 |
+
boxes: (tensor) center-size default boxes from priorbox layers.
|
10 |
+
Return:
|
11 |
+
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes.
|
12 |
+
"""
|
13 |
+
return torch.cat((boxes[:, :2] - boxes[:, 2:]/2, # xmin, ymin
|
14 |
+
boxes[:, :2] + boxes[:, 2:]/2), 1) # xmax, ymax
|
15 |
+
|
16 |
+
|
17 |
+
def center_size(boxes):
|
18 |
+
""" Convert prior_boxes to (cx, cy, w, h)
|
19 |
+
representation for comparison to center-size form ground truth data.
|
20 |
+
Args:
|
21 |
+
boxes: (tensor) point_form boxes
|
22 |
+
Return:
|
23 |
+
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes.
|
24 |
+
"""
|
25 |
+
return torch.cat((boxes[:, 2:] + boxes[:, :2])/2, # cx, cy
|
26 |
+
boxes[:, 2:] - boxes[:, :2], 1) # w, h
|
27 |
+
|
28 |
+
|
29 |
+
def intersect(box_a, box_b):
|
30 |
+
""" We resize both tensors to [A,B,2] without new malloc:
|
31 |
+
[A,2] -> [A,1,2] -> [A,B,2]
|
32 |
+
[B,2] -> [1,B,2] -> [A,B,2]
|
33 |
+
Then we compute the area of intersect between box_a and box_b.
|
34 |
+
Args:
|
35 |
+
box_a: (tensor) bounding boxes, Shape: [A,4].
|
36 |
+
box_b: (tensor) bounding boxes, Shape: [B,4].
|
37 |
+
Return:
|
38 |
+
(tensor) intersection area, Shape: [A,B].
|
39 |
+
"""
|
40 |
+
A = box_a.size(0)
|
41 |
+
B = box_b.size(0)
|
42 |
+
max_xy = torch.min(box_a[:, 2:].unsqueeze(1).expand(A, B, 2),
|
43 |
+
box_b[:, 2:].unsqueeze(0).expand(A, B, 2))
|
44 |
+
min_xy = torch.max(box_a[:, :2].unsqueeze(1).expand(A, B, 2),
|
45 |
+
box_b[:, :2].unsqueeze(0).expand(A, B, 2))
|
46 |
+
inter = torch.clamp((max_xy - min_xy), min=0)
|
47 |
+
return inter[:, :, 0] * inter[:, :, 1]
|
48 |
+
|
49 |
+
|
50 |
+
def jaccard(box_a, box_b):
|
51 |
+
"""Compute the jaccard overlap of two sets of boxes. The jaccard overlap
|
52 |
+
is simply the intersection over union of two boxes. Here we operate on
|
53 |
+
ground truth boxes and default boxes.
|
54 |
+
E.g.:
|
55 |
+
A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
|
56 |
+
Args:
|
57 |
+
box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
|
58 |
+
box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
|
59 |
+
Return:
|
60 |
+
jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
|
61 |
+
"""
|
62 |
+
inter = intersect(box_a, box_b)
|
63 |
+
area_a = ((box_a[:, 2]-box_a[:, 0]) *
|
64 |
+
(box_a[:, 3]-box_a[:, 1])).unsqueeze(1).expand_as(inter) # [A,B]
|
65 |
+
area_b = ((box_b[:, 2]-box_b[:, 0]) *
|
66 |
+
(box_b[:, 3]-box_b[:, 1])).unsqueeze(0).expand_as(inter) # [A,B]
|
67 |
+
union = area_a + area_b - inter
|
68 |
+
return inter / union # [A,B]
|
69 |
+
|
70 |
+
|
71 |
+
def matrix_iou(a, b):
|
72 |
+
"""
|
73 |
+
return iou of a and b, numpy version for data augenmentation
|
74 |
+
"""
|
75 |
+
lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
|
76 |
+
rb = np.minimum(a[:, np.newaxis, 2:], b[:, 2:])
|
77 |
+
|
78 |
+
area_i = np.prod(rb - lt, axis=2) * (lt < rb).all(axis=2)
|
79 |
+
area_a = np.prod(a[:, 2:] - a[:, :2], axis=1)
|
80 |
+
area_b = np.prod(b[:, 2:] - b[:, :2], axis=1)
|
81 |
+
return area_i / (area_a[:, np.newaxis] + area_b - area_i)
|
82 |
+
|
83 |
+
|
84 |
+
def matrix_iof(a, b):
|
85 |
+
"""
|
86 |
+
return iof of a and b, numpy version for data augenmentation
|
87 |
+
"""
|
88 |
+
lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
|
89 |
+
rb = np.minimum(a[:, np.newaxis, 2:], b[:, 2:])
|
90 |
+
|
91 |
+
area_i = np.prod(rb - lt, axis=2) * (lt < rb).all(axis=2)
|
92 |
+
area_a = np.prod(a[:, 2:] - a[:, :2], axis=1)
|
93 |
+
return area_i / np.maximum(area_a[:, np.newaxis], 1)
|
94 |
+
|
95 |
+
|
96 |
+
def match(threshold, truths, priors, variances, labels, landms, loc_t, conf_t, landm_t, idx):
|
97 |
+
"""Match each prior box with the ground truth box of the highest jaccard
|
98 |
+
overlap, encode the bounding boxes, then return the matched indices
|
99 |
+
corresponding to both confidence and location preds.
|
100 |
+
Args:
|
101 |
+
threshold: (float) The overlap threshold used when mathing boxes.
|
102 |
+
truths: (tensor) Ground truth boxes, Shape: [num_obj, 4].
|
103 |
+
priors: (tensor) Prior boxes from priorbox layers, Shape: [n_priors,4].
|
104 |
+
variances: (tensor) Variances corresponding to each prior coord,
|
105 |
+
Shape: [num_priors, 4].
|
106 |
+
labels: (tensor) All the class labels for the image, Shape: [num_obj].
|
107 |
+
landms: (tensor) Ground truth landms, Shape [num_obj, 10].
|
108 |
+
loc_t: (tensor) Tensor to be filled w/ endcoded location targets.
|
109 |
+
conf_t: (tensor) Tensor to be filled w/ matched indices for conf preds.
|
110 |
+
landm_t: (tensor) Tensor to be filled w/ endcoded landm targets.
|
111 |
+
idx: (int) current batch index
|
112 |
+
Return:
|
113 |
+
The matched indices corresponding to 1)location 2)confidence 3)landm preds.
|
114 |
+
"""
|
115 |
+
# jaccard index
|
116 |
+
overlaps = jaccard(
|
117 |
+
truths,
|
118 |
+
point_form(priors)
|
119 |
+
)
|
120 |
+
# (Bipartite Matching)
|
121 |
+
# [1,num_objects] best prior for each ground truth
|
122 |
+
best_prior_overlap, best_prior_idx = overlaps.max(1, keepdim=True)
|
123 |
+
|
124 |
+
# ignore hard gt
|
125 |
+
valid_gt_idx = best_prior_overlap[:, 0] >= 0.2
|
126 |
+
best_prior_idx_filter = best_prior_idx[valid_gt_idx, :]
|
127 |
+
if best_prior_idx_filter.shape[0] <= 0:
|
128 |
+
loc_t[idx] = 0
|
129 |
+
conf_t[idx] = 0
|
130 |
+
return
|
131 |
+
|
132 |
+
# [1,num_priors] best ground truth for each prior
|
133 |
+
best_truth_overlap, best_truth_idx = overlaps.max(0, keepdim=True)
|
134 |
+
best_truth_idx.squeeze_(0)
|
135 |
+
best_truth_overlap.squeeze_(0)
|
136 |
+
best_prior_idx.squeeze_(1)
|
137 |
+
best_prior_idx_filter.squeeze_(1)
|
138 |
+
best_prior_overlap.squeeze_(1)
|
139 |
+
best_truth_overlap.index_fill_(0, best_prior_idx_filter, 2) # ensure best prior
|
140 |
+
# TODO refactor: index best_prior_idx with long tensor
|
141 |
+
# ensure every gt matches with its prior of max overlap
|
142 |
+
for j in range(best_prior_idx.size(0)): # 判别此anchor是预测哪一个boxes
|
143 |
+
best_truth_idx[best_prior_idx[j]] = j
|
144 |
+
matches = truths[best_truth_idx] # Shape: [num_priors,4] 此处为每一个anchor对应的bbox取出来
|
145 |
+
conf = labels[best_truth_idx] # Shape: [num_priors] 此处为每一个anchor对应的label取出来
|
146 |
+
conf[best_truth_overlap < threshold] = 0 # label as background overlap<0.35的全部作为负样本
|
147 |
+
loc = encode(matches, priors, variances)
|
148 |
+
|
149 |
+
matches_landm = landms[best_truth_idx]
|
150 |
+
landm = encode_landm(matches_landm, priors, variances)
|
151 |
+
loc_t[idx] = loc # [num_priors,4] encoded offsets to learn
|
152 |
+
conf_t[idx] = conf # [num_priors] top class label for each prior
|
153 |
+
landm_t[idx] = landm
|
154 |
+
|
155 |
+
|
156 |
+
def encode(matched, priors, variances):
|
157 |
+
"""Encode the variances from the priorbox layers into the ground truth boxes
|
158 |
+
we have matched (based on jaccard overlap) with the prior boxes.
|
159 |
+
Args:
|
160 |
+
matched: (tensor) Coords of ground truth for each prior in point-form
|
161 |
+
Shape: [num_priors, 4].
|
162 |
+
priors: (tensor) Prior boxes in center-offset form
|
163 |
+
Shape: [num_priors,4].
|
164 |
+
variances: (list[float]) Variances of priorboxes
|
165 |
+
Return:
|
166 |
+
encoded boxes (tensor), Shape: [num_priors, 4]
|
167 |
+
"""
|
168 |
+
|
169 |
+
# dist b/t match center and prior's center
|
170 |
+
g_cxcy = (matched[:, :2] + matched[:, 2:])/2 - priors[:, :2]
|
171 |
+
# encode variance
|
172 |
+
g_cxcy /= (variances[0] * priors[:, 2:])
|
173 |
+
# match wh / prior wh
|
174 |
+
g_wh = (matched[:, 2:] - matched[:, :2]) / priors[:, 2:]
|
175 |
+
g_wh = torch.log(g_wh) / variances[1]
|
176 |
+
# return target for smooth_l1_loss
|
177 |
+
return torch.cat([g_cxcy, g_wh], 1) # [num_priors,4]
|
178 |
+
|
179 |
+
def encode_landm(matched, priors, variances):
|
180 |
+
"""Encode the variances from the priorbox layers into the ground truth boxes
|
181 |
+
we have matched (based on jaccard overlap) with the prior boxes.
|
182 |
+
Args:
|
183 |
+
matched: (tensor) Coords of ground truth for each prior in point-form
|
184 |
+
Shape: [num_priors, 10].
|
185 |
+
priors: (tensor) Prior boxes in center-offset form
|
186 |
+
Shape: [num_priors,4].
|
187 |
+
variances: (list[float]) Variances of priorboxes
|
188 |
+
Return:
|
189 |
+
encoded landm (tensor), Shape: [num_priors, 10]
|
190 |
+
"""
|
191 |
+
|
192 |
+
# dist b/t match center and prior's center
|
193 |
+
matched = torch.reshape(matched, (matched.size(0), 5, 2))
|
194 |
+
priors_cx = priors[:, 0].unsqueeze(1).expand(matched.size(0), 5).unsqueeze(2)
|
195 |
+
priors_cy = priors[:, 1].unsqueeze(1).expand(matched.size(0), 5).unsqueeze(2)
|
196 |
+
priors_w = priors[:, 2].unsqueeze(1).expand(matched.size(0), 5).unsqueeze(2)
|
197 |
+
priors_h = priors[:, 3].unsqueeze(1).expand(matched.size(0), 5).unsqueeze(2)
|
198 |
+
priors = torch.cat([priors_cx, priors_cy, priors_w, priors_h], dim=2)
|
199 |
+
g_cxcy = matched[:, :, :2] - priors[:, :, :2]
|
200 |
+
# encode variance
|
201 |
+
g_cxcy /= (variances[0] * priors[:, :, 2:])
|
202 |
+
# g_cxcy /= priors[:, :, 2:]
|
203 |
+
g_cxcy = g_cxcy.reshape(g_cxcy.size(0), -1)
|
204 |
+
# return target for smooth_l1_loss
|
205 |
+
return g_cxcy
|
206 |
+
|
207 |
+
|
208 |
+
# Adapted from https://github.com/Hakuyume/chainer-ssd
|
209 |
+
def decode(loc, priors, variances):
|
210 |
+
"""Decode locations from predictions using priors to undo
|
211 |
+
the encoding we did for offset regression at train time.
|
212 |
+
Args:
|
213 |
+
loc (tensor): location predictions for loc layers,
|
214 |
+
Shape: [num_priors,4]
|
215 |
+
priors (tensor): Prior boxes in center-offset form.
|
216 |
+
Shape: [num_priors,4].
|
217 |
+
variances: (list[float]) Variances of priorboxes
|
218 |
+
Return:
|
219 |
+
decoded bounding box predictions
|
220 |
+
"""
|
221 |
+
|
222 |
+
boxes = torch.cat((
|
223 |
+
priors[:, :2] + loc[:, :2] * variances[0] * priors[:, 2:],
|
224 |
+
priors[:, 2:] * torch.exp(loc[:, 2:] * variances[1])), 1)
|
225 |
+
boxes[:, :2] -= boxes[:, 2:] / 2
|
226 |
+
boxes[:, 2:] += boxes[:, :2]
|
227 |
+
return boxes
|
228 |
+
|
229 |
+
def decode_landm(pre, priors, variances):
|
230 |
+
"""Decode landm from predictions using priors to undo
|
231 |
+
the encoding we did for offset regression at train time.
|
232 |
+
Args:
|
233 |
+
pre (tensor): landm predictions for loc layers,
|
234 |
+
Shape: [num_priors,10]
|
235 |
+
priors (tensor): Prior boxes in center-offset form.
|
236 |
+
Shape: [num_priors,4].
|
237 |
+
variances: (list[float]) Variances of priorboxes
|
238 |
+
Return:
|
239 |
+
decoded landm predictions
|
240 |
+
"""
|
241 |
+
landms = torch.cat((priors[:, :2] + pre[:, :2] * variances[0] * priors[:, 2:],
|
242 |
+
priors[:, :2] + pre[:, 2:4] * variances[0] * priors[:, 2:],
|
243 |
+
priors[:, :2] + pre[:, 4:6] * variances[0] * priors[:, 2:],
|
244 |
+
priors[:, :2] + pre[:, 6:8] * variances[0] * priors[:, 2:],
|
245 |
+
priors[:, :2] + pre[:, 8:10] * variances[0] * priors[:, 2:],
|
246 |
+
), dim=1)
|
247 |
+
return landms
|
248 |
+
|
249 |
+
|
250 |
+
def log_sum_exp(x):
|
251 |
+
"""Utility function for computing log_sum_exp while determining
|
252 |
+
This will be used to determine unaveraged confidence loss across
|
253 |
+
all examples in a batch.
|
254 |
+
Args:
|
255 |
+
x (Variable(tensor)): conf_preds from conf layers
|
256 |
+
"""
|
257 |
+
x_max = x.data.max()
|
258 |
+
return torch.log(torch.sum(torch.exp(x-x_max), 1, keepdim=True)) + x_max
|
259 |
+
|
260 |
+
|
261 |
+
# Original author: Francisco Massa:
|
262 |
+
# https://github.com/fmassa/object-detection.torch
|
263 |
+
# Ported to PyTorch by Max deGroot (02/01/2017)
|
264 |
+
def nms(boxes, scores, overlap=0.5, top_k=200):
|
265 |
+
"""Apply non-maximum suppression at test time to avoid detecting too many
|
266 |
+
overlapping bounding boxes for a given object.
|
267 |
+
Args:
|
268 |
+
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].
|
269 |
+
scores: (tensor) The class predscores for the img, Shape:[num_priors].
|
270 |
+
overlap: (float) The overlap thresh for suppressing unnecessary boxes.
|
271 |
+
top_k: (int) The Maximum number of box preds to consider.
|
272 |
+
Return:
|
273 |
+
The indices of the kept boxes with respect to num_priors.
|
274 |
+
"""
|
275 |
+
|
276 |
+
keep = torch.Tensor(scores.size(0)).fill_(0).long()
|
277 |
+
if boxes.numel() == 0:
|
278 |
+
return keep
|
279 |
+
x1 = boxes[:, 0]
|
280 |
+
y1 = boxes[:, 1]
|
281 |
+
x2 = boxes[:, 2]
|
282 |
+
y2 = boxes[:, 3]
|
283 |
+
area = torch.mul(x2 - x1, y2 - y1)
|
284 |
+
v, idx = scores.sort(0) # sort in ascending order
|
285 |
+
# I = I[v >= 0.01]
|
286 |
+
idx = idx[-top_k:] # indices of the top-k largest vals
|
287 |
+
xx1 = boxes.new()
|
288 |
+
yy1 = boxes.new()
|
289 |
+
xx2 = boxes.new()
|
290 |
+
yy2 = boxes.new()
|
291 |
+
w = boxes.new()
|
292 |
+
h = boxes.new()
|
293 |
+
|
294 |
+
# keep = torch.Tensor()
|
295 |
+
count = 0
|
296 |
+
while idx.numel() > 0:
|
297 |
+
i = idx[-1] # index of current largest val
|
298 |
+
# keep.append(i)
|
299 |
+
keep[count] = i
|
300 |
+
count += 1
|
301 |
+
if idx.size(0) == 1:
|
302 |
+
break
|
303 |
+
idx = idx[:-1] # remove kept element from view
|
304 |
+
# load bboxes of next highest vals
|
305 |
+
torch.index_select(x1, 0, idx, out=xx1)
|
306 |
+
torch.index_select(y1, 0, idx, out=yy1)
|
307 |
+
torch.index_select(x2, 0, idx, out=xx2)
|
308 |
+
torch.index_select(y2, 0, idx, out=yy2)
|
309 |
+
# store element-wise max with next highest score
|
310 |
+
xx1 = torch.clamp(xx1, min=x1[i])
|
311 |
+
yy1 = torch.clamp(yy1, min=y1[i])
|
312 |
+
xx2 = torch.clamp(xx2, max=x2[i])
|
313 |
+
yy2 = torch.clamp(yy2, max=y2[i])
|
314 |
+
w.resize_as_(xx2)
|
315 |
+
h.resize_as_(yy2)
|
316 |
+
w = xx2 - xx1
|
317 |
+
h = yy2 - yy1
|
318 |
+
# check sizes of xx1 and xx2.. after each iteration
|
319 |
+
w = torch.clamp(w, min=0.0)
|
320 |
+
h = torch.clamp(h, min=0.0)
|
321 |
+
inter = w*h
|
322 |
+
# IoU = i / (area(a) + area(b) - i)
|
323 |
+
rem_areas = torch.index_select(area, 0, idx) # load remaining areas)
|
324 |
+
union = (rem_areas - inter) + area[i]
|
325 |
+
IoU = inter/union # store result in iou
|
326 |
+
# keep only elements with an IoU <= overlap
|
327 |
+
idx = idx[IoU.le(overlap)]
|
328 |
+
return keep, count
|
329 |
+
|
330 |
+
|
face_vid2vid/GPEN/retinaface/utils/nms/__init__.py
ADDED
File without changes
|
face_vid2vid/GPEN/retinaface/utils/nms/py_cpu_nms.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# --------------------------------------------------------
|
2 |
+
# Fast R-CNN
|
3 |
+
# Copyright (c) 2015 Microsoft
|
4 |
+
# Licensed under The MIT License [see LICENSE for details]
|
5 |
+
# Written by Ross Girshick
|
6 |
+
# --------------------------------------------------------
|
7 |
+
|
8 |
+
import numpy as np
|
9 |
+
|
10 |
+
def py_cpu_nms(dets, thresh):
|
11 |
+
"""Pure Python NMS baseline."""
|
12 |
+
x1 = dets[:, 0]
|
13 |
+
y1 = dets[:, 1]
|
14 |
+
x2 = dets[:, 2]
|
15 |
+
y2 = dets[:, 3]
|
16 |
+
scores = dets[:, 4]
|
17 |
+
|
18 |
+
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
|
19 |
+
order = scores.argsort()[::-1]
|
20 |
+
|
21 |
+
keep = []
|
22 |
+
while order.size > 0:
|
23 |
+
i = order[0]
|
24 |
+
keep.append(i)
|
25 |
+
xx1 = np.maximum(x1[i], x1[order[1:]])
|
26 |
+
yy1 = np.maximum(y1[i], y1[order[1:]])
|
27 |
+
xx2 = np.minimum(x2[i], x2[order[1:]])
|
28 |
+
yy2 = np.minimum(y2[i], y2[order[1:]])
|
29 |
+
|
30 |
+
w = np.maximum(0.0, xx2 - xx1 + 1)
|
31 |
+
h = np.maximum(0.0, yy2 - yy1 + 1)
|
32 |
+
inter = w * h
|
33 |
+
ovr = inter / (areas[i] + areas[order[1:]] - inter)
|
34 |
+
|
35 |
+
inds = np.where(ovr <= thresh)[0]
|
36 |
+
order = order[inds + 1]
|
37 |
+
|
38 |
+
return keep
|
face_vid2vid/GPEN/retinaface/utils/timer.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# --------------------------------------------------------
|
2 |
+
# Fast R-CNN
|
3 |
+
# Copyright (c) 2015 Microsoft
|
4 |
+
# Licensed under The MIT License [see LICENSE for details]
|
5 |
+
# Written by Ross Girshick
|
6 |
+
# --------------------------------------------------------
|
7 |
+
|
8 |
+
import time
|
9 |
+
|
10 |
+
|
11 |
+
class Timer(object):
|
12 |
+
"""A simple timer."""
|
13 |
+
def __init__(self):
|
14 |
+
self.total_time = 0.
|
15 |
+
self.calls = 0
|
16 |
+
self.start_time = 0.
|
17 |
+
self.diff = 0.
|
18 |
+
self.average_time = 0.
|
19 |
+
|
20 |
+
def tic(self):
|
21 |
+
# using time.time instead of time.clock because time time.clock
|
22 |
+
# does not normalize for multithreading
|
23 |
+
self.start_time = time.time()
|
24 |
+
|
25 |
+
def toc(self, average=True):
|
26 |
+
self.diff = time.time() - self.start_time
|
27 |
+
self.total_time += self.diff
|
28 |
+
self.calls += 1
|
29 |
+
self.average_time = self.total_time / self.calls
|
30 |
+
if average:
|
31 |
+
return self.average_time
|
32 |
+
else:
|
33 |
+
return self.diff
|
34 |
+
|
35 |
+
def clear(self):
|
36 |
+
self.total_time = 0.
|
37 |
+
self.calls = 0
|
38 |
+
self.start_time = 0.
|
39 |
+
self.diff = 0.
|
40 |
+
self.average_time = 0.
|
face_vid2vid/GPEN/sr_model/arch_util.py
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import math
|
2 |
+
import torch
|
3 |
+
from torch import nn as nn
|
4 |
+
from torch.nn import functional as F
|
5 |
+
from torch.nn import init as init
|
6 |
+
from torch.nn.modules.batchnorm import _BatchNorm
|
7 |
+
|
8 |
+
@torch.no_grad()
|
9 |
+
def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs):
|
10 |
+
"""Initialize network weights.
|
11 |
+
|
12 |
+
Args:
|
13 |
+
module_list (list[nn.Module] | nn.Module): Modules to be initialized.
|
14 |
+
scale (float): Scale initialized weights, especially for residual
|
15 |
+
blocks. Default: 1.
|
16 |
+
bias_fill (float): The value to fill bias. Default: 0
|
17 |
+
kwargs (dict): Other arguments for initialization function.
|
18 |
+
"""
|
19 |
+
if not isinstance(module_list, list):
|
20 |
+
module_list = [module_list]
|
21 |
+
for module in module_list:
|
22 |
+
for m in module.modules():
|
23 |
+
if isinstance(m, nn.Conv2d):
|
24 |
+
init.kaiming_normal_(m.weight, **kwargs)
|
25 |
+
m.weight.data *= scale
|
26 |
+
if m.bias is not None:
|
27 |
+
m.bias.data.fill_(bias_fill)
|
28 |
+
elif isinstance(m, nn.Linear):
|
29 |
+
init.kaiming_normal_(m.weight, **kwargs)
|
30 |
+
m.weight.data *= scale
|
31 |
+
if m.bias is not None:
|
32 |
+
m.bias.data.fill_(bias_fill)
|
33 |
+
elif isinstance(m, _BatchNorm):
|
34 |
+
init.constant_(m.weight, 1)
|
35 |
+
if m.bias is not None:
|
36 |
+
m.bias.data.fill_(bias_fill)
|
37 |
+
|
38 |
+
|
39 |
+
def make_layer(basic_block, num_basic_block, **kwarg):
|
40 |
+
"""Make layers by stacking the same blocks.
|
41 |
+
|
42 |
+
Args:
|
43 |
+
basic_block (nn.module): nn.module class for basic block.
|
44 |
+
num_basic_block (int): number of blocks.
|
45 |
+
|
46 |
+
Returns:
|
47 |
+
nn.Sequential: Stacked blocks in nn.Sequential.
|
48 |
+
"""
|
49 |
+
layers = []
|
50 |
+
for _ in range(num_basic_block):
|
51 |
+
layers.append(basic_block(**kwarg))
|
52 |
+
return nn.Sequential(*layers)
|
53 |
+
|
54 |
+
|
55 |
+
class ResidualBlockNoBN(nn.Module):
|
56 |
+
"""Residual block without BN.
|
57 |
+
|
58 |
+
It has a style of:
|
59 |
+
---Conv-ReLU-Conv-+-
|
60 |
+
|________________|
|
61 |
+
|
62 |
+
Args:
|
63 |
+
num_feat (int): Channel number of intermediate features.
|
64 |
+
Default: 64.
|
65 |
+
res_scale (float): Residual scale. Default: 1.
|
66 |
+
pytorch_init (bool): If set to True, use pytorch default init,
|
67 |
+
otherwise, use default_init_weights. Default: False.
|
68 |
+
"""
|
69 |
+
|
70 |
+
def __init__(self, num_feat=64, res_scale=1, pytorch_init=False):
|
71 |
+
super(ResidualBlockNoBN, self).__init__()
|
72 |
+
self.res_scale = res_scale
|
73 |
+
self.conv1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1, bias=True)
|
74 |
+
self.conv2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1, bias=True)
|
75 |
+
self.relu = nn.ReLU(inplace=True)
|
76 |
+
|
77 |
+
if not pytorch_init:
|
78 |
+
default_init_weights([self.conv1, self.conv2], 0.1)
|
79 |
+
|
80 |
+
def forward(self, x):
|
81 |
+
identity = x
|
82 |
+
out = self.conv2(self.relu(self.conv1(x)))
|
83 |
+
return identity + out * self.res_scale
|
84 |
+
|
85 |
+
|
86 |
+
class Upsample(nn.Sequential):
|
87 |
+
"""Upsample module.
|
88 |
+
|
89 |
+
Args:
|
90 |
+
scale (int): Scale factor. Supported scales: 2^n and 3.
|
91 |
+
num_feat (int): Channel number of intermediate features.
|
92 |
+
"""
|
93 |
+
|
94 |
+
def __init__(self, scale, num_feat):
|
95 |
+
m = []
|
96 |
+
if (scale & (scale - 1)) == 0: # scale = 2^n
|
97 |
+
for _ in range(int(math.log(scale, 2))):
|
98 |
+
m.append(nn.Conv2d(num_feat, 4 * num_feat, 3, 1, 1))
|
99 |
+
m.append(nn.PixelShuffle(2))
|
100 |
+
elif scale == 3:
|
101 |
+
m.append(nn.Conv2d(num_feat, 9 * num_feat, 3, 1, 1))
|
102 |
+
m.append(nn.PixelShuffle(3))
|
103 |
+
else:
|
104 |
+
raise ValueError(f'scale {scale} is not supported. '
|
105 |
+
'Supported scales: 2^n and 3.')
|
106 |
+
super(Upsample, self).__init__(*m)
|
107 |
+
|
108 |
+
# TODO: may write a cpp file
|
109 |
+
def pixel_unshuffle(x, scale):
|
110 |
+
""" Pixel unshuffle.
|
111 |
+
|
112 |
+
Args:
|
113 |
+
x (Tensor): Input feature with shape (b, c, hh, hw).
|
114 |
+
scale (int): Downsample ratio.
|
115 |
+
|
116 |
+
Returns:
|
117 |
+
Tensor: the pixel unshuffled feature.
|
118 |
+
"""
|
119 |
+
b, c, hh, hw = x.size()
|
120 |
+
out_channel = c * (scale**2)
|
121 |
+
assert hh % scale == 0 and hw % scale == 0
|
122 |
+
h = hh // scale
|
123 |
+
w = hw // scale
|
124 |
+
x_view = x.view(b, c, h, scale, w, scale)
|
125 |
+
return x_view.permute(0, 1, 3, 5, 2, 4).reshape(b, out_channel, h, w)
|
face_vid2vid/GPEN/sr_model/real_esrnet.py
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import torch
|
3 |
+
import numpy as np
|
4 |
+
from rrdbnet_arch import RRDBNet
|
5 |
+
from torch.nn import functional as F
|
6 |
+
import torch
|
7 |
+
|
8 |
+
|
9 |
+
class RealESRNet(object):
|
10 |
+
def __init__(self, base_dir=os.path.dirname(__file__), model=None, scale=2):
|
11 |
+
self.base_dir = base_dir
|
12 |
+
self.scale = scale
|
13 |
+
self.load_srmodel(base_dir, model)
|
14 |
+
self.srmodel_trt = None
|
15 |
+
|
16 |
+
def load_srmodel(self, base_dir, model):
|
17 |
+
self.scale = 2 if "x2" in model else 4 if "x4" in model else -1
|
18 |
+
if self.scale == -1:
|
19 |
+
raise Exception("Scale not supported")
|
20 |
+
self.srmodel = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=32, num_block=23, num_grow_ch=32, scale=self.scale)
|
21 |
+
if model is None:
|
22 |
+
loadnet = torch.load(os.path.join(self.base_dir, 'weights', 'realesrnet_x2.pth'))
|
23 |
+
else:
|
24 |
+
loadnet = torch.load(os.path.join(self.base_dir, 'weights', model+'.pth'))
|
25 |
+
self.srmodel.load_state_dict(loadnet['params_ema'], strict=True)
|
26 |
+
self.srmodel.eval()
|
27 |
+
self.srmodel = self.srmodel.cuda()
|
28 |
+
|
29 |
+
def build_trt(self, img):
|
30 |
+
img = img.astype(np.float32) / 255.
|
31 |
+
img = torch.from_numpy(np.transpose(img[:, :, [2, 1, 0]], (2, 0, 1))).float()
|
32 |
+
img = img.unsqueeze(0).cuda()
|
33 |
+
print('building trt model srmodel')
|
34 |
+
from torch2trt import torch2trt
|
35 |
+
self.srmodel_trt = torch2trt(self.srmodel, [img], fp16_mode=True)
|
36 |
+
print('sucessfully built')
|
37 |
+
del self.srmodel
|
38 |
+
|
39 |
+
def process_trt(self, img):
|
40 |
+
img = img.astype(np.float32) / 255.
|
41 |
+
img = torch.from_numpy(np.transpose(img[:, :, [2, 1, 0]], (2, 0, 1))).float()
|
42 |
+
img = img.unsqueeze(0).cuda()
|
43 |
+
|
44 |
+
if self.scale == 2:
|
45 |
+
mod_scale = 2
|
46 |
+
elif self.scale == 1:
|
47 |
+
mod_scale = 4
|
48 |
+
else:
|
49 |
+
mod_scale = None
|
50 |
+
if mod_scale is not None:
|
51 |
+
h_pad, w_pad = 0, 0
|
52 |
+
_, _, h, w = img.size()
|
53 |
+
if (h % mod_scale != 0):
|
54 |
+
h_pad = (mod_scale - h % mod_scale)
|
55 |
+
if (w % mod_scale != 0):
|
56 |
+
w_pad = (mod_scale - w % mod_scale)
|
57 |
+
img = F.pad(img, (0, w_pad, 0, h_pad), 'reflect')
|
58 |
+
try:
|
59 |
+
with torch.no_grad():
|
60 |
+
output = self.srmodel_trt(img)
|
61 |
+
# remove extra pad
|
62 |
+
if mod_scale is not None:
|
63 |
+
_, _, h, w = output.size()
|
64 |
+
output = output[:, :, 0:h - h_pad, 0:w - w_pad]
|
65 |
+
output = output.data.squeeze().float().cpu().clamp_(0, 1).numpy()
|
66 |
+
output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
|
67 |
+
output = (output * 255.0).round().astype(np.uint8)
|
68 |
+
|
69 |
+
return output
|
70 |
+
except:
|
71 |
+
return None
|
72 |
+
|
73 |
+
def process(self, img):
|
74 |
+
img = img.astype(np.float32) / 255.
|
75 |
+
img = torch.from_numpy(np.transpose(img[:, :, [2, 1, 0]], (2, 0, 1))).float()
|
76 |
+
img = img.unsqueeze(0).cuda()
|
77 |
+
# print(img.shape)
|
78 |
+
|
79 |
+
if self.scale == 2:
|
80 |
+
mod_scale = 2
|
81 |
+
elif self.scale == 1:
|
82 |
+
mod_scale = 4
|
83 |
+
else:
|
84 |
+
mod_scale = None
|
85 |
+
if mod_scale is not None:
|
86 |
+
h_pad, w_pad = 0, 0
|
87 |
+
_, _, h, w = img.size()
|
88 |
+
if (h % mod_scale != 0):
|
89 |
+
h_pad = (mod_scale - h % mod_scale)
|
90 |
+
if (w % mod_scale != 0):
|
91 |
+
w_pad = (mod_scale - w % mod_scale)
|
92 |
+
img = F.pad(img, (0, w_pad, 0, h_pad), 'reflect')
|
93 |
+
try:
|
94 |
+
with torch.no_grad():
|
95 |
+
output = self.srmodel(img)
|
96 |
+
# remove extra pad
|
97 |
+
if mod_scale is not None:
|
98 |
+
_, _, h, w = output.size()
|
99 |
+
output = output[:, :, 0:h - h_pad, 0:w - w_pad]
|
100 |
+
output = output.data.squeeze().float().cpu().clamp_(0, 1).numpy()
|
101 |
+
output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
|
102 |
+
output = (output * 255.0).round().astype(np.uint8)
|
103 |
+
|
104 |
+
return output
|
105 |
+
except:
|
106 |
+
return None
|
107 |
+
|
face_vid2vid/GPEN/sr_model/rrdbnet_arch.py
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from torch import nn as nn
|
3 |
+
from torch.nn import functional as F
|
4 |
+
|
5 |
+
from arch_util import default_init_weights, make_layer, pixel_unshuffle
|
6 |
+
|
7 |
+
|
8 |
+
class ResidualDenseBlock(nn.Module):
|
9 |
+
"""Residual Dense Block.
|
10 |
+
|
11 |
+
Used in RRDB block in ESRGAN.
|
12 |
+
|
13 |
+
Args:
|
14 |
+
num_feat (int): Channel number of intermediate features.
|
15 |
+
num_grow_ch (int): Channels for each growth.
|
16 |
+
"""
|
17 |
+
|
18 |
+
def __init__(self, num_feat=64, num_grow_ch=32):
|
19 |
+
super(ResidualDenseBlock, self).__init__()
|
20 |
+
self.conv1 = nn.Conv2d(num_feat, num_grow_ch, 3, 1, 1)
|
21 |
+
self.conv2 = nn.Conv2d(num_feat + num_grow_ch, num_grow_ch, 3, 1, 1)
|
22 |
+
self.conv3 = nn.Conv2d(num_feat + 2 * num_grow_ch, num_grow_ch, 3, 1, 1)
|
23 |
+
self.conv4 = nn.Conv2d(num_feat + 3 * num_grow_ch, num_grow_ch, 3, 1, 1)
|
24 |
+
self.conv5 = nn.Conv2d(num_feat + 4 * num_grow_ch, num_feat, 3, 1, 1)
|
25 |
+
|
26 |
+
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
|
27 |
+
|
28 |
+
# initialization
|
29 |
+
default_init_weights([self.conv1, self.conv2, self.conv3, self.conv4, self.conv5], 0.1)
|
30 |
+
|
31 |
+
def forward(self, x):
|
32 |
+
x1 = self.lrelu(self.conv1(x))
|
33 |
+
x2 = self.lrelu(self.conv2(torch.cat((x, x1), 1)))
|
34 |
+
x3 = self.lrelu(self.conv3(torch.cat((x, x1, x2), 1)))
|
35 |
+
x4 = self.lrelu(self.conv4(torch.cat((x, x1, x2, x3), 1)))
|
36 |
+
x5 = self.conv5(torch.cat((x, x1, x2, x3, x4), 1))
|
37 |
+
# Emperically, we use 0.2 to scale the residual for better performance
|
38 |
+
return x5 * 0.2 + x
|
39 |
+
|
40 |
+
|
41 |
+
class RRDB(nn.Module):
|
42 |
+
"""Residual in Residual Dense Block.
|
43 |
+
|
44 |
+
Used in RRDB-Net in ESRGAN.
|
45 |
+
|
46 |
+
Args:
|
47 |
+
num_feat (int): Channel number of intermediate features.
|
48 |
+
num_grow_ch (int): Channels for each growth.
|
49 |
+
"""
|
50 |
+
|
51 |
+
def __init__(self, num_feat, num_grow_ch=32):
|
52 |
+
super(RRDB, self).__init__()
|
53 |
+
self.rdb1 = ResidualDenseBlock(num_feat, num_grow_ch)
|
54 |
+
self.rdb2 = ResidualDenseBlock(num_feat, num_grow_ch)
|
55 |
+
self.rdb3 = ResidualDenseBlock(num_feat, num_grow_ch)
|
56 |
+
|
57 |
+
def forward(self, x):
|
58 |
+
out = self.rdb1(x)
|
59 |
+
out = self.rdb2(out)
|
60 |
+
out = self.rdb3(out)
|
61 |
+
# Emperically, we use 0.2 to scale the residual for better performance
|
62 |
+
return out * 0.2 + x
|
63 |
+
|
64 |
+
class RRDBNet(nn.Module):
|
65 |
+
"""Networks consisting of Residual in Residual Dense Block, which is used
|
66 |
+
in ESRGAN.
|
67 |
+
|
68 |
+
ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks.
|
69 |
+
|
70 |
+
We extend ESRGAN for scale x2 and scale x1.
|
71 |
+
Note: This is one option for scale 1, scale 2 in RRDBNet.
|
72 |
+
We first employ the pixel-unshuffle (an inverse operation of pixelshuffle to reduce the spatial size
|
73 |
+
and enlarge the channel size before feeding inputs into the main ESRGAN architecture.
|
74 |
+
|
75 |
+
Args:
|
76 |
+
num_in_ch (int): Channel number of inputs.
|
77 |
+
num_out_ch (int): Channel number of outputs.
|
78 |
+
num_feat (int): Channel number of intermediate features.
|
79 |
+
Default: 64
|
80 |
+
num_block (int): Block number in the trunk network. Defaults: 23
|
81 |
+
num_grow_ch (int): Channels for each growth. Default: 32.
|
82 |
+
"""
|
83 |
+
|
84 |
+
def __init__(self, num_in_ch, num_out_ch, scale=4, num_feat=64, num_block=23, num_grow_ch=32):
|
85 |
+
super(RRDBNet, self).__init__()
|
86 |
+
self.scale = scale
|
87 |
+
if scale == 2:
|
88 |
+
num_in_ch = num_in_ch * 4
|
89 |
+
elif scale == 1:
|
90 |
+
num_in_ch = num_in_ch * 16
|
91 |
+
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
|
92 |
+
self.body = make_layer(RRDB, num_block, num_feat=num_feat, num_grow_ch=num_grow_ch)
|
93 |
+
self.conv_body = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
|
94 |
+
# upsample
|
95 |
+
self.conv_up1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
|
96 |
+
self.conv_up2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
|
97 |
+
self.conv_hr = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
|
98 |
+
self.conv_last = nn.Conv2d(num_feat, num_out_ch, 3, 1, 1)
|
99 |
+
|
100 |
+
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
|
101 |
+
|
102 |
+
def forward(self, x):
|
103 |
+
if self.scale == 2:
|
104 |
+
feat = pixel_unshuffle(x, scale=2)
|
105 |
+
elif self.scale == 1:
|
106 |
+
feat = pixel_unshuffle(x, scale=4)
|
107 |
+
else:
|
108 |
+
feat = x
|
109 |
+
feat = self.conv_first(feat)
|
110 |
+
body_feat = self.conv_body(self.body(feat))
|
111 |
+
feat = feat + body_feat
|
112 |
+
# upsample
|
113 |
+
feat = self.lrelu(self.conv_up1(F.interpolate(feat, scale_factor=2, mode='nearest')))
|
114 |
+
feat = self.lrelu(self.conv_up2(F.interpolate(feat, scale_factor=2, mode='nearest')))
|
115 |
+
out = self.conv_last(self.lrelu(self.conv_hr(feat)))
|
116 |
+
return out
|
face_vid2vid/LICENSE.md
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## creative commons
|
2 |
+
|
3 |
+
# Attribution-NonCommercial 4.0 International
|
4 |
+
|
5 |
+
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
6 |
+
|
7 |
+
### Using Creative Commons Public Licenses
|
8 |
+
|
9 |
+
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
|
10 |
+
|
11 |
+
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
|
12 |
+
|
13 |
+
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
|
14 |
+
|
15 |
+
## Creative Commons Attribution-NonCommercial 4.0 International Public License
|
16 |
+
|
17 |
+
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
18 |
+
|
19 |
+
### Section 1 – Definitions.
|
20 |
+
|
21 |
+
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
22 |
+
|
23 |
+
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
24 |
+
|
25 |
+
c. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
26 |
+
|
27 |
+
d. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
28 |
+
|
29 |
+
e. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
30 |
+
|
31 |
+
f. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
32 |
+
|
33 |
+
g. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
34 |
+
|
35 |
+
h. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
|
36 |
+
|
37 |
+
i. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
38 |
+
|
39 |
+
j. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
40 |
+
|
41 |
+
k. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
42 |
+
|
43 |
+
l. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
44 |
+
|
45 |
+
### Section 2 – Scope.
|
46 |
+
|
47 |
+
a. ___License grant.___
|
48 |
+
|
49 |
+
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
50 |
+
|
51 |
+
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
|
52 |
+
|
53 |
+
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
|
54 |
+
|
55 |
+
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
56 |
+
|
57 |
+
3. __Term.__ The term of this Public License is specified in Section 6(a).
|
58 |
+
|
59 |
+
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
60 |
+
|
61 |
+
5. __Downstream recipients.__
|
62 |
+
|
63 |
+
A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
64 |
+
|
65 |
+
B. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
66 |
+
|
67 |
+
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
68 |
+
|
69 |
+
b. ___Other rights.___
|
70 |
+
|
71 |
+
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
72 |
+
|
73 |
+
2. Patent and trademark rights are not licensed under this Public License.
|
74 |
+
|
75 |
+
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
|
76 |
+
|
77 |
+
### Section 3 – License Conditions.
|
78 |
+
|
79 |
+
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
80 |
+
|
81 |
+
a. ___Attribution.___
|
82 |
+
|
83 |
+
1. If You Share the Licensed Material (including in modified form), You must:
|
84 |
+
|
85 |
+
A. retain the following if it is supplied by the Licensor with the Licensed Material:
|
86 |
+
|
87 |
+
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
88 |
+
|
89 |
+
ii. a copyright notice;
|
90 |
+
|
91 |
+
iii. a notice that refers to this Public License;
|
92 |
+
|
93 |
+
iv. a notice that refers to the disclaimer of warranties;
|
94 |
+
|
95 |
+
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
96 |
+
|
97 |
+
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
98 |
+
|
99 |
+
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
100 |
+
|
101 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
102 |
+
|
103 |
+
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
104 |
+
|
105 |
+
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
|
106 |
+
|
107 |
+
### Section 4 – Sui Generis Database Rights.
|
108 |
+
|
109 |
+
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
110 |
+
|
111 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
|
112 |
+
|
113 |
+
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
114 |
+
|
115 |
+
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
116 |
+
|
117 |
+
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
118 |
+
|
119 |
+
### Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
120 |
+
|
121 |
+
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
|
122 |
+
|
123 |
+
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
|
124 |
+
|
125 |
+
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
126 |
+
|
127 |
+
### Section 6 – Term and Termination.
|
128 |
+
|
129 |
+
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
130 |
+
|
131 |
+
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
132 |
+
|
133 |
+
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
134 |
+
|
135 |
+
2. upon express reinstatement by the Licensor.
|
136 |
+
|
137 |
+
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
138 |
+
|
139 |
+
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
140 |
+
|
141 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
142 |
+
|
143 |
+
### Section 7 – Other Terms and Conditions.
|
144 |
+
|
145 |
+
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
146 |
+
|
147 |
+
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
148 |
+
|
149 |
+
### Section 8 – Interpretation.
|
150 |
+
|
151 |
+
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
152 |
+
|
153 |
+
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
154 |
+
|
155 |
+
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
156 |
+
|
157 |
+
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
158 |
+
|
159 |
+
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
|
160 |
+
>
|
161 |
+
> Creative Commons may be contacted at creativecommons.org
|
face_vid2vid/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# One-Shot Free-View Neural Talking Head Synthesis
|
2 |
+
Unofficial pytorch implementation of paper "One-Shot Free-View Neural Talking-Head Synthesis for Video Conferencing".
|
3 |
+
|
4 |
+
```Python 3.6``` and ```Pytorch 1.7``` are used.
|
5 |
+
|
6 |
+
|
7 |
+
Updates:
|
8 |
+
--------
|
9 |
+
```2021.11.05``` :
|
10 |
+
* <s>Replace Jacobian with the rotation matrix (Assuming J = R) to avoid estimating Jacobian.</s>
|
11 |
+
* Correct the rotation matrix.
|
12 |
+
|
13 |
+
```2021.11.17``` :
|
14 |
+
* Better Generator, better performance (models and checkpoints have been released).
|
15 |
+
|
16 |
+
Driving | Beta Version | FOMM | New Version:
|
17 |
+
|
18 |
+
|
19 |
+
https://user-images.githubusercontent.com/17874285/142828000-db7b324e-c2fd-4fdc-a272-04fb8adbc88a.mp4
|
20 |
+
|
21 |
+
|
22 |
+
--------
|
23 |
+
Driving | FOMM | Ours:
|
24 |
+

|
25 |
+
|
26 |
+
Free-View:
|
27 |
+

|
28 |
+
|
29 |
+
Train:
|
30 |
+
--------
|
31 |
+
```
|
32 |
+
python run.py --config config/vox-256.yaml --device_ids 0,1,2,3,4,5,6,7
|
33 |
+
```
|
34 |
+
|
35 |
+
Demo:
|
36 |
+
--------
|
37 |
+
```
|
38 |
+
python demo.py --config config/vox-256.yaml --checkpoint path/to/checkpoint --source_image path/to/source --driving_video path/to/driving --relative --adapt_scale --find_best_frame
|
39 |
+
```
|
40 |
+
free-view (e.g. yaw=20, pitch=roll=0):
|
41 |
+
```
|
42 |
+
python demo.py --config config/vox-256.yaml --checkpoint path/to/checkpoint --source_image path/to/source --driving_video path/to/driving --relative --adapt_scale --find_best_frame --free_view --yaw 20 --pitch 0 --roll 0
|
43 |
+
```
|
44 |
+
Note: run ```crop-video.py --inp driving_video.mp4``` first to get the cropping suggestion and crop the raw video.
|
45 |
+
|
46 |
+
Pretrained Model:
|
47 |
+
--------
|
48 |
+
|
49 |
+
Model | Train Set | Baidu Netdisk | Media Fire |
|
50 |
+
------- |------------ |----------- |-------- |
|
51 |
+
Vox-256-Beta| VoxCeleb-v1 | [Baidu](https://pan.baidu.com/s/1lLS4ArbK2yWelsL-EtwU8g) (PW: c0tc)| [MF](https://www.mediafire.com/folder/rw51an7tk7bh2/TalkingHead) |
|
52 |
+
Vox-256-New | VoxCeleb-v1 | - | [MF](https://www.mediafire.com/folder/fcvtkn21j57bb/TalkingHead_Update) |
|
53 |
+
Vox-512 | VoxCeleb-v2 | soon | soon |
|
54 |
+
|
55 |
+
Note:
|
56 |
+
1. <s>For now, the Beta Version is not well tuned.</s>
|
57 |
+
2. For free-view synthesis, it is recommended that Yaw, Pitch and Roll are within ±45°, ±20° and ±20° respectively.
|
58 |
+
3. Face Restoration algorithms ([GPEN](https://github.com/yangxy/GPEN)) can be used for post-processing to significantly improve the resolution.
|
59 |
+

|
60 |
+
|
61 |
+
|
62 |
+
Acknowlegement:
|
63 |
+
--------
|
64 |
+
Thanks to [NV](https://github.com/NVlabs/face-vid2vid), [AliaksandrSiarohin](https://github.com/AliaksandrSiarohin/first-order-model) and [DeepHeadPose](https://github.com/DriverDistraction/DeepHeadPose).
|
face_vid2vid/animate.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from tqdm import tqdm
|
3 |
+
|
4 |
+
import torch
|
5 |
+
from torch.utils.data import DataLoader
|
6 |
+
|
7 |
+
import imageio
|
8 |
+
from scipy.spatial import ConvexHull
|
9 |
+
import numpy as np
|
10 |
+
|
11 |
+
from face_vid2vid.sync_batchnorm.replicate import DataParallelWithCallback
|
12 |
+
|
13 |
+
def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False,
|
14 |
+
use_relative_movement=False, use_relative_jacobian=False):
|
15 |
+
if adapt_movement_scale:
|
16 |
+
source_area = ConvexHull(kp_source['value'][0].data.cpu().numpy()).volume
|
17 |
+
driving_area = ConvexHull(kp_driving_initial['value'][0].data.cpu().numpy()).volume
|
18 |
+
adapt_movement_scale = np.sqrt(source_area) / np.sqrt(driving_area)
|
19 |
+
else:
|
20 |
+
adapt_movement_scale = 1
|
21 |
+
|
22 |
+
kp_new = {k: v for k, v in kp_driving.items()}
|
23 |
+
|
24 |
+
if use_relative_movement:
|
25 |
+
kp_value_diff = (kp_driving['value'] - kp_driving_initial['value'])
|
26 |
+
kp_value_diff *= adapt_movement_scale
|
27 |
+
kp_new['value'] = kp_value_diff + kp_source['value']
|
28 |
+
|
29 |
+
if use_relative_jacobian:
|
30 |
+
jacobian_diff = torch.matmul(kp_driving['jacobian'], torch.inverse(kp_driving_initial['jacobian']))
|
31 |
+
kp_new['jacobian'] = torch.matmul(jacobian_diff, kp_source['jacobian'])
|
32 |
+
|
33 |
+
return kp_new
|
face_vid2vid/augmentation.py
ADDED
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Code from https://github.com/hassony2/torch_videovision
|
3 |
+
"""
|
4 |
+
|
5 |
+
import numbers
|
6 |
+
|
7 |
+
import random
|
8 |
+
import numpy as np
|
9 |
+
import PIL
|
10 |
+
|
11 |
+
from skimage.transform import resize, rotate
|
12 |
+
from skimage.util import pad
|
13 |
+
import torchvision
|
14 |
+
|
15 |
+
import warnings
|
16 |
+
|
17 |
+
from skimage import img_as_ubyte, img_as_float
|
18 |
+
|
19 |
+
|
20 |
+
def crop_clip(clip, min_h, min_w, h, w):
|
21 |
+
if isinstance(clip[0], np.ndarray):
|
22 |
+
cropped = [img[min_h:min_h + h, min_w:min_w + w, :] for img in clip]
|
23 |
+
|
24 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
25 |
+
cropped = [
|
26 |
+
img.crop((min_w, min_h, min_w + w, min_h + h)) for img in clip
|
27 |
+
]
|
28 |
+
else:
|
29 |
+
raise TypeError('Expected numpy.ndarray or PIL.Image' +
|
30 |
+
'but got list of {0}'.format(type(clip[0])))
|
31 |
+
return cropped
|
32 |
+
|
33 |
+
|
34 |
+
def pad_clip(clip, h, w):
|
35 |
+
im_h, im_w = clip[0].shape[:2]
|
36 |
+
pad_h = (0, 0) if h < im_h else ((h - im_h) // 2, (h - im_h + 1) // 2)
|
37 |
+
pad_w = (0, 0) if w < im_w else ((w - im_w) // 2, (w - im_w + 1) // 2)
|
38 |
+
|
39 |
+
return pad(clip, ((0, 0), pad_h, pad_w, (0, 0)), mode='edge')
|
40 |
+
|
41 |
+
|
42 |
+
def resize_clip(clip, size, interpolation='bilinear'):
|
43 |
+
if isinstance(clip[0], np.ndarray):
|
44 |
+
if isinstance(size, numbers.Number):
|
45 |
+
im_h, im_w, im_c = clip[0].shape
|
46 |
+
# Min spatial dim already matches minimal size
|
47 |
+
if (im_w <= im_h and im_w == size) or (im_h <= im_w
|
48 |
+
and im_h == size):
|
49 |
+
return clip
|
50 |
+
new_h, new_w = get_resize_sizes(im_h, im_w, size)
|
51 |
+
size = (new_w, new_h)
|
52 |
+
else:
|
53 |
+
size = size[1], size[0]
|
54 |
+
|
55 |
+
scaled = [
|
56 |
+
resize(img, size, order=1 if interpolation == 'bilinear' else 0, preserve_range=True,
|
57 |
+
mode='constant', anti_aliasing=True) for img in clip
|
58 |
+
]
|
59 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
60 |
+
if isinstance(size, numbers.Number):
|
61 |
+
im_w, im_h = clip[0].size
|
62 |
+
# Min spatial dim already matches minimal size
|
63 |
+
if (im_w <= im_h and im_w == size) or (im_h <= im_w
|
64 |
+
and im_h == size):
|
65 |
+
return clip
|
66 |
+
new_h, new_w = get_resize_sizes(im_h, im_w, size)
|
67 |
+
size = (new_w, new_h)
|
68 |
+
else:
|
69 |
+
size = size[1], size[0]
|
70 |
+
if interpolation == 'bilinear':
|
71 |
+
pil_inter = PIL.Image.NEAREST
|
72 |
+
else:
|
73 |
+
pil_inter = PIL.Image.BILINEAR
|
74 |
+
scaled = [img.resize(size, pil_inter) for img in clip]
|
75 |
+
else:
|
76 |
+
raise TypeError('Expected numpy.ndarray or PIL.Image' +
|
77 |
+
'but got list of {0}'.format(type(clip[0])))
|
78 |
+
return scaled
|
79 |
+
|
80 |
+
|
81 |
+
def get_resize_sizes(im_h, im_w, size):
|
82 |
+
if im_w < im_h:
|
83 |
+
ow = size
|
84 |
+
oh = int(size * im_h / im_w)
|
85 |
+
else:
|
86 |
+
oh = size
|
87 |
+
ow = int(size * im_w / im_h)
|
88 |
+
return oh, ow
|
89 |
+
|
90 |
+
|
91 |
+
class RandomFlip(object):
|
92 |
+
def __init__(self, time_flip=False, horizontal_flip=False):
|
93 |
+
self.time_flip = time_flip
|
94 |
+
self.horizontal_flip = horizontal_flip
|
95 |
+
|
96 |
+
def __call__(self, clip):
|
97 |
+
if random.random() < 0.5 and self.time_flip:
|
98 |
+
return clip[::-1]
|
99 |
+
if random.random() < 0.5 and self.horizontal_flip:
|
100 |
+
return [np.fliplr(img) for img in clip]
|
101 |
+
|
102 |
+
return clip
|
103 |
+
|
104 |
+
|
105 |
+
class RandomResize(object):
|
106 |
+
"""Resizes a list of (H x W x C) numpy.ndarray to the final size
|
107 |
+
The larger the original image is, the more times it takes to
|
108 |
+
interpolate
|
109 |
+
Args:
|
110 |
+
interpolation (str): Can be one of 'nearest', 'bilinear'
|
111 |
+
defaults to nearest
|
112 |
+
size (tuple): (widht, height)
|
113 |
+
"""
|
114 |
+
|
115 |
+
def __init__(self, ratio=(3. / 4., 4. / 3.), interpolation='nearest'):
|
116 |
+
self.ratio = ratio
|
117 |
+
self.interpolation = interpolation
|
118 |
+
|
119 |
+
def __call__(self, clip):
|
120 |
+
scaling_factor = random.uniform(self.ratio[0], self.ratio[1])
|
121 |
+
|
122 |
+
if isinstance(clip[0], np.ndarray):
|
123 |
+
im_h, im_w, im_c = clip[0].shape
|
124 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
125 |
+
im_w, im_h = clip[0].size
|
126 |
+
|
127 |
+
new_w = int(im_w * scaling_factor)
|
128 |
+
new_h = int(im_h * scaling_factor)
|
129 |
+
new_size = (new_w, new_h)
|
130 |
+
resized = resize_clip(
|
131 |
+
clip, new_size, interpolation=self.interpolation)
|
132 |
+
|
133 |
+
return resized
|
134 |
+
|
135 |
+
|
136 |
+
class RandomCrop(object):
|
137 |
+
"""Extract random crop at the same location for a list of videos
|
138 |
+
Args:
|
139 |
+
size (sequence or int): Desired output size for the
|
140 |
+
crop in format (h, w)
|
141 |
+
"""
|
142 |
+
|
143 |
+
def __init__(self, size):
|
144 |
+
if isinstance(size, numbers.Number):
|
145 |
+
size = (size, size)
|
146 |
+
|
147 |
+
self.size = size
|
148 |
+
|
149 |
+
def __call__(self, clip):
|
150 |
+
"""
|
151 |
+
Args:
|
152 |
+
img (PIL.Image or numpy.ndarray): List of videos to be cropped
|
153 |
+
in format (h, w, c) in numpy.ndarray
|
154 |
+
Returns:
|
155 |
+
PIL.Image or numpy.ndarray: Cropped list of videos
|
156 |
+
"""
|
157 |
+
h, w = self.size
|
158 |
+
if isinstance(clip[0], np.ndarray):
|
159 |
+
im_h, im_w, im_c = clip[0].shape
|
160 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
161 |
+
im_w, im_h = clip[0].size
|
162 |
+
else:
|
163 |
+
raise TypeError('Expected numpy.ndarray or PIL.Image' +
|
164 |
+
'but got list of {0}'.format(type(clip[0])))
|
165 |
+
|
166 |
+
clip = pad_clip(clip, h, w)
|
167 |
+
im_h, im_w = clip.shape[1:3]
|
168 |
+
x1 = 0 if h == im_h else random.randint(0, im_w - w)
|
169 |
+
y1 = 0 if w == im_w else random.randint(0, im_h - h)
|
170 |
+
cropped = crop_clip(clip, y1, x1, h, w)
|
171 |
+
|
172 |
+
return cropped
|
173 |
+
|
174 |
+
|
175 |
+
class RandomRotation(object):
|
176 |
+
"""Rotate entire clip randomly by a random angle within
|
177 |
+
given bounds
|
178 |
+
Args:
|
179 |
+
degrees (sequence or int): Range of degrees to select from
|
180 |
+
If degrees is a number instead of sequence like (min, max),
|
181 |
+
the range of degrees, will be (-degrees, +degrees).
|
182 |
+
"""
|
183 |
+
|
184 |
+
def __init__(self, degrees):
|
185 |
+
if isinstance(degrees, numbers.Number):
|
186 |
+
if degrees < 0:
|
187 |
+
raise ValueError('If degrees is a single number,'
|
188 |
+
'must be positive')
|
189 |
+
degrees = (-degrees, degrees)
|
190 |
+
else:
|
191 |
+
if len(degrees) != 2:
|
192 |
+
raise ValueError('If degrees is a sequence,'
|
193 |
+
'it must be of len 2.')
|
194 |
+
|
195 |
+
self.degrees = degrees
|
196 |
+
|
197 |
+
def __call__(self, clip):
|
198 |
+
"""
|
199 |
+
Args:
|
200 |
+
img (PIL.Image or numpy.ndarray): List of videos to be cropped
|
201 |
+
in format (h, w, c) in numpy.ndarray
|
202 |
+
Returns:
|
203 |
+
PIL.Image or numpy.ndarray: Cropped list of videos
|
204 |
+
"""
|
205 |
+
angle = random.uniform(self.degrees[0], self.degrees[1])
|
206 |
+
if isinstance(clip[0], np.ndarray):
|
207 |
+
rotated = [rotate(image=img, angle=angle, preserve_range=True) for img in clip]
|
208 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
209 |
+
rotated = [img.rotate(angle) for img in clip]
|
210 |
+
else:
|
211 |
+
raise TypeError('Expected numpy.ndarray or PIL.Image' +
|
212 |
+
'but got list of {0}'.format(type(clip[0])))
|
213 |
+
|
214 |
+
return rotated
|
215 |
+
|
216 |
+
|
217 |
+
class ColorJitter(object):
|
218 |
+
"""Randomly change the brightness, contrast and saturation and hue of the clip
|
219 |
+
Args:
|
220 |
+
brightness (float): How much to jitter brightness. brightness_factor
|
221 |
+
is chosen uniformly from [max(0, 1 - brightness), 1 + brightness].
|
222 |
+
contrast (float): How much to jitter contrast. contrast_factor
|
223 |
+
is chosen uniformly from [max(0, 1 - contrast), 1 + contrast].
|
224 |
+
saturation (float): How much to jitter saturation. saturation_factor
|
225 |
+
is chosen uniformly from [max(0, 1 - saturation), 1 + saturation].
|
226 |
+
hue(float): How much to jitter hue. hue_factor is chosen uniformly from
|
227 |
+
[-hue, hue]. Should be >=0 and <= 0.5.
|
228 |
+
"""
|
229 |
+
|
230 |
+
def __init__(self, brightness=0, contrast=0, saturation=0, hue=0):
|
231 |
+
self.brightness = brightness
|
232 |
+
self.contrast = contrast
|
233 |
+
self.saturation = saturation
|
234 |
+
self.hue = hue
|
235 |
+
|
236 |
+
def get_params(self, brightness, contrast, saturation, hue):
|
237 |
+
if brightness > 0:
|
238 |
+
brightness_factor = random.uniform(
|
239 |
+
max(0, 1 - brightness), 1 + brightness)
|
240 |
+
else:
|
241 |
+
brightness_factor = None
|
242 |
+
|
243 |
+
if contrast > 0:
|
244 |
+
contrast_factor = random.uniform(
|
245 |
+
max(0, 1 - contrast), 1 + contrast)
|
246 |
+
else:
|
247 |
+
contrast_factor = None
|
248 |
+
|
249 |
+
if saturation > 0:
|
250 |
+
saturation_factor = random.uniform(
|
251 |
+
max(0, 1 - saturation), 1 + saturation)
|
252 |
+
else:
|
253 |
+
saturation_factor = None
|
254 |
+
|
255 |
+
if hue > 0:
|
256 |
+
hue_factor = random.uniform(-hue, hue)
|
257 |
+
else:
|
258 |
+
hue_factor = None
|
259 |
+
return brightness_factor, contrast_factor, saturation_factor, hue_factor
|
260 |
+
|
261 |
+
def __call__(self, clip):
|
262 |
+
"""
|
263 |
+
Args:
|
264 |
+
clip (list): list of PIL.Image
|
265 |
+
Returns:
|
266 |
+
list PIL.Image : list of transformed PIL.Image
|
267 |
+
"""
|
268 |
+
if isinstance(clip[0], np.ndarray):
|
269 |
+
brightness, contrast, saturation, hue = self.get_params(
|
270 |
+
self.brightness, self.contrast, self.saturation, self.hue)
|
271 |
+
|
272 |
+
# Create img transform function sequence
|
273 |
+
img_transforms = []
|
274 |
+
if brightness is not None:
|
275 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_brightness(img, brightness))
|
276 |
+
if saturation is not None:
|
277 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_saturation(img, saturation))
|
278 |
+
if hue is not None:
|
279 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_hue(img, hue))
|
280 |
+
if contrast is not None:
|
281 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_contrast(img, contrast))
|
282 |
+
random.shuffle(img_transforms)
|
283 |
+
img_transforms = [img_as_ubyte, torchvision.transforms.ToPILImage()] + img_transforms + [np.array,
|
284 |
+
img_as_float]
|
285 |
+
|
286 |
+
with warnings.catch_warnings():
|
287 |
+
warnings.simplefilter("ignore")
|
288 |
+
jittered_clip = []
|
289 |
+
for img in clip:
|
290 |
+
jittered_img = img
|
291 |
+
for func in img_transforms:
|
292 |
+
jittered_img = func(jittered_img)
|
293 |
+
jittered_clip.append(jittered_img.astype('float32'))
|
294 |
+
elif isinstance(clip[0], PIL.Image.Image):
|
295 |
+
brightness, contrast, saturation, hue = self.get_params(
|
296 |
+
self.brightness, self.contrast, self.saturation, self.hue)
|
297 |
+
|
298 |
+
# Create img transform function sequence
|
299 |
+
img_transforms = []
|
300 |
+
if brightness is not None:
|
301 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_brightness(img, brightness))
|
302 |
+
if saturation is not None:
|
303 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_saturation(img, saturation))
|
304 |
+
if hue is not None:
|
305 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_hue(img, hue))
|
306 |
+
if contrast is not None:
|
307 |
+
img_transforms.append(lambda img: torchvision.transforms.functional.adjust_contrast(img, contrast))
|
308 |
+
random.shuffle(img_transforms)
|
309 |
+
|
310 |
+
# Apply to all videos
|
311 |
+
jittered_clip = []
|
312 |
+
for img in clip:
|
313 |
+
for func in img_transforms:
|
314 |
+
jittered_img = func(img)
|
315 |
+
jittered_clip.append(jittered_img)
|
316 |
+
|
317 |
+
else:
|
318 |
+
raise TypeError('Expected numpy.ndarray or PIL.Image' +
|
319 |
+
'but got list of {0}'.format(type(clip[0])))
|
320 |
+
return jittered_clip
|
321 |
+
|
322 |
+
|
323 |
+
class AllAugmentationTransform:
|
324 |
+
def __init__(self, resize_param=None, rotation_param=None, flip_param=None, crop_param=None, jitter_param=None):
|
325 |
+
self.transforms = []
|
326 |
+
|
327 |
+
if flip_param is not None:
|
328 |
+
self.transforms.append(RandomFlip(**flip_param))
|
329 |
+
|
330 |
+
if rotation_param is not None:
|
331 |
+
self.transforms.append(RandomRotation(**rotation_param))
|
332 |
+
|
333 |
+
if resize_param is not None:
|
334 |
+
self.transforms.append(RandomResize(**resize_param))
|
335 |
+
|
336 |
+
if crop_param is not None:
|
337 |
+
self.transforms.append(RandomCrop(**crop_param))
|
338 |
+
|
339 |
+
if jitter_param is not None:
|
340 |
+
self.transforms.append(ColorJitter(**jitter_param))
|
341 |
+
|
342 |
+
def __call__(self, clip):
|
343 |
+
for t in self.transforms:
|
344 |
+
clip = t(clip)
|
345 |
+
return clip
|
face_vid2vid/config/vox-256-spade.yaml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
dataset_params:
|
2 |
+
root_dir:
|
3 |
+
frame_shape: [256, 256, 3]
|
4 |
+
id_sampling: True
|
5 |
+
pairs_list: None
|
6 |
+
augmentation_params:
|
7 |
+
flip_param:
|
8 |
+
horizontal_flip: True
|
9 |
+
time_flip: True
|
10 |
+
jitter_param:
|
11 |
+
brightness: 0.1
|
12 |
+
contrast: 0.1
|
13 |
+
saturation: 0.1
|
14 |
+
hue: 0.1
|
15 |
+
|
16 |
+
|
17 |
+
model_params:
|
18 |
+
common_params:
|
19 |
+
num_kp: 15
|
20 |
+
image_channel: 3
|
21 |
+
feature_channel: 32
|
22 |
+
estimate_jacobian: False
|
23 |
+
kp_detector_params:
|
24 |
+
temperature: 0.1
|
25 |
+
block_expansion: 32
|
26 |
+
max_features: 1024
|
27 |
+
scale_factor: 0.25
|
28 |
+
num_blocks: 5
|
29 |
+
reshape_channel: 16384 # 16384 = 1024 * 16
|
30 |
+
reshape_depth: 16
|
31 |
+
he_estimator_params:
|
32 |
+
block_expansion: 64
|
33 |
+
max_features: 2048
|
34 |
+
num_bins: 66
|
35 |
+
generator_params:
|
36 |
+
block_expansion: 64
|
37 |
+
max_features: 512
|
38 |
+
num_down_blocks: 2
|
39 |
+
reshape_channel: 32
|
40 |
+
reshape_depth: 16 # 512 = 32 * 16
|
41 |
+
num_resblocks: 6
|
42 |
+
estimate_occlusion_map: True
|
43 |
+
dense_motion_params:
|
44 |
+
block_expansion: 32
|
45 |
+
max_features: 1024
|
46 |
+
num_blocks: 5
|
47 |
+
# reshape_channel: 32
|
48 |
+
reshape_depth: 16
|
49 |
+
compress: 4
|
50 |
+
discriminator_params:
|
51 |
+
scales: [1]
|
52 |
+
block_expansion: 32
|
53 |
+
max_features: 512
|
54 |
+
num_blocks: 4
|
55 |
+
sn: True
|
56 |
+
|
57 |
+
train_params:
|
58 |
+
num_epochs: 200
|
59 |
+
num_repeats: 75
|
60 |
+
epoch_milestones: [180,]
|
61 |
+
lr_generator: 2.0e-4
|
62 |
+
lr_discriminator: 2.0e-4
|
63 |
+
lr_kp_detector: 2.0e-4
|
64 |
+
lr_he_estimator: 2.0e-4
|
65 |
+
gan_mode: 'hinge' # hinge or ls
|
66 |
+
batch_size: 1
|
67 |
+
scales: [1, 0.5, 0.25, 0.125]
|
68 |
+
checkpoint_freq: 60
|
69 |
+
hopenet_snapshot: './checkpoints/hopenet_robust_alpha1.pkl'
|
70 |
+
transform_params:
|
71 |
+
sigma_affine: 0.05
|
72 |
+
sigma_tps: 0.005
|
73 |
+
points_tps: 5
|
74 |
+
loss_weights:
|
75 |
+
generator_gan: 1
|
76 |
+
discriminator_gan: 1
|
77 |
+
feature_matching: [10, 10, 10, 10]
|
78 |
+
perceptual: [10, 10, 10, 10, 10]
|
79 |
+
equivariance_value: 10
|
80 |
+
equivariance_jacobian: 0
|
81 |
+
keypoint: 10
|
82 |
+
headpose: 20
|
83 |
+
expression: 5
|
84 |
+
|
85 |
+
visualizer_params:
|
86 |
+
kp_size: 5
|
87 |
+
draw_border: True
|
88 |
+
colormap: 'gist_rainbow'
|
face_vid2vid/crop-video.py
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import face_alignment
|
2 |
+
import skimage.io
|
3 |
+
import numpy
|
4 |
+
from argparse import ArgumentParser
|
5 |
+
from skimage import img_as_ubyte
|
6 |
+
from skimage.transform import resize
|
7 |
+
from tqdm import tqdm
|
8 |
+
import os
|
9 |
+
import imageio
|
10 |
+
import numpy as np
|
11 |
+
import warnings
|
12 |
+
warnings.filterwarnings("ignore")
|
13 |
+
|
14 |
+
def extract_bbox(frame, fa):
|
15 |
+
if max(frame.shape[0], frame.shape[1]) > 640:
|
16 |
+
scale_factor = max(frame.shape[0], frame.shape[1]) / 640.0
|
17 |
+
frame = resize(frame, (int(frame.shape[0] / scale_factor), int(frame.shape[1] / scale_factor)))
|
18 |
+
frame = img_as_ubyte(frame)
|
19 |
+
else:
|
20 |
+
scale_factor = 1
|
21 |
+
frame = frame[..., :3]
|
22 |
+
bboxes = fa.face_detector.detect_from_image(frame[..., ::-1])
|
23 |
+
if len(bboxes) == 0:
|
24 |
+
return []
|
25 |
+
return np.array(bboxes)[:, :-1] * scale_factor
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
def bb_intersection_over_union(boxA, boxB):
|
30 |
+
xA = max(boxA[0], boxB[0])
|
31 |
+
yA = max(boxA[1], boxB[1])
|
32 |
+
xB = min(boxA[2], boxB[2])
|
33 |
+
yB = min(boxA[3], boxB[3])
|
34 |
+
interArea = max(0, xB - xA + 1) * max(0, yB - yA + 1)
|
35 |
+
boxAArea = (boxA[2] - boxA[0] + 1) * (boxA[3] - boxA[1] + 1)
|
36 |
+
boxBArea = (boxB[2] - boxB[0] + 1) * (boxB[3] - boxB[1] + 1)
|
37 |
+
iou = interArea / float(boxAArea + boxBArea - interArea)
|
38 |
+
return iou
|
39 |
+
|
40 |
+
|
41 |
+
def join(tube_bbox, bbox):
|
42 |
+
xA = min(tube_bbox[0], bbox[0])
|
43 |
+
yA = min(tube_bbox[1], bbox[1])
|
44 |
+
xB = max(tube_bbox[2], bbox[2])
|
45 |
+
yB = max(tube_bbox[3], bbox[3])
|
46 |
+
return (xA, yA, xB, yB)
|
47 |
+
|
48 |
+
|
49 |
+
def compute_bbox(start, end, fps, tube_bbox, frame_shape, inp, image_shape, increase_area=0.1):
|
50 |
+
left, top, right, bot = tube_bbox
|
51 |
+
width = right - left
|
52 |
+
height = bot - top
|
53 |
+
|
54 |
+
#Computing aspect preserving bbox
|
55 |
+
width_increase = max(increase_area, ((1 + 2 * increase_area) * height - width) / (2 * width))
|
56 |
+
height_increase = max(increase_area, ((1 + 2 * increase_area) * width - height) / (2 * height))
|
57 |
+
|
58 |
+
left = int(left - width_increase * width)
|
59 |
+
top = int(top - height_increase * height)
|
60 |
+
right = int(right + width_increase * width)
|
61 |
+
bot = int(bot + height_increase * height)
|
62 |
+
|
63 |
+
top, bot, left, right = max(0, top), min(bot, frame_shape[0]), max(0, left), min(right, frame_shape[1])
|
64 |
+
h, w = bot - top, right - left
|
65 |
+
|
66 |
+
start = start / fps
|
67 |
+
end = end / fps
|
68 |
+
time = end - start
|
69 |
+
|
70 |
+
scale = f'{image_shape[0]}:{image_shape[1]}'
|
71 |
+
|
72 |
+
return f'ffmpeg -i {inp} -ss {start} -t {time} -filter:v "crop={w}:{h}:{left}:{top}, scale={scale}" crop.mp4'
|
73 |
+
|
74 |
+
|
75 |
+
def compute_bbox_trajectories(trajectories, fps, frame_shape, args):
|
76 |
+
commands = []
|
77 |
+
for i, (bbox, tube_bbox, start, end) in enumerate(trajectories):
|
78 |
+
if (end - start) > args.min_frames:
|
79 |
+
command = compute_bbox(start, end, fps, tube_bbox, frame_shape, inp=args.inp, image_shape=args.image_shape, increase_area=args.increase)
|
80 |
+
commands.append(command)
|
81 |
+
return commands
|
82 |
+
|
83 |
+
|
84 |
+
def process_video(args):
|
85 |
+
device = 'cpu' if args.cpu else 'cuda'
|
86 |
+
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False, device=device)
|
87 |
+
video = imageio.get_reader(args.inp)
|
88 |
+
|
89 |
+
trajectories = []
|
90 |
+
previous_frame = None
|
91 |
+
fps = video.get_meta_data()['fps']
|
92 |
+
commands = []
|
93 |
+
try:
|
94 |
+
for i, frame in tqdm(enumerate(video)):
|
95 |
+
frame_shape = frame.shape
|
96 |
+
bboxes = extract_bbox(frame, fa)
|
97 |
+
## For each trajectory check the criterion
|
98 |
+
not_valid_trajectories = []
|
99 |
+
valid_trajectories = []
|
100 |
+
|
101 |
+
for trajectory in trajectories:
|
102 |
+
tube_bbox = trajectory[0]
|
103 |
+
intersection = 0
|
104 |
+
for bbox in bboxes:
|
105 |
+
intersection = max(intersection, bb_intersection_over_union(tube_bbox, bbox))
|
106 |
+
if intersection > args.iou_with_initial:
|
107 |
+
valid_trajectories.append(trajectory)
|
108 |
+
else:
|
109 |
+
not_valid_trajectories.append(trajectory)
|
110 |
+
|
111 |
+
commands += compute_bbox_trajectories(not_valid_trajectories, fps, frame_shape, args)
|
112 |
+
trajectories = valid_trajectories
|
113 |
+
|
114 |
+
## Assign bbox to trajectories, create new trajectories
|
115 |
+
for bbox in bboxes:
|
116 |
+
intersection = 0
|
117 |
+
current_trajectory = None
|
118 |
+
for trajectory in trajectories:
|
119 |
+
tube_bbox = trajectory[0]
|
120 |
+
current_intersection = bb_intersection_over_union(tube_bbox, bbox)
|
121 |
+
if intersection < current_intersection and current_intersection > args.iou_with_initial:
|
122 |
+
intersection = bb_intersection_over_union(tube_bbox, bbox)
|
123 |
+
current_trajectory = trajectory
|
124 |
+
|
125 |
+
## Create new trajectory
|
126 |
+
if current_trajectory is None:
|
127 |
+
trajectories.append([bbox, bbox, i, i])
|
128 |
+
else:
|
129 |
+
current_trajectory[3] = i
|
130 |
+
current_trajectory[1] = join(current_trajectory[1], bbox)
|
131 |
+
|
132 |
+
|
133 |
+
except IndexError as e:
|
134 |
+
raise (e)
|
135 |
+
|
136 |
+
commands += compute_bbox_trajectories(trajectories, fps, frame_shape, args)
|
137 |
+
return commands
|
138 |
+
|
139 |
+
|
140 |
+
if __name__ == "__main__":
|
141 |
+
parser = ArgumentParser()
|
142 |
+
|
143 |
+
parser.add_argument("--image_shape", default=(256, 256), type=lambda x: tuple(map(int, x.split(','))),
|
144 |
+
help="Image shape")
|
145 |
+
parser.add_argument("--increase", default=0.1, type=float, help='Increase bbox by this amount')
|
146 |
+
parser.add_argument("--iou_with_initial", type=float, default=0.25, help="The minimal allowed iou with inital bbox")
|
147 |
+
parser.add_argument("--inp", required=True, help='Input image or video')
|
148 |
+
parser.add_argument("--min_frames", type=int, default=150, help='Minimum number of frames')
|
149 |
+
parser.add_argument("--cpu", dest="cpu", action="store_true", help="cpu mode.")
|
150 |
+
|
151 |
+
|
152 |
+
args = parser.parse_args()
|
153 |
+
|
154 |
+
commands = process_video(args)
|
155 |
+
for command in commands:
|
156 |
+
print (command)
|
157 |
+
|
158 |
+
|
face_vid2vid/demo.py
ADDED
@@ -0,0 +1,304 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import matplotlib
|
2 |
+
matplotlib.use('Agg')
|
3 |
+
import os, sys
|
4 |
+
import yaml
|
5 |
+
from argparse import ArgumentParser
|
6 |
+
from tqdm import tqdm
|
7 |
+
|
8 |
+
import imageio
|
9 |
+
import numpy as np
|
10 |
+
from skimage.transform import resize
|
11 |
+
from skimage import img_as_ubyte
|
12 |
+
import torch
|
13 |
+
import torch.nn.functional as F
|
14 |
+
from sync_batchnorm import DataParallelWithCallback
|
15 |
+
|
16 |
+
from modules.generator import OcclusionAwareGenerator, OcclusionAwareSPADEGenerator
|
17 |
+
from modules.keypoint_detector import KPDetector, HEEstimator
|
18 |
+
from animate import normalize_kp
|
19 |
+
from scipy.spatial import ConvexHull
|
20 |
+
|
21 |
+
|
22 |
+
if sys.version_info[0] < 3:
|
23 |
+
raise Exception("You must use Python 3 or higher. Recommended version is Python 3.7")
|
24 |
+
|
25 |
+
def load_checkpoints(config_path, checkpoint_path, gen, cpu=False):
|
26 |
+
|
27 |
+
with open(config_path) as f:
|
28 |
+
config = yaml.load(f)
|
29 |
+
|
30 |
+
if gen == 'original':
|
31 |
+
generator = OcclusionAwareGenerator(**config['model_params']['generator_params'],
|
32 |
+
**config['model_params']['common_params'])
|
33 |
+
elif gen == 'spade':
|
34 |
+
generator = OcclusionAwareSPADEGenerator(**config['model_params']['generator_params'],
|
35 |
+
**config['model_params']['common_params'])
|
36 |
+
|
37 |
+
if not cpu:
|
38 |
+
generator.cuda()
|
39 |
+
|
40 |
+
kp_detector = KPDetector(**config['model_params']['kp_detector_params'],
|
41 |
+
**config['model_params']['common_params'])
|
42 |
+
if not cpu:
|
43 |
+
kp_detector.cuda()
|
44 |
+
|
45 |
+
he_estimator = HEEstimator(**config['model_params']['he_estimator_params'],
|
46 |
+
**config['model_params']['common_params'])
|
47 |
+
if not cpu:
|
48 |
+
he_estimator.cuda()
|
49 |
+
|
50 |
+
if cpu:
|
51 |
+
checkpoint = torch.load(checkpoint_path, map_location=torch.device('cpu'))
|
52 |
+
else:
|
53 |
+
checkpoint = torch.load(checkpoint_path)
|
54 |
+
|
55 |
+
generator.load_state_dict(checkpoint['generator'])
|
56 |
+
kp_detector.load_state_dict(checkpoint['kp_detector'])
|
57 |
+
he_estimator.load_state_dict(checkpoint['he_estimator'])
|
58 |
+
|
59 |
+
if not cpu:
|
60 |
+
generator = DataParallelWithCallback(generator)
|
61 |
+
kp_detector = DataParallelWithCallback(kp_detector)
|
62 |
+
he_estimator = DataParallelWithCallback(he_estimator)
|
63 |
+
|
64 |
+
generator.eval()
|
65 |
+
kp_detector.eval()
|
66 |
+
he_estimator.eval()
|
67 |
+
|
68 |
+
return generator, kp_detector, he_estimator
|
69 |
+
|
70 |
+
|
71 |
+
def headpose_pred_to_degree(pred):
|
72 |
+
device = pred.device
|
73 |
+
idx_tensor = [idx for idx in range(66)]
|
74 |
+
idx_tensor = torch.FloatTensor(idx_tensor).to(device)
|
75 |
+
pred = F.softmax(pred)
|
76 |
+
degree = torch.sum(pred*idx_tensor, axis=1) * 3 - 99
|
77 |
+
|
78 |
+
return degree
|
79 |
+
|
80 |
+
'''
|
81 |
+
# beta version
|
82 |
+
def get_rotation_matrix(yaw, pitch, roll):
|
83 |
+
yaw = yaw / 180 * 3.14
|
84 |
+
pitch = pitch / 180 * 3.14
|
85 |
+
roll = roll / 180 * 3.14
|
86 |
+
|
87 |
+
roll = roll.unsqueeze(1)
|
88 |
+
pitch = pitch.unsqueeze(1)
|
89 |
+
yaw = yaw.unsqueeze(1)
|
90 |
+
|
91 |
+
roll_mat = torch.cat([torch.ones_like(roll), torch.zeros_like(roll), torch.zeros_like(roll),
|
92 |
+
torch.zeros_like(roll), torch.cos(roll), -torch.sin(roll),
|
93 |
+
torch.zeros_like(roll), torch.sin(roll), torch.cos(roll)], dim=1)
|
94 |
+
roll_mat = roll_mat.view(roll_mat.shape[0], 3, 3)
|
95 |
+
|
96 |
+
pitch_mat = torch.cat([torch.cos(pitch), torch.zeros_like(pitch), torch.sin(pitch),
|
97 |
+
torch.zeros_like(pitch), torch.ones_like(pitch), torch.zeros_like(pitch),
|
98 |
+
-torch.sin(pitch), torch.zeros_like(pitch), torch.cos(pitch)], dim=1)
|
99 |
+
pitch_mat = pitch_mat.view(pitch_mat.shape[0], 3, 3)
|
100 |
+
|
101 |
+
yaw_mat = torch.cat([torch.cos(yaw), -torch.sin(yaw), torch.zeros_like(yaw),
|
102 |
+
torch.sin(yaw), torch.cos(yaw), torch.zeros_like(yaw),
|
103 |
+
torch.zeros_like(yaw), torch.zeros_like(yaw), torch.ones_like(yaw)], dim=1)
|
104 |
+
yaw_mat = yaw_mat.view(yaw_mat.shape[0], 3, 3)
|
105 |
+
|
106 |
+
rot_mat = torch.einsum('bij,bjk,bkm->bim', roll_mat, pitch_mat, yaw_mat)
|
107 |
+
|
108 |
+
return rot_mat
|
109 |
+
|
110 |
+
'''
|
111 |
+
def get_rotation_matrix(yaw, pitch, roll):
|
112 |
+
yaw = yaw / 180 * 3.14
|
113 |
+
pitch = pitch / 180 * 3.14
|
114 |
+
roll = roll / 180 * 3.14
|
115 |
+
|
116 |
+
roll = roll.unsqueeze(1)
|
117 |
+
pitch = pitch.unsqueeze(1)
|
118 |
+
yaw = yaw.unsqueeze(1)
|
119 |
+
|
120 |
+
pitch_mat = torch.cat([torch.ones_like(pitch), torch.zeros_like(pitch), torch.zeros_like(pitch),
|
121 |
+
torch.zeros_like(pitch), torch.cos(pitch), -torch.sin(pitch),
|
122 |
+
torch.zeros_like(pitch), torch.sin(pitch), torch.cos(pitch)], dim=1)
|
123 |
+
pitch_mat = pitch_mat.view(pitch_mat.shape[0], 3, 3)
|
124 |
+
|
125 |
+
yaw_mat = torch.cat([torch.cos(yaw), torch.zeros_like(yaw), torch.sin(yaw),
|
126 |
+
torch.zeros_like(yaw), torch.ones_like(yaw), torch.zeros_like(yaw),
|
127 |
+
-torch.sin(yaw), torch.zeros_like(yaw), torch.cos(yaw)], dim=1)
|
128 |
+
yaw_mat = yaw_mat.view(yaw_mat.shape[0], 3, 3)
|
129 |
+
|
130 |
+
roll_mat = torch.cat([torch.cos(roll), -torch.sin(roll), torch.zeros_like(roll),
|
131 |
+
torch.sin(roll), torch.cos(roll), torch.zeros_like(roll),
|
132 |
+
torch.zeros_like(roll), torch.zeros_like(roll), torch.ones_like(roll)], dim=1)
|
133 |
+
roll_mat = roll_mat.view(roll_mat.shape[0], 3, 3)
|
134 |
+
|
135 |
+
rot_mat = torch.einsum('bij,bjk,bkm->bim', pitch_mat, yaw_mat, roll_mat)
|
136 |
+
|
137 |
+
return rot_mat
|
138 |
+
|
139 |
+
def keypoint_transformation(kp_canonical, he, estimate_jacobian=True, free_view=False, yaw=0, pitch=0, roll=0):
|
140 |
+
kp = kp_canonical['value']
|
141 |
+
if not free_view:
|
142 |
+
yaw, pitch, roll = he['yaw'], he['pitch'], he['roll']
|
143 |
+
yaw = headpose_pred_to_degree(yaw)
|
144 |
+
pitch = headpose_pred_to_degree(pitch)
|
145 |
+
roll = headpose_pred_to_degree(roll)
|
146 |
+
else:
|
147 |
+
if yaw is not None:
|
148 |
+
yaw = torch.tensor([yaw]).cuda()
|
149 |
+
else:
|
150 |
+
yaw = he['yaw']
|
151 |
+
yaw = headpose_pred_to_degree(yaw)
|
152 |
+
if pitch is not None:
|
153 |
+
pitch = torch.tensor([pitch]).cuda()
|
154 |
+
else:
|
155 |
+
pitch = he['pitch']
|
156 |
+
pitch = headpose_pred_to_degree(pitch)
|
157 |
+
if roll is not None:
|
158 |
+
roll = torch.tensor([roll]).cuda()
|
159 |
+
else:
|
160 |
+
roll = he['roll']
|
161 |
+
roll = headpose_pred_to_degree(roll)
|
162 |
+
|
163 |
+
t, exp = he['t'], he['exp']
|
164 |
+
|
165 |
+
rot_mat = get_rotation_matrix(yaw, pitch, roll)
|
166 |
+
|
167 |
+
# keypoint rotation
|
168 |
+
kp_rotated = torch.einsum('bmp,bkp->bkm', rot_mat, kp)
|
169 |
+
|
170 |
+
# keypoint translation
|
171 |
+
t = t.unsqueeze_(1).repeat(1, kp.shape[1], 1)
|
172 |
+
kp_t = kp_rotated + t
|
173 |
+
|
174 |
+
# add expression deviation
|
175 |
+
exp = exp.view(exp.shape[0], -1, 3)
|
176 |
+
kp_transformed = kp_t + exp
|
177 |
+
|
178 |
+
if estimate_jacobian:
|
179 |
+
jacobian = kp_canonical['jacobian']
|
180 |
+
jacobian_transformed = torch.einsum('bmp,bkps->bkms', rot_mat, jacobian)
|
181 |
+
else:
|
182 |
+
jacobian_transformed = None
|
183 |
+
|
184 |
+
return {'value': kp_transformed, 'jacobian': jacobian_transformed}
|
185 |
+
|
186 |
+
def make_animation(source_image, driving_video, generator, kp_detector, he_estimator, relative=True, adapt_movement_scale=True, estimate_jacobian=True, cpu=False, free_view=False, yaw=0, pitch=0, roll=0):
|
187 |
+
with torch.no_grad():
|
188 |
+
predictions = []
|
189 |
+
source = torch.tensor(source_image[np.newaxis].astype(np.float32)).permute(0, 3, 1, 2)
|
190 |
+
if not cpu:
|
191 |
+
source = source.cuda()
|
192 |
+
driving = torch.tensor(np.array(driving_video)[np.newaxis].astype(np.float32)).permute(0, 4, 1, 2, 3)
|
193 |
+
kp_canonical = kp_detector(source)
|
194 |
+
he_source = he_estimator(source)
|
195 |
+
he_driving_initial = he_estimator(driving[:, :, 0])
|
196 |
+
|
197 |
+
kp_source = keypoint_transformation(kp_canonical, he_source, estimate_jacobian)
|
198 |
+
kp_driving_initial = keypoint_transformation(kp_canonical, he_driving_initial, estimate_jacobian)
|
199 |
+
# kp_driving_initial = keypoint_transformation(kp_canonical, he_driving_initial, free_view=free_view, yaw=yaw, pitch=pitch, roll=roll)
|
200 |
+
|
201 |
+
for frame_idx in tqdm(range(driving.shape[2])):
|
202 |
+
driving_frame = driving[:, :, frame_idx]
|
203 |
+
if not cpu:
|
204 |
+
driving_frame = driving_frame.cuda()
|
205 |
+
he_driving = he_estimator(driving_frame)
|
206 |
+
kp_driving = keypoint_transformation(kp_canonical, he_driving, estimate_jacobian, free_view=free_view, yaw=yaw, pitch=pitch, roll=roll)
|
207 |
+
kp_norm = normalize_kp(kp_source=kp_source, kp_driving=kp_driving,
|
208 |
+
kp_driving_initial=kp_driving_initial, use_relative_movement=relative,
|
209 |
+
use_relative_jacobian=estimate_jacobian, adapt_movement_scale=adapt_movement_scale)
|
210 |
+
out = generator(source, kp_source=kp_source, kp_driving=kp_norm)
|
211 |
+
|
212 |
+
predictions.append(np.transpose(out['prediction'].data.cpu().numpy(), [0, 2, 3, 1])[0])
|
213 |
+
return predictions
|
214 |
+
|
215 |
+
def find_best_frame(source, driving, cpu=False):
|
216 |
+
import face_alignment
|
217 |
+
|
218 |
+
def normalize_kp(kp):
|
219 |
+
kp = kp - kp.mean(axis=0, keepdims=True)
|
220 |
+
area = ConvexHull(kp[:, :2]).volume
|
221 |
+
area = np.sqrt(area)
|
222 |
+
kp[:, :2] = kp[:, :2] / area
|
223 |
+
return kp
|
224 |
+
|
225 |
+
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True,
|
226 |
+
device='cpu' if cpu else 'cuda')
|
227 |
+
kp_source = fa.get_landmarks(255 * source)[0]
|
228 |
+
kp_source = normalize_kp(kp_source)
|
229 |
+
norm = float('inf')
|
230 |
+
frame_num = 0
|
231 |
+
for i, image in tqdm(enumerate(driving)):
|
232 |
+
kp_driving = fa.get_landmarks(255 * image)[0]
|
233 |
+
kp_driving = normalize_kp(kp_driving)
|
234 |
+
new_norm = (np.abs(kp_source - kp_driving) ** 2).sum()
|
235 |
+
if new_norm < norm:
|
236 |
+
norm = new_norm
|
237 |
+
frame_num = i
|
238 |
+
return frame_num
|
239 |
+
|
240 |
+
if __name__ == "__main__":
|
241 |
+
parser = ArgumentParser()
|
242 |
+
parser.add_argument("--config", default='config/vox-256.yaml', help="path to config")
|
243 |
+
parser.add_argument("--checkpoint", default='', help="path to checkpoint to restore")
|
244 |
+
|
245 |
+
parser.add_argument("--source_image", default='', help="path to source image")
|
246 |
+
parser.add_argument("--driving_video", default='', help="path to driving video")
|
247 |
+
parser.add_argument("--result_video", default='', help="path to output")
|
248 |
+
|
249 |
+
parser.add_argument("--gen", default="spade", choices=["original", "spade"])
|
250 |
+
|
251 |
+
parser.add_argument("--relative", dest="relative", action="store_true", help="use relative or absolute keypoint coordinates")
|
252 |
+
parser.add_argument("--adapt_scale", dest="adapt_scale", action="store_true", help="adapt movement scale based on convex hull of keypoints")
|
253 |
+
|
254 |
+
parser.add_argument("--find_best_frame", dest="find_best_frame", action="store_true",
|
255 |
+
help="Generate from the frame that is the most alligned with source. (Only for faces, requires face_aligment lib)")
|
256 |
+
|
257 |
+
parser.add_argument("--best_frame", dest="best_frame", type=int, default=None,
|
258 |
+
help="Set frame to start from.")
|
259 |
+
|
260 |
+
parser.add_argument("--cpu", dest="cpu", action="store_true", help="cpu mode.")
|
261 |
+
|
262 |
+
parser.add_argument("--free_view", dest="free_view", action="store_true", help="control head pose")
|
263 |
+
parser.add_argument("--yaw", dest="yaw", type=int, default=None, help="yaw")
|
264 |
+
parser.add_argument("--pitch", dest="pitch", type=int, default=None, help="pitch")
|
265 |
+
parser.add_argument("--roll", dest="roll", type=int, default=None, help="roll")
|
266 |
+
|
267 |
+
|
268 |
+
parser.set_defaults(relative=False)
|
269 |
+
parser.set_defaults(adapt_scale=False)
|
270 |
+
parser.set_defaults(free_view=False)
|
271 |
+
|
272 |
+
opt = parser.parse_args()
|
273 |
+
|
274 |
+
source_image = imageio.imread(opt.source_image)
|
275 |
+
reader = imageio.get_reader(opt.driving_video)
|
276 |
+
fps = reader.get_meta_data()['fps']
|
277 |
+
driving_video = []
|
278 |
+
try:
|
279 |
+
for im in reader:
|
280 |
+
driving_video.append(im)
|
281 |
+
except RuntimeError:
|
282 |
+
pass
|
283 |
+
reader.close()
|
284 |
+
|
285 |
+
source_image = resize(source_image, (256, 256))[..., :3]
|
286 |
+
driving_video = [resize(frame, (256, 256))[..., :3] for frame in driving_video]
|
287 |
+
generator, kp_detector, he_estimator = load_checkpoints(config_path=opt.config, checkpoint_path=opt.checkpoint, gen=opt.gen, cpu=opt.cpu)
|
288 |
+
|
289 |
+
with open(opt.config) as f:
|
290 |
+
config = yaml.load(f)
|
291 |
+
estimate_jacobian = config['model_params']['common_params']['estimate_jacobian']
|
292 |
+
print(f'estimate jacobian: {estimate_jacobian}')
|
293 |
+
|
294 |
+
if opt.find_best_frame or opt.best_frame is not None:
|
295 |
+
i = opt.best_frame if opt.best_frame is not None else find_best_frame(source_image, driving_video, cpu=opt.cpu)
|
296 |
+
print ("Best frame: " + str(i))
|
297 |
+
driving_forward = driving_video[i:]
|
298 |
+
driving_backward = driving_video[:(i+1)][::-1]
|
299 |
+
predictions_forward = make_animation(source_image, driving_forward, generator, kp_detector, he_estimator, relative=opt.relative, adapt_movement_scale=opt.adapt_scale, estimate_jacobian=estimate_jacobian, cpu=opt.cpu, free_view=opt.free_view, yaw=opt.yaw, pitch=opt.pitch, roll=opt.roll)
|
300 |
+
predictions_backward = make_animation(source_image, driving_backward, generator, kp_detector, he_estimator, relative=opt.relative, adapt_movement_scale=opt.adapt_scale, estimate_jacobian=estimate_jacobian, cpu=opt.cpu, free_view=opt.free_view, yaw=opt.yaw, pitch=opt.pitch, roll=opt.roll)
|
301 |
+
predictions = predictions_backward[::-1] + predictions_forward[1:]
|
302 |
+
else:
|
303 |
+
predictions = make_animation(source_image, driving_video, generator, kp_detector, he_estimator, relative=opt.relative, adapt_movement_scale=opt.adapt_scale, estimate_jacobian=estimate_jacobian, cpu=opt.cpu, free_view=opt.free_view, yaw=opt.yaw, pitch=opt.pitch, roll=opt.roll)
|
304 |
+
imageio.mimsave(opt.result_video, [img_as_ubyte(frame) for frame in predictions], fps=fps)
|
face_vid2vid/demo_utils.py
ADDED
@@ -0,0 +1,368 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
import cv2
|
4 |
+
import yaml
|
5 |
+
import imageio
|
6 |
+
import numpy as np
|
7 |
+
import torch
|
8 |
+
import torch.nn.functional as F
|
9 |
+
|
10 |
+
|
11 |
+
sys.path.append("./face-vid2vid")
|
12 |
+
from sync_batchnorm import DataParallelWithCallback
|
13 |
+
from modules.generator import OcclusionAwareSPADEGenerator
|
14 |
+
from modules.keypoint_detector import KPDetector, HEEstimator
|
15 |
+
from animate import normalize_kp
|
16 |
+
from batch_face import RetinaFace
|
17 |
+
|
18 |
+
|
19 |
+
if sys.version_info[0] < 3:
|
20 |
+
raise Exception("You must use Python 3 or higher. Recommended version is Python 3.7")
|
21 |
+
|
22 |
+
|
23 |
+
def load_checkpoints(config_path, checkpoint_path):
|
24 |
+
with open(config_path) as f:
|
25 |
+
config = yaml.load(f, Loader=yaml.FullLoader)
|
26 |
+
|
27 |
+
generator = OcclusionAwareSPADEGenerator(**config["model_params"]["generator_params"], **config["model_params"]["common_params"])
|
28 |
+
# convert to half precision to speed up
|
29 |
+
generator.cuda().half()
|
30 |
+
|
31 |
+
kp_detector = KPDetector(**config["model_params"]["kp_detector_params"], **config["model_params"]["common_params"])
|
32 |
+
# the result will be wrong if converted to half precision, not sure why
|
33 |
+
kp_detector.cuda() # .half()
|
34 |
+
|
35 |
+
he_estimator = HEEstimator(**config["model_params"]["he_estimator_params"], **config["model_params"]["common_params"])
|
36 |
+
# the result will be wrong if converted to half precision, not sure why
|
37 |
+
he_estimator.cuda() # .half()
|
38 |
+
|
39 |
+
print("Loading checkpoints")
|
40 |
+
checkpoint = torch.load(checkpoint_path,map_location=torch.device('cpu'))
|
41 |
+
|
42 |
+
generator.load_state_dict(checkpoint["generator"])
|
43 |
+
kp_detector.load_state_dict(checkpoint["kp_detector"])
|
44 |
+
he_estimator.load_state_dict(checkpoint["he_estimator"])
|
45 |
+
|
46 |
+
generator = DataParallelWithCallback(generator)
|
47 |
+
kp_detector = DataParallelWithCallback(kp_detector)
|
48 |
+
he_estimator = DataParallelWithCallback(he_estimator)
|
49 |
+
|
50 |
+
generator.eval()
|
51 |
+
kp_detector.eval()
|
52 |
+
he_estimator.eval()
|
53 |
+
print("Model successfully loaded!")
|
54 |
+
|
55 |
+
return generator, kp_detector, he_estimator
|
56 |
+
|
57 |
+
|
58 |
+
def headpose_pred_to_degree(pred):
|
59 |
+
device = pred.device
|
60 |
+
idx_tensor = [idx for idx in range(66)]
|
61 |
+
idx_tensor = torch.FloatTensor(idx_tensor).to(device)
|
62 |
+
pred = F.softmax(pred, dim=1)
|
63 |
+
degree = torch.sum(pred * idx_tensor, axis=1) * 3 - 99
|
64 |
+
|
65 |
+
return degree
|
66 |
+
|
67 |
+
|
68 |
+
def get_rotation_matrix(yaw, pitch, roll):
|
69 |
+
yaw = yaw / 180 * 3.14
|
70 |
+
pitch = pitch / 180 * 3.14
|
71 |
+
roll = roll / 180 * 3.14
|
72 |
+
|
73 |
+
roll = roll.unsqueeze(1)
|
74 |
+
pitch = pitch.unsqueeze(1)
|
75 |
+
yaw = yaw.unsqueeze(1)
|
76 |
+
|
77 |
+
pitch_mat = torch.cat(
|
78 |
+
[
|
79 |
+
torch.ones_like(pitch),
|
80 |
+
torch.zeros_like(pitch),
|
81 |
+
torch.zeros_like(pitch),
|
82 |
+
torch.zeros_like(pitch),
|
83 |
+
torch.cos(pitch),
|
84 |
+
-torch.sin(pitch),
|
85 |
+
torch.zeros_like(pitch),
|
86 |
+
torch.sin(pitch),
|
87 |
+
torch.cos(pitch),
|
88 |
+
],
|
89 |
+
dim=1,
|
90 |
+
)
|
91 |
+
pitch_mat = pitch_mat.view(pitch_mat.shape[0], 3, 3)
|
92 |
+
|
93 |
+
yaw_mat = torch.cat(
|
94 |
+
[
|
95 |
+
torch.cos(yaw),
|
96 |
+
torch.zeros_like(yaw),
|
97 |
+
torch.sin(yaw),
|
98 |
+
torch.zeros_like(yaw),
|
99 |
+
torch.ones_like(yaw),
|
100 |
+
torch.zeros_like(yaw),
|
101 |
+
-torch.sin(yaw),
|
102 |
+
torch.zeros_like(yaw),
|
103 |
+
torch.cos(yaw),
|
104 |
+
],
|
105 |
+
dim=1,
|
106 |
+
)
|
107 |
+
yaw_mat = yaw_mat.view(yaw_mat.shape[0], 3, 3)
|
108 |
+
|
109 |
+
roll_mat = torch.cat(
|
110 |
+
[
|
111 |
+
torch.cos(roll),
|
112 |
+
-torch.sin(roll),
|
113 |
+
torch.zeros_like(roll),
|
114 |
+
torch.sin(roll),
|
115 |
+
torch.cos(roll),
|
116 |
+
torch.zeros_like(roll),
|
117 |
+
torch.zeros_like(roll),
|
118 |
+
torch.zeros_like(roll),
|
119 |
+
torch.ones_like(roll),
|
120 |
+
],
|
121 |
+
dim=1,
|
122 |
+
)
|
123 |
+
roll_mat = roll_mat.view(roll_mat.shape[0], 3, 3)
|
124 |
+
|
125 |
+
rot_mat = torch.einsum("bij,bjk,bkm->bim", pitch_mat, yaw_mat, roll_mat)
|
126 |
+
|
127 |
+
return rot_mat
|
128 |
+
|
129 |
+
|
130 |
+
def keypoint_transformation(kp_canonical, he, estimate_jacobian=False, free_view=False, yaw=0, pitch=0, roll=0, output_coord=False):
|
131 |
+
kp = kp_canonical["value"]
|
132 |
+
if not free_view:
|
133 |
+
yaw, pitch, roll = he["yaw"], he["pitch"], he["roll"]
|
134 |
+
yaw = headpose_pred_to_degree(yaw)
|
135 |
+
pitch = headpose_pred_to_degree(pitch)
|
136 |
+
roll = headpose_pred_to_degree(roll)
|
137 |
+
else:
|
138 |
+
if yaw is not None:
|
139 |
+
yaw = torch.tensor([yaw]).cuda()
|
140 |
+
else:
|
141 |
+
yaw = he["yaw"]
|
142 |
+
yaw = headpose_pred_to_degree(yaw)
|
143 |
+
if pitch is not None:
|
144 |
+
pitch = torch.tensor([pitch]).cuda()
|
145 |
+
else:
|
146 |
+
pitch = he["pitch"]
|
147 |
+
pitch = headpose_pred_to_degree(pitch)
|
148 |
+
if roll is not None:
|
149 |
+
roll = torch.tensor([roll]).cuda()
|
150 |
+
else:
|
151 |
+
roll = he["roll"]
|
152 |
+
roll = headpose_pred_to_degree(roll)
|
153 |
+
|
154 |
+
t, exp = he["t"], he["exp"]
|
155 |
+
|
156 |
+
rot_mat = get_rotation_matrix(yaw, pitch, roll)
|
157 |
+
|
158 |
+
# keypoint rotation
|
159 |
+
kp_rotated = torch.einsum("bmp,bkp->bkm", rot_mat, kp)
|
160 |
+
|
161 |
+
# keypoint translation
|
162 |
+
t = t.unsqueeze_(1).repeat(1, kp.shape[1], 1)
|
163 |
+
kp_t = kp_rotated + t
|
164 |
+
|
165 |
+
# add expression deviation
|
166 |
+
exp = exp.view(exp.shape[0], -1, 3)
|
167 |
+
kp_transformed = kp_t + exp
|
168 |
+
|
169 |
+
if estimate_jacobian:
|
170 |
+
jacobian = kp_canonical["jacobian"]
|
171 |
+
jacobian_transformed = torch.einsum("bmp,bkps->bkms", rot_mat, jacobian)
|
172 |
+
else:
|
173 |
+
jacobian_transformed = None
|
174 |
+
|
175 |
+
if output_coord:
|
176 |
+
return {"value": kp_transformed, "jacobian": jacobian_transformed}, {
|
177 |
+
"yaw": float(yaw.cpu().numpy()),
|
178 |
+
"pitch": float(pitch.cpu().numpy()),
|
179 |
+
"roll": float(roll.cpu().numpy()),
|
180 |
+
}
|
181 |
+
|
182 |
+
return {"value": kp_transformed, "jacobian": jacobian_transformed}
|
183 |
+
|
184 |
+
|
185 |
+
def get_square_face(coords, image):
|
186 |
+
x1, y1, x2, y2 = coords
|
187 |
+
# expand the face region by 1.5 times
|
188 |
+
length = max(x2 - x1, y2 - y1) // 2
|
189 |
+
x1 = x1 - length * 0.5
|
190 |
+
x2 = x2 + length * 0.5
|
191 |
+
y1 = y1 - length * 0.5
|
192 |
+
y2 = y2 + length * 0.5
|
193 |
+
|
194 |
+
# get square image
|
195 |
+
center = (x1 + x2) // 2, (y1 + y2) // 2
|
196 |
+
length = max(x2 - x1, y2 - y1) // 2
|
197 |
+
x1 = max(int(round(center[0] - length)), 0)
|
198 |
+
x2 = min(int(round(center[0] + length)), image.shape[1])
|
199 |
+
y1 = max(int(round(center[1] - length)), 0)
|
200 |
+
y2 = min(int(round(center[1] + length)), image.shape[0])
|
201 |
+
return image[y1:y2, x1:x2]
|
202 |
+
|
203 |
+
|
204 |
+
def smooth_coord(last_coord, current_coord, smooth_factor=0.2):
|
205 |
+
change = np.array(current_coord) - np.array(last_coord)
|
206 |
+
# smooth the change to 0.1 times
|
207 |
+
change = change * smooth_factor
|
208 |
+
return (np.array(last_coord) + np.array(change)).astype(int).tolist()
|
209 |
+
|
210 |
+
|
211 |
+
class FaceAnimationClass:
|
212 |
+
def __init__(self, source_image_path=None, use_sr=False):
|
213 |
+
assert source_image_path is not None, "source_image_path is None, please set source_image_path"
|
214 |
+
config_path = os.path.join(os.path.dirname(__file__), "face_vid2vid/config/vox-256-spade.yaml")
|
215 |
+
# save to local cache to speed loading
|
216 |
+
checkpoint_path = os.path.join(os.path.expanduser("~"), ".cache/torch/hub/checkpoints/FaceMapping.pth.tar")
|
217 |
+
if not os.path.exists(checkpoint_path):
|
218 |
+
os.makedirs(os.path.dirname(checkpoint_path), exist_ok=True)
|
219 |
+
from gdown import download
|
220 |
+
file_id = "11ZgyjKI5OcB7klcsIdPpCCX38AIX8Soc"
|
221 |
+
download(id=file_id, output=checkpoint_path, quiet=False)
|
222 |
+
if use_sr:
|
223 |
+
from face_vid2vid.GPEN.face_enhancement import FaceEnhancement
|
224 |
+
|
225 |
+
self.faceenhancer = FaceEnhancement(
|
226 |
+
size=256, model="GPEN-BFR-256", use_sr=False, sr_model="realesrnet_x2", channel_multiplier=1, narrow=0.5, use_facegan=True
|
227 |
+
)
|
228 |
+
|
229 |
+
# load checkpoints
|
230 |
+
self.generator, self.kp_detector, self.he_estimator = load_checkpoints(config_path=config_path, checkpoint_path=checkpoint_path)
|
231 |
+
source_image = cv2.cvtColor(cv2.imread(source_image_path), cv2.COLOR_RGB2BGR).astype(np.float32) / 255.
|
232 |
+
source_image = cv2.resize(source_image, (256, 256), interpolation=cv2.INTER_AREA)
|
233 |
+
source = torch.tensor(source_image[np.newaxis].astype(np.float32)).permute(0, 3, 1, 2)
|
234 |
+
self.source = source.cuda()
|
235 |
+
|
236 |
+
# initilize face detectors
|
237 |
+
self.face_detector = RetinaFace()
|
238 |
+
self.detect_interval = 8
|
239 |
+
self.smooth_factor = 0.2
|
240 |
+
|
241 |
+
# load base frame and blank frame
|
242 |
+
self.base_frame = cv2.imread(source_image_path) if not use_sr else self.faceenhancer.process(cv2.imread(source_image_path))[0]
|
243 |
+
self.base_frame = cv2.resize(self.base_frame, (256, 256))
|
244 |
+
self.blank_frame = np.ones(self.base_frame.shape, dtype=np.uint8) * 255
|
245 |
+
cv2.putText(self.blank_frame, "Face not", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
246 |
+
cv2.putText(self.blank_frame, "detected!", (50, 100), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
|
247 |
+
|
248 |
+
# count for frame
|
249 |
+
self.n_frame = 0
|
250 |
+
|
251 |
+
# initilize variables
|
252 |
+
self.first_frame = True
|
253 |
+
self.last_coords = None
|
254 |
+
self.coords = None
|
255 |
+
self.use_sr = use_sr
|
256 |
+
self.kp_source = None
|
257 |
+
self.kp_driving_initial = None
|
258 |
+
|
259 |
+
|
260 |
+
def _conver_input_frame(self, frame):
|
261 |
+
frame = cv2.resize(frame, (256, 256), interpolation=cv2.INTER_NEAREST).astype(np.float32) / 255.0
|
262 |
+
return torch.tensor(frame[np.newaxis]).permute(0, 3, 1, 2).cuda()
|
263 |
+
|
264 |
+
def _process_first_frame(self, frame):
|
265 |
+
print("Processing first frame")
|
266 |
+
# function to process the first frame
|
267 |
+
faces = self.face_detector(frame, cv=True)
|
268 |
+
if len(faces) == 0:
|
269 |
+
raise ValueError("Face is not detected")
|
270 |
+
else:
|
271 |
+
self.coords = faces[0][0]
|
272 |
+
face = get_square_face(self.coords, frame)
|
273 |
+
self.last_coords = self.coords
|
274 |
+
|
275 |
+
# get the keypoint and headpose from the source image
|
276 |
+
with torch.no_grad():
|
277 |
+
self.kp_canonical = self.kp_detector(self.source)
|
278 |
+
self.he_source = self.he_estimator(self.source)
|
279 |
+
|
280 |
+
face_input = self._conver_input_frame(face)
|
281 |
+
he_driving_initial = self.he_estimator(face_input)
|
282 |
+
self.kp_driving_initial, coordinates = keypoint_transformation(self.kp_canonical, he_driving_initial, output_coord=True)
|
283 |
+
self.kp_source = keypoint_transformation(
|
284 |
+
self.kp_canonical, self.he_source, free_view=True, yaw=coordinates["yaw"], pitch=coordinates["pitch"], roll=coordinates["roll"]
|
285 |
+
)
|
286 |
+
|
287 |
+
def _inference(self, frame):
|
288 |
+
# function to process the rest frames
|
289 |
+
with torch.no_grad():
|
290 |
+
self.n_frame += 1
|
291 |
+
if self.first_frame:
|
292 |
+
self._process_first_frame(frame)
|
293 |
+
self.first_frame = False
|
294 |
+
else:
|
295 |
+
pass
|
296 |
+
if self.n_frame % self.detect_interval == 0:
|
297 |
+
faces = self.face_detector(frame, cv=True)
|
298 |
+
if len(faces) == 0:
|
299 |
+
raise ValueError("Face is not detected")
|
300 |
+
else:
|
301 |
+
self.coords = faces[0][0]
|
302 |
+
self.coords = smooth_coord(self.last_coords, self.coords, self.smooth_factor)
|
303 |
+
face = get_square_face(self.coords, frame)
|
304 |
+
self.last_coords = self.coords
|
305 |
+
face_input = self._conver_input_frame(face)
|
306 |
+
|
307 |
+
he_driving = self.he_estimator(face_input)
|
308 |
+
kp_driving = keypoint_transformation(self.kp_canonical, he_driving)
|
309 |
+
kp_norm = normalize_kp(
|
310 |
+
kp_source=self.kp_source,
|
311 |
+
kp_driving=kp_driving,
|
312 |
+
kp_driving_initial=self.kp_driving_initial,
|
313 |
+
use_relative_movement=True,
|
314 |
+
adapt_movement_scale=True,
|
315 |
+
)
|
316 |
+
|
317 |
+
out = self.generator(self.source, kp_source=self.kp_source, kp_driving=kp_norm, fp16=True)
|
318 |
+
image = np.transpose(out["prediction"].data.cpu().numpy(), [0, 2, 3, 1])[0]
|
319 |
+
image = (np.array(image).astype(np.float32) * 255).astype(np.uint8)
|
320 |
+
result = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
321 |
+
|
322 |
+
return face, result
|
323 |
+
|
324 |
+
def inference(self, frame):
|
325 |
+
# function to inference, input frame, output cropped face and its result
|
326 |
+
try:
|
327 |
+
if frame is not None:
|
328 |
+
face, result = self._inference(frame)
|
329 |
+
if self.use_sr:
|
330 |
+
result, _, _ = self.faceenhancer.process(result)
|
331 |
+
result = cv2.resize(result, (256, 256))
|
332 |
+
return face, result
|
333 |
+
except Exception as e:
|
334 |
+
print(e)
|
335 |
+
self.first_frame = True
|
336 |
+
self.n_frame = 0
|
337 |
+
return self.blank_frame, self.base_frame
|
338 |
+
|
339 |
+
|
340 |
+
if __name__ == "__main__":
|
341 |
+
from tqdm import tqdm
|
342 |
+
import time
|
343 |
+
faceanimation = FaceAnimationClass(source_image_path="tmp.png", use_sr=False)
|
344 |
+
|
345 |
+
video_path = "driver.mp4"
|
346 |
+
capture = cv2.VideoCapture(video_path)
|
347 |
+
fps = capture.get(cv2.CAP_PROP_FPS)
|
348 |
+
frames = []
|
349 |
+
_, frame = capture.read()
|
350 |
+
while frame is not None:
|
351 |
+
frames.append(frame)
|
352 |
+
_, frame = capture.read()
|
353 |
+
capture.release()
|
354 |
+
|
355 |
+
output_frames = []
|
356 |
+
time_start = time.time()
|
357 |
+
for frame in tqdm(frames):
|
358 |
+
face, result = faceanimation.inference(frame)
|
359 |
+
# show = cv2.hconcat([cv2.resize(face, (result.shape[1], result.shape[0])), result])
|
360 |
+
output_frames.append(result)
|
361 |
+
time_end = time.time()
|
362 |
+
print("Time cost: %.2f" % (time_end - time_start), "FPS: %.2f" % (len(frames) / (time_end - time_start)))
|
363 |
+
writer = imageio.get_writer("result2.mp4", fps=fps, quality=9, macro_block_size=1, codec="libx264", pixelformat="yuv420p")
|
364 |
+
for frame in output_frames:
|
365 |
+
writer.append_data(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
366 |
+
# writer.append_data(frame)
|
367 |
+
writer.close()
|
368 |
+
print("Video saved to result2.mp4")
|
face_vid2vid/frames_dataset.py
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from skimage import io, img_as_float32
|
3 |
+
from skimage.color import gray2rgb
|
4 |
+
from sklearn.model_selection import train_test_split
|
5 |
+
from imageio import mimread
|
6 |
+
|
7 |
+
import numpy as np
|
8 |
+
from torch.utils.data import Dataset
|
9 |
+
import pandas as pd
|
10 |
+
from augmentation import AllAugmentationTransform
|
11 |
+
import glob
|
12 |
+
|
13 |
+
|
14 |
+
def read_video(name, frame_shape):
|
15 |
+
"""
|
16 |
+
Read video which can be:
|
17 |
+
- an image of concatenated frames
|
18 |
+
- '.mp4' and'.gif'
|
19 |
+
- folder with videos
|
20 |
+
"""
|
21 |
+
|
22 |
+
if os.path.isdir(name):
|
23 |
+
frames = sorted(os.listdir(name))
|
24 |
+
num_frames = len(frames)
|
25 |
+
video_array = np.array(
|
26 |
+
[img_as_float32(io.imread(os.path.join(name, frames[idx]))) for idx in range(num_frames)])
|
27 |
+
elif name.lower().endswith('.png') or name.lower().endswith('.jpg'):
|
28 |
+
image = io.imread(name)
|
29 |
+
|
30 |
+
if len(image.shape) == 2 or image.shape[2] == 1:
|
31 |
+
image = gray2rgb(image)
|
32 |
+
|
33 |
+
if image.shape[2] == 4:
|
34 |
+
image = image[..., :3]
|
35 |
+
|
36 |
+
image = img_as_float32(image)
|
37 |
+
|
38 |
+
video_array = np.moveaxis(image, 1, 0)
|
39 |
+
|
40 |
+
video_array = video_array.reshape((-1,) + frame_shape)
|
41 |
+
video_array = np.moveaxis(video_array, 1, 2)
|
42 |
+
elif name.lower().endswith('.gif') or name.lower().endswith('.mp4') or name.lower().endswith('.mov'):
|
43 |
+
video = np.array(mimread(name))
|
44 |
+
if len(video.shape) == 3:
|
45 |
+
video = np.array([gray2rgb(frame) for frame in video])
|
46 |
+
if video.shape[-1] == 4:
|
47 |
+
video = video[..., :3]
|
48 |
+
video_array = img_as_float32(video)
|
49 |
+
else:
|
50 |
+
raise Exception("Unknown file extensions %s" % name)
|
51 |
+
|
52 |
+
return video_array
|
53 |
+
|
54 |
+
|
55 |
+
class FramesDataset(Dataset):
|
56 |
+
"""
|
57 |
+
Dataset of videos, each video can be represented as:
|
58 |
+
- an image of concatenated frames
|
59 |
+
- '.mp4' or '.gif'
|
60 |
+
- folder with all frames
|
61 |
+
"""
|
62 |
+
|
63 |
+
def __init__(self, root_dir, frame_shape=(256, 256, 3), id_sampling=False, is_train=True,
|
64 |
+
random_seed=0, pairs_list=None, augmentation_params=None):
|
65 |
+
self.root_dir = root_dir
|
66 |
+
self.videos = os.listdir(root_dir)
|
67 |
+
self.frame_shape = tuple(frame_shape)
|
68 |
+
self.pairs_list = pairs_list
|
69 |
+
self.id_sampling = id_sampling
|
70 |
+
if os.path.exists(os.path.join(root_dir, 'train')):
|
71 |
+
assert os.path.exists(os.path.join(root_dir, 'test'))
|
72 |
+
print("Use predefined train-test split.")
|
73 |
+
if id_sampling:
|
74 |
+
train_videos = {os.path.basename(video).split('#')[0] for video in
|
75 |
+
os.listdir(os.path.join(root_dir, 'train'))}
|
76 |
+
train_videos = list(train_videos)
|
77 |
+
else:
|
78 |
+
train_videos = os.listdir(os.path.join(root_dir, 'train'))
|
79 |
+
test_videos = os.listdir(os.path.join(root_dir, 'test'))
|
80 |
+
self.root_dir = os.path.join(self.root_dir, 'train' if is_train else 'test')
|
81 |
+
else:
|
82 |
+
print("Use random train-test split.")
|
83 |
+
train_videos, test_videos = train_test_split(self.videos, random_state=random_seed, test_size=0.2)
|
84 |
+
|
85 |
+
if is_train:
|
86 |
+
self.videos = train_videos
|
87 |
+
else:
|
88 |
+
self.videos = test_videos
|
89 |
+
|
90 |
+
self.is_train = is_train
|
91 |
+
|
92 |
+
if self.is_train:
|
93 |
+
self.transform = AllAugmentationTransform(**augmentation_params)
|
94 |
+
else:
|
95 |
+
self.transform = None
|
96 |
+
|
97 |
+
def __len__(self):
|
98 |
+
return len(self.videos)
|
99 |
+
|
100 |
+
def __getitem__(self, idx):
|
101 |
+
if self.is_train and self.id_sampling:
|
102 |
+
name = self.videos[idx]
|
103 |
+
path = np.random.choice(glob.glob(os.path.join(self.root_dir, name + '*.mp4')))
|
104 |
+
else:
|
105 |
+
name = self.videos[idx]
|
106 |
+
path = os.path.join(self.root_dir, name)
|
107 |
+
|
108 |
+
video_name = os.path.basename(path)
|
109 |
+
|
110 |
+
if self.is_train and os.path.isdir(path):
|
111 |
+
frames = os.listdir(path)
|
112 |
+
num_frames = len(frames)
|
113 |
+
frame_idx = np.sort(np.random.choice(num_frames, replace=True, size=2))
|
114 |
+
video_array = [img_as_float32(io.imread(os.path.join(path, frames[idx]))) for idx in frame_idx]
|
115 |
+
else:
|
116 |
+
video_array = read_video(path, frame_shape=self.frame_shape)
|
117 |
+
num_frames = len(video_array)
|
118 |
+
frame_idx = np.sort(np.random.choice(num_frames, replace=True, size=2)) if self.is_train else range(
|
119 |
+
num_frames)
|
120 |
+
video_array = video_array[frame_idx]
|
121 |
+
|
122 |
+
if self.transform is not None:
|
123 |
+
video_array = self.transform(video_array)
|
124 |
+
|
125 |
+
out = {}
|
126 |
+
if self.is_train:
|
127 |
+
source = np.array(video_array[0], dtype='float32')
|
128 |
+
driving = np.array(video_array[1], dtype='float32')
|
129 |
+
|
130 |
+
out['driving'] = driving.transpose((2, 0, 1))
|
131 |
+
out['source'] = source.transpose((2, 0, 1))
|
132 |
+
else:
|
133 |
+
video = np.array(video_array, dtype='float32')
|
134 |
+
out['video'] = video.transpose((3, 0, 1, 2))
|
135 |
+
|
136 |
+
out['name'] = video_name
|
137 |
+
|
138 |
+
return out
|
139 |
+
|
140 |
+
|
141 |
+
class DatasetRepeater(Dataset):
|
142 |
+
"""
|
143 |
+
Pass several times over the same dataset for better i/o performance
|
144 |
+
"""
|
145 |
+
|
146 |
+
def __init__(self, dataset, num_repeats=100):
|
147 |
+
self.dataset = dataset
|
148 |
+
self.num_repeats = num_repeats
|
149 |
+
|
150 |
+
def __len__(self):
|
151 |
+
return self.num_repeats * self.dataset.__len__()
|
152 |
+
|
153 |
+
def __getitem__(self, idx):
|
154 |
+
return self.dataset[idx % self.dataset.__len__()]
|
face_vid2vid/logger.py
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import torch
|
3 |
+
import torch.nn.functional as F
|
4 |
+
import imageio
|
5 |
+
|
6 |
+
import os
|
7 |
+
from skimage.draw import circle_perimeter
|
8 |
+
|
9 |
+
import matplotlib.pyplot as plt
|
10 |
+
import collections
|
11 |
+
|
12 |
+
|
13 |
+
class Logger:
|
14 |
+
def __init__(self, log_dir, checkpoint_freq=100, visualizer_params=None, zfill_num=8, log_file_name="log.txt"):
|
15 |
+
self.loss_list = []
|
16 |
+
self.cpk_dir = log_dir
|
17 |
+
self.visualizations_dir = os.path.join(log_dir, "train-vis")
|
18 |
+
if not os.path.exists(self.visualizations_dir):
|
19 |
+
os.makedirs(self.visualizations_dir)
|
20 |
+
self.log_file = open(os.path.join(log_dir, log_file_name), "a")
|
21 |
+
self.zfill_num = zfill_num
|
22 |
+
self.visualizer = Visualizer(**visualizer_params)
|
23 |
+
self.checkpoint_freq = checkpoint_freq
|
24 |
+
self.epoch = 0
|
25 |
+
self.best_loss = float("inf")
|
26 |
+
self.names = None
|
27 |
+
|
28 |
+
def log_scores(self, loss_names):
|
29 |
+
loss_mean = np.array(self.loss_list).mean(axis=0)
|
30 |
+
|
31 |
+
loss_string = "; ".join(["%s - %.5f" % (name, value) for name, value in zip(loss_names, loss_mean)])
|
32 |
+
loss_string = str(self.epoch).zfill(self.zfill_num) + ") " + loss_string
|
33 |
+
|
34 |
+
print(loss_string, file=self.log_file)
|
35 |
+
self.loss_list = []
|
36 |
+
self.log_file.flush()
|
37 |
+
|
38 |
+
def visualize_rec(self, inp, out):
|
39 |
+
image = self.visualizer.visualize(inp["driving"], inp["source"], out)
|
40 |
+
imageio.imsave(os.path.join(self.visualizations_dir, "%s-rec.png" % str(self.epoch).zfill(self.zfill_num)), image)
|
41 |
+
|
42 |
+
def save_cpk(self, emergent=False):
|
43 |
+
cpk = {k: v.state_dict() for k, v in self.models.items()}
|
44 |
+
cpk["epoch"] = self.epoch
|
45 |
+
cpk_path = os.path.join(self.cpk_dir, "%s-checkpoint.pth.tar" % str(self.epoch).zfill(self.zfill_num))
|
46 |
+
if not (os.path.exists(cpk_path) and emergent):
|
47 |
+
torch.save(cpk, cpk_path)
|
48 |
+
|
49 |
+
@staticmethod
|
50 |
+
def load_cpk(
|
51 |
+
checkpoint_path,
|
52 |
+
generator=None,
|
53 |
+
discriminator=None,
|
54 |
+
kp_detector=None,
|
55 |
+
he_estimator=None,
|
56 |
+
optimizer_generator=None,
|
57 |
+
optimizer_discriminator=None,
|
58 |
+
optimizer_kp_detector=None,
|
59 |
+
optimizer_he_estimator=None,
|
60 |
+
):
|
61 |
+
checkpoint = torch.load(checkpoint_path,map_location=torch.device('cpu'))
|
62 |
+
if generator is not None:
|
63 |
+
generator.load_state_dict(checkpoint["generator"])
|
64 |
+
if kp_detector is not None:
|
65 |
+
kp_detector.load_state_dict(checkpoint["kp_detector"])
|
66 |
+
if he_estimator is not None:
|
67 |
+
he_estimator.load_state_dict(checkpoint["he_estimator"])
|
68 |
+
if discriminator is not None:
|
69 |
+
try:
|
70 |
+
discriminator.load_state_dict(checkpoint["discriminator"])
|
71 |
+
except:
|
72 |
+
print("No discriminator in the state-dict. Dicriminator will be randomly initialized")
|
73 |
+
if optimizer_generator is not None:
|
74 |
+
optimizer_generator.load_state_dict(checkpoint["optimizer_generator"])
|
75 |
+
if optimizer_discriminator is not None:
|
76 |
+
try:
|
77 |
+
optimizer_discriminator.load_state_dict(checkpoint["optimizer_discriminator"])
|
78 |
+
except RuntimeError as e:
|
79 |
+
print("No discriminator optimizer in the state-dict. Optimizer will be not initialized")
|
80 |
+
if optimizer_kp_detector is not None:
|
81 |
+
optimizer_kp_detector.load_state_dict(checkpoint["optimizer_kp_detector"])
|
82 |
+
if optimizer_he_estimator is not None:
|
83 |
+
optimizer_he_estimator.load_state_dict(checkpoint["optimizer_he_estimator"])
|
84 |
+
|
85 |
+
return checkpoint["epoch"]
|
86 |
+
|
87 |
+
def __enter__(self):
|
88 |
+
return self
|
89 |
+
|
90 |
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
91 |
+
if "models" in self.__dict__:
|
92 |
+
self.save_cpk()
|
93 |
+
self.log_file.close()
|
94 |
+
|
95 |
+
def log_iter(self, losses):
|
96 |
+
losses = collections.OrderedDict(losses.items())
|
97 |
+
if self.names is None:
|
98 |
+
self.names = list(losses.keys())
|
99 |
+
self.loss_list.append(list(losses.values()))
|
100 |
+
|
101 |
+
def log_epoch(self, epoch, models, inp, out):
|
102 |
+
self.epoch = epoch
|
103 |
+
self.models = models
|
104 |
+
if (self.epoch + 1) % self.checkpoint_freq == 0:
|
105 |
+
self.save_cpk()
|
106 |
+
self.log_scores(self.names)
|
107 |
+
self.visualize_rec(inp, out)
|
108 |
+
|
109 |
+
|
110 |
+
class Visualizer:
|
111 |
+
def __init__(self, kp_size=5, draw_border=False, colormap="gist_rainbow"):
|
112 |
+
self.kp_size = kp_size
|
113 |
+
self.draw_border = draw_border
|
114 |
+
self.colormap = plt.get_cmap(colormap)
|
115 |
+
|
116 |
+
def draw_image_with_kp(self, image, kp_array):
|
117 |
+
image = np.copy(image)
|
118 |
+
spatial_size = np.array(image.shape[:2][::-1])[np.newaxis]
|
119 |
+
kp_array = spatial_size * (kp_array + 1) / 2
|
120 |
+
num_kp = kp_array.shape[0]
|
121 |
+
for kp_ind, kp in enumerate(kp_array):
|
122 |
+
rr, cc = circle_perimeter(kp[1], kp[0], self.kp_size, shape=image.shape[:2])
|
123 |
+
image[rr, cc] = np.array(self.colormap(kp_ind / num_kp))[:3]
|
124 |
+
return image
|
125 |
+
|
126 |
+
def create_image_column_with_kp(self, images, kp):
|
127 |
+
image_array = np.array([self.draw_image_with_kp(v, k) for v, k in zip(images, kp)])
|
128 |
+
return self.create_image_column(image_array)
|
129 |
+
|
130 |
+
def create_image_column(self, images):
|
131 |
+
if self.draw_border:
|
132 |
+
images = np.copy(images)
|
133 |
+
images[:, :, [0, -1]] = (1, 1, 1)
|
134 |
+
images[:, :, [0, -1]] = (1, 1, 1)
|
135 |
+
return np.concatenate(list(images), axis=0)
|
136 |
+
|
137 |
+
def create_image_grid(self, *args):
|
138 |
+
out = []
|
139 |
+
for arg in args:
|
140 |
+
if type(arg) == tuple:
|
141 |
+
out.append(self.create_image_column_with_kp(arg[0], arg[1]))
|
142 |
+
else:
|
143 |
+
out.append(self.create_image_column(arg))
|
144 |
+
return np.concatenate(out, axis=1)
|
145 |
+
|
146 |
+
def visualize(self, driving, source, out):
|
147 |
+
images = []
|
148 |
+
|
149 |
+
# Source image with keypoints
|
150 |
+
source = source.data.cpu()
|
151 |
+
kp_source = out["kp_source"]["value"][:, :, :2].data.cpu().numpy() # 3d -> 2d
|
152 |
+
source = np.transpose(source, [0, 2, 3, 1])
|
153 |
+
images.append((source, kp_source))
|
154 |
+
|
155 |
+
# Equivariance visualization
|
156 |
+
if "transformed_frame" in out:
|
157 |
+
transformed = out["transformed_frame"].data.cpu().numpy()
|
158 |
+
transformed = np.transpose(transformed, [0, 2, 3, 1])
|
159 |
+
transformed_kp = out["transformed_kp"]["value"][:, :, :2].data.cpu().numpy() # 3d -> 2d
|
160 |
+
images.append((transformed, transformed_kp))
|
161 |
+
|
162 |
+
# Driving image with keypoints
|
163 |
+
kp_driving = out["kp_driving"]["value"][:, :, :2].data.cpu().numpy() # 3d -> 2d
|
164 |
+
driving = driving.data.cpu().numpy()
|
165 |
+
driving = np.transpose(driving, [0, 2, 3, 1])
|
166 |
+
images.append((driving, kp_driving))
|
167 |
+
|
168 |
+
# Result
|
169 |
+
prediction = out["prediction"].data.cpu().numpy()
|
170 |
+
prediction = np.transpose(prediction, [0, 2, 3, 1])
|
171 |
+
images.append(prediction)
|
172 |
+
|
173 |
+
## Occlusion map
|
174 |
+
if "occlusion_map" in out:
|
175 |
+
occlusion_map = out["occlusion_map"].data.cpu().repeat(1, 3, 1, 1)
|
176 |
+
occlusion_map = F.interpolate(occlusion_map, size=source.shape[1:3]).numpy()
|
177 |
+
occlusion_map = np.transpose(occlusion_map, [0, 2, 3, 1])
|
178 |
+
images.append(occlusion_map)
|
179 |
+
|
180 |
+
## Mask
|
181 |
+
if "mask" in out:
|
182 |
+
for i in range(out["mask"].shape[1]):
|
183 |
+
mask = out["mask"][:, i : (i + 1)].data.cpu().sum(2).repeat(1, 3, 1, 1) # (n, 3, h, w)
|
184 |
+
# mask = F.softmax(mask.view(mask.shape[0], mask.shape[1], -1), dim=2).view(mask.shape)
|
185 |
+
mask = F.interpolate(mask, size=source.shape[1:3]).numpy()
|
186 |
+
mask = np.transpose(mask, [0, 2, 3, 1])
|
187 |
+
|
188 |
+
if i != 0:
|
189 |
+
color = np.array(self.colormap((i - 1) / (out["mask"].shape[1] - 1)))[:3]
|
190 |
+
else:
|
191 |
+
color = np.array((0, 0, 0))
|
192 |
+
|
193 |
+
color = color.reshape((1, 1, 1, 3))
|
194 |
+
|
195 |
+
if i != 0:
|
196 |
+
images.append(mask * color)
|
197 |
+
else:
|
198 |
+
images.append(mask)
|
199 |
+
|
200 |
+
image = self.create_image_grid(*images)
|
201 |
+
image = (255 * image).astype(np.uint8)
|
202 |
+
return image
|
face_vid2vid/modules/dense_motion.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from torch import nn
|
2 |
+
import torch.nn.functional as F
|
3 |
+
import torch
|
4 |
+
from face_vid2vid.modules.util import Hourglass, make_coordinate_grid, kp2gaussian
|
5 |
+
|
6 |
+
from face_vid2vid.sync_batchnorm.batchnorm import SynchronizedBatchNorm3d as BatchNorm3d
|
7 |
+
|
8 |
+
|
9 |
+
class DenseMotionNetwork(nn.Module):
|
10 |
+
"""
|
11 |
+
Module that predicting a dense motion from sparse motion representation given by kp_source and kp_driving
|
12 |
+
"""
|
13 |
+
|
14 |
+
def __init__(self, block_expansion, num_blocks, max_features, num_kp, feature_channel, reshape_depth, compress,
|
15 |
+
estimate_occlusion_map=False):
|
16 |
+
super(DenseMotionNetwork, self).__init__()
|
17 |
+
# self.hourglass = Hourglass(block_expansion=block_expansion, in_features=(num_kp+1)*(feature_channel+1), max_features=max_features, num_blocks=num_blocks)
|
18 |
+
self.hourglass = Hourglass(block_expansion=block_expansion, in_features=(num_kp+1)*(compress+1), max_features=max_features, num_blocks=num_blocks)
|
19 |
+
|
20 |
+
self.mask = nn.Conv3d(self.hourglass.out_filters, num_kp + 1, kernel_size=7, padding=3)
|
21 |
+
|
22 |
+
self.compress = nn.Conv3d(feature_channel, compress, kernel_size=1)
|
23 |
+
self.norm = BatchNorm3d(compress, affine=True)
|
24 |
+
|
25 |
+
if estimate_occlusion_map:
|
26 |
+
# self.occlusion = nn.Conv2d(reshape_channel*reshape_depth, 1, kernel_size=7, padding=3)
|
27 |
+
self.occlusion = nn.Conv2d(self.hourglass.out_filters*reshape_depth, 1, kernel_size=7, padding=3)
|
28 |
+
else:
|
29 |
+
self.occlusion = None
|
30 |
+
|
31 |
+
self.num_kp = num_kp
|
32 |
+
|
33 |
+
|
34 |
+
def create_sparse_motions(self, feature, kp_driving, kp_source):
|
35 |
+
bs, _, d, h, w = feature.shape
|
36 |
+
identity_grid = make_coordinate_grid((d, h, w), type=kp_source['value'].type())
|
37 |
+
identity_grid = identity_grid.view(1, 1, d, h, w, 3)
|
38 |
+
coordinate_grid = identity_grid - kp_driving['value'].view(bs, self.num_kp, 1, 1, 1, 3)
|
39 |
+
|
40 |
+
k = coordinate_grid.shape[1]
|
41 |
+
|
42 |
+
# if 'jacobian' in kp_driving:
|
43 |
+
if 'jacobian' in kp_driving and kp_driving['jacobian'] is not None:
|
44 |
+
jacobian = torch.matmul(kp_source['jacobian'], torch.inverse(kp_driving['jacobian']))
|
45 |
+
jacobian = jacobian.unsqueeze(-3).unsqueeze(-3).unsqueeze(-3)
|
46 |
+
jacobian = jacobian.repeat(1, 1, d, h, w, 1, 1)
|
47 |
+
coordinate_grid = torch.matmul(jacobian, coordinate_grid.unsqueeze(-1))
|
48 |
+
coordinate_grid = coordinate_grid.squeeze(-1)
|
49 |
+
'''
|
50 |
+
if 'rot' in kp_driving:
|
51 |
+
rot_s = kp_source['rot']
|
52 |
+
rot_d = kp_driving['rot']
|
53 |
+
rot = torch.einsum('bij, bjk->bki', rot_s, torch.inverse(rot_d))
|
54 |
+
rot = rot.unsqueeze(-3).unsqueeze(-3).unsqueeze(-3).unsqueeze(-3)
|
55 |
+
rot = rot.repeat(1, k, d, h, w, 1, 1)
|
56 |
+
# print(rot.shape)
|
57 |
+
coordinate_grid = torch.matmul(rot, coordinate_grid.unsqueeze(-1))
|
58 |
+
coordinate_grid = coordinate_grid.squeeze(-1)
|
59 |
+
# print(coordinate_grid.shape)
|
60 |
+
'''
|
61 |
+
driving_to_source = coordinate_grid + kp_source['value'].view(bs, self.num_kp, 1, 1, 1, 3) # (bs, num_kp, d, h, w, 3)
|
62 |
+
|
63 |
+
#adding background feature
|
64 |
+
identity_grid = identity_grid.repeat(bs, 1, 1, 1, 1, 1)
|
65 |
+
sparse_motions = torch.cat([identity_grid, driving_to_source], dim=1)
|
66 |
+
|
67 |
+
# sparse_motions = driving_to_source
|
68 |
+
|
69 |
+
return sparse_motions
|
70 |
+
|
71 |
+
def create_deformed_feature(self, feature, sparse_motions):
|
72 |
+
bs, _, d, h, w = feature.shape
|
73 |
+
feature_repeat = feature.unsqueeze(1).unsqueeze(1).repeat(1, self.num_kp+1, 1, 1, 1, 1, 1) # (bs, num_kp+1, 1, c, d, h, w)
|
74 |
+
feature_repeat = feature_repeat.view(bs * (self.num_kp+1), -1, d, h, w) # (bs*(num_kp+1), c, d, h, w)
|
75 |
+
sparse_motions = sparse_motions.view((bs * (self.num_kp+1), d, h, w, -1)) # (bs*(num_kp+1), d, h, w, 3)
|
76 |
+
sparse_deformed = F.grid_sample(feature_repeat, sparse_motions)
|
77 |
+
sparse_deformed = sparse_deformed.view((bs, self.num_kp+1, -1, d, h, w)) # (bs, num_kp+1, c, d, h, w)
|
78 |
+
return sparse_deformed
|
79 |
+
|
80 |
+
def create_heatmap_representations(self, feature, kp_driving, kp_source):
|
81 |
+
spatial_size = feature.shape[3:]
|
82 |
+
gaussian_driving = kp2gaussian(kp_driving, spatial_size=spatial_size, kp_variance=0.01)
|
83 |
+
gaussian_source = kp2gaussian(kp_source, spatial_size=spatial_size, kp_variance=0.01)
|
84 |
+
heatmap = gaussian_driving - gaussian_source
|
85 |
+
|
86 |
+
# adding background feature
|
87 |
+
zeros = torch.zeros(heatmap.shape[0], 1, spatial_size[0], spatial_size[1], spatial_size[2]).type(heatmap.type())
|
88 |
+
heatmap = torch.cat([zeros, heatmap], dim=1)
|
89 |
+
heatmap = heatmap.unsqueeze(2) # (bs, num_kp+1, 1, d, h, w)
|
90 |
+
return heatmap
|
91 |
+
|
92 |
+
def forward(self, feature, kp_driving, kp_source):
|
93 |
+
bs, _, d, h, w = feature.shape
|
94 |
+
|
95 |
+
feature = self.compress(feature)
|
96 |
+
feature = self.norm(feature)
|
97 |
+
feature = F.relu(feature)
|
98 |
+
|
99 |
+
out_dict = dict()
|
100 |
+
sparse_motion = self.create_sparse_motions(feature, kp_driving, kp_source)
|
101 |
+
deformed_feature = self.create_deformed_feature(feature, sparse_motion)
|
102 |
+
|
103 |
+
heatmap = self.create_heatmap_representations(deformed_feature, kp_driving, kp_source)
|
104 |
+
|
105 |
+
input = torch.cat([heatmap, deformed_feature], dim=2)
|
106 |
+
input = input.view(bs, -1, d, h, w)
|
107 |
+
|
108 |
+
# input = deformed_feature.view(bs, -1, d, h, w) # (bs, num_kp+1 * c, d, h, w)
|
109 |
+
|
110 |
+
prediction = self.hourglass(input)
|
111 |
+
|
112 |
+
mask = self.mask(prediction)
|
113 |
+
mask = F.softmax(mask, dim=1)
|
114 |
+
out_dict['mask'] = mask
|
115 |
+
mask = mask.unsqueeze(2) # (bs, num_kp+1, 1, d, h, w)
|
116 |
+
sparse_motion = sparse_motion.permute(0, 1, 5, 2, 3, 4) # (bs, num_kp+1, 3, d, h, w)
|
117 |
+
deformation = (sparse_motion * mask).sum(dim=1) # (bs, 3, d, h, w)
|
118 |
+
deformation = deformation.permute(0, 2, 3, 4, 1) # (bs, d, h, w, 3)
|
119 |
+
|
120 |
+
out_dict['deformation'] = deformation
|
121 |
+
|
122 |
+
if self.occlusion:
|
123 |
+
bs, c, d, h, w = prediction.shape
|
124 |
+
prediction = prediction.view(bs, -1, h, w)
|
125 |
+
occlusion_map = torch.sigmoid(self.occlusion(prediction))
|
126 |
+
out_dict['occlusion_map'] = occlusion_map
|
127 |
+
|
128 |
+
return out_dict
|