Add files using upload-large-folder tool
Browse files- .gitattributes +3 -0
- BFM/BFM_exp_idx.mat +0 -0
- BFM/BFM_front_idx.mat +0 -0
- BFM/BFM_model_front.mat +3 -0
- BFM/facemodel_info.mat +3 -0
- BFM/mSEmTFK68etc.chj +3 -0
- BFM/mSEmTFK68etc.nms +11 -0
- BFM/select_vertex_id.mat +0 -0
- BFM/similarity_Lm3D_all.mat +0 -0
- BFM/std_exp.txt +1 -0
- BFM/you may need to get from.txt +3 -0
- CosFace_ACC99.28.pth +3 -0
- faces_landmarks.tar.gz +3 -0
- features_dict.npy +3 -0
- hopenet_robust_alpha1.pkl +3 -0
- network/__pycache__/resnet50_task.cpython-311.pyc +0 -0
- network/__pycache__/resnet50_task.cpython-38.pyc +0 -0
- network/resnet50_task.py +194 -0
- network/th_model_params.pth +3 -0
- network/th_model_params.pth.txt +3 -0
- phase1_wpdc_vdc.pth.tar +3 -0
- pt_inception-2015-12-05-6726825d.pth +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
BFM/mSEmTFK68etc.chj filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
BFM/BFM_model_front.mat filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
BFM/facemodel_info.mat filter=lfs diff=lfs merge=lfs -text
|
BFM/BFM_exp_idx.mat
ADDED
|
Binary file (91.9 kB). View file
|
|
|
BFM/BFM_front_idx.mat
ADDED
|
Binary file (44.9 kB). View file
|
|
|
BFM/BFM_model_front.mat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1bd4995477eea0b34a59f8a7d1d8c8c8604faa5f3f6e49e6098fbbc0c2536e0e
|
| 3 |
+
size 127170280
|
BFM/facemodel_info.mat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:529398f76619ae7e22f43c25dd60a2473bcc2bcc8c894fd9c613c68624ce1c04
|
| 3 |
+
size 738861
|
BFM/mSEmTFK68etc.chj
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2363d8795e4609b71caddf2e7d5cd3f6a9e89f3fd202c570d60998b3711f1b7f
|
| 3 |
+
size 99637917
|
BFM/mSEmTFK68etc.nms
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
meanshape
|
| 2 |
+
idBase
|
| 3 |
+
exBase
|
| 4 |
+
meantex
|
| 5 |
+
texBase
|
| 6 |
+
tri
|
| 7 |
+
keypoints
|
| 8 |
+
frontmask2_idx
|
| 9 |
+
tri_mask2
|
| 10 |
+
point_buf
|
| 11 |
+
skinmask
|
BFM/select_vertex_id.mat
ADDED
|
Binary file (62.3 kB). View file
|
|
|
BFM/similarity_Lm3D_all.mat
ADDED
|
Binary file (994 Bytes). View file
|
|
|
BFM/std_exp.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
453980 257264 263068 211890 135873 184721 47055.6 72732 62787.4 106226 56708.5 51439.8 34887.1 44378.7 51813.4 31030.7 23354.9 23128.1 19400 21827.6 22767.7 22057.4 19894.3 16172.8 17142.7 10035.3 14727.5 12972.5 10763.8 8953.93 8682.62 8941.81 6342.3 5205.3 7065.65 6083.35 6678.88 4666.63 5082.89 5134.76 4908.16 3964.93 3739.95 3180.09 2470.45 1866.62 1624.71 2423.74 1668.53 1471.65 1194.52 782.102 815.044 835.782 834.937 744.496 575.146 633.76 705.685 753.409 620.306 673.326 766.189 619.866 559.93 357.264 396.472 556.849 455.048 460.592 400.735 326.702 279.428 291.535 326.584 305.664 287.816 283.642 276.19
|
BFM/you may need to get from.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
https://github.com/microsoft/Deep3DFaceReconstruction/tree/master/BFM
|
| 2 |
+
|
| 3 |
+
in this repo [https://github.com/microsoft/Deep3DFaceReconstruction]
|
CosFace_ACC99.28.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0761e899de3d5dca03b1d4d202bc4ab8e3b90862dc13155faf72a5febdd3df5e
|
| 3 |
+
size 90675486
|
faces_landmarks.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc4a51b95869ca5ff52eb833346271aa2ac3aa1d423a551f4d3b18d6b2ffcc3a
|
| 3 |
+
size 5007011
|
features_dict.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e34989995c248926751b3e8955cfb3b8f65726e9f05e861765b95444b9d731c8
|
| 3 |
+
size 5380511
|
hopenet_robust_alpha1.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e0c6ddfda0e19a679607480c10875020de29b3984f187ec311c5e0802b6b6d5
|
| 3 |
+
size 95924799
|
network/__pycache__/resnet50_task.cpython-311.pyc
ADDED
|
Binary file (10.5 kB). View file
|
|
|
network/__pycache__/resnet50_task.cpython-38.pyc
ADDED
|
Binary file (5.11 kB). View file
|
|
|
network/resnet50_task.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
import torch.nn.functional as F
|
| 4 |
+
import numpy as np
|
| 5 |
+
import functools
|
| 6 |
+
from collections import OrderedDict
|
| 7 |
+
import random
|
| 8 |
+
import os
|
| 9 |
+
import math
|
| 10 |
+
import pickle
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def load_state_dict(model, fname):
|
| 15 |
+
"""
|
| 16 |
+
Set parameters converted from Caffe models authors of VGGFace2 provide.
|
| 17 |
+
See https://www.robots.ox.ac.uk/~vgg/data/vgg_face2/.
|
| 18 |
+
|
| 19 |
+
Arguments:
|
| 20 |
+
model: model
|
| 21 |
+
fname: file name of parameters converted from a Caffe model, assuming the file format is Pickle.
|
| 22 |
+
"""
|
| 23 |
+
with open(fname, 'rb') as f:
|
| 24 |
+
weights = pickle.load(f, encoding='latin1')
|
| 25 |
+
|
| 26 |
+
own_state = model.state_dict()
|
| 27 |
+
for name, param in weights.items():
|
| 28 |
+
if name in own_state:
|
| 29 |
+
try:
|
| 30 |
+
own_state[name].copy_(torch.from_numpy(param))
|
| 31 |
+
except Exception:
|
| 32 |
+
raise RuntimeError('While copying the parameter named {}, whose dimensions in the model are {} and whose '\
|
| 33 |
+
'dimensions in the checkpoint are {}.'.format(name, own_state[name].size(), param.size()))
|
| 34 |
+
else:
|
| 35 |
+
#raise KeyError('unexpected key "{}" in state_dict'.format(name))
|
| 36 |
+
print('unexpected key "{}" in state_dict'.format(name))
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def conv3x3(in_planes, out_planes, stride=1):
|
| 40 |
+
"""3x3 convolution with padding"""
|
| 41 |
+
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
|
| 42 |
+
padding=1, bias=False)
|
| 43 |
+
|
| 44 |
+
def conv1x1(in_planes, out_planes, bias=True):
|
| 45 |
+
"""3x3 convolution with padding"""
|
| 46 |
+
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1,bias=bias )
|
| 47 |
+
|
| 48 |
+
class Bottleneck(nn.Module):
|
| 49 |
+
expansion = 4
|
| 50 |
+
|
| 51 |
+
def __init__(self, inplanes, planes, stride=1, downsample=None):
|
| 52 |
+
super(Bottleneck, self).__init__()
|
| 53 |
+
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=1, stride=stride, bias=False)
|
| 54 |
+
self.bn1 = nn.BatchNorm2d(planes)
|
| 55 |
+
self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=1, padding=1, bias=False)
|
| 56 |
+
self.bn2 = nn.BatchNorm2d(planes)
|
| 57 |
+
self.conv3 = nn.Conv2d(planes, planes * 4, kernel_size=1, bias=False)
|
| 58 |
+
self.bn3 = nn.BatchNorm2d(planes * 4)
|
| 59 |
+
self.relu = nn.ReLU(inplace=True)
|
| 60 |
+
self.downsample = downsample
|
| 61 |
+
self.stride = stride
|
| 62 |
+
|
| 63 |
+
def forward(self, x):
|
| 64 |
+
residual = x
|
| 65 |
+
|
| 66 |
+
out = self.conv1(x)
|
| 67 |
+
out = self.bn1(out)
|
| 68 |
+
out = self.relu(out)
|
| 69 |
+
|
| 70 |
+
out = self.conv2(out)
|
| 71 |
+
out = self.bn2(out)
|
| 72 |
+
out = self.relu(out)
|
| 73 |
+
|
| 74 |
+
out = self.conv3(out)
|
| 75 |
+
out = self.bn3(out)
|
| 76 |
+
|
| 77 |
+
if self.downsample is not None:
|
| 78 |
+
residual = self.downsample(x)
|
| 79 |
+
|
| 80 |
+
out += residual
|
| 81 |
+
out = self.relu(out)
|
| 82 |
+
|
| 83 |
+
return out
|
| 84 |
+
|
| 85 |
+
class ResNet(nn.Module):
|
| 86 |
+
|
| 87 |
+
def __init__(self, block, layers, num_classes=-1, include_top=True):
|
| 88 |
+
self.inplanes = 64
|
| 89 |
+
super(ResNet, self).__init__()
|
| 90 |
+
self.include_top = include_top
|
| 91 |
+
|
| 92 |
+
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False)
|
| 93 |
+
self.bn1 = nn.BatchNorm2d(64)
|
| 94 |
+
self.relu = nn.ReLU(inplace=True)
|
| 95 |
+
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=0, ceil_mode=True)
|
| 96 |
+
|
| 97 |
+
self.layer1 = self._make_layer(block, 64, layers[0])
|
| 98 |
+
self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
|
| 99 |
+
self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
|
| 100 |
+
self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
|
| 101 |
+
self.avgpool = nn.AvgPool2d(7, stride=1)
|
| 102 |
+
|
| 103 |
+
#self.fc = nn.Linear(512 * block.expansion, num_classes)
|
| 104 |
+
|
| 105 |
+
# CHJ_ADD task use
|
| 106 |
+
self.fc_dims={
|
| 107 |
+
"id": 80,
|
| 108 |
+
"ex": 64,
|
| 109 |
+
"tex": 80,
|
| 110 |
+
"angles":3,
|
| 111 |
+
"gamma":27,
|
| 112 |
+
"XY":2,
|
| 113 |
+
"Z":1}
|
| 114 |
+
|
| 115 |
+
#self.fc_dims_arr=[0] * (1+len(self.fc_dims))
|
| 116 |
+
#for i, (k, v) in enumerate(self.fc_dims.items()):
|
| 117 |
+
# self.fc_dims_arr[i+1] = v + self.fc_dims_arr[i]
|
| 118 |
+
|
| 119 |
+
_outdim = 512 * block.expansion
|
| 120 |
+
'''
|
| 121 |
+
self.fcid = nn.Linear(_outdim, 80)
|
| 122 |
+
self.fcex = nn.Linear(_outdim, 64)
|
| 123 |
+
self.fctex = nn.Linear(_outdim, 80)
|
| 124 |
+
self.fcangles = nn.Linear(_outdim, 3)
|
| 125 |
+
self.fcgamma = nn.Linear(_outdim, 27)
|
| 126 |
+
self.fcXY = nn.Linear(_outdim, 2)
|
| 127 |
+
self.fcZ = nn.Linear(_outdim, 1)
|
| 128 |
+
'''
|
| 129 |
+
self.fcid = conv1x1(_outdim, 80)
|
| 130 |
+
self.fcex = conv1x1(_outdim, 64)
|
| 131 |
+
self.fctex = conv1x1(_outdim, 80)
|
| 132 |
+
self.fcangles = conv1x1(_outdim, 3)
|
| 133 |
+
self.fcgamma = conv1x1(_outdim, 27)
|
| 134 |
+
self.fcXY = conv1x1(_outdim, 2)
|
| 135 |
+
self.fcZ = conv1x1(_outdim, 1)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
self.arr_fc = [self.fcid, self.fcex, self.fctex,
|
| 139 |
+
self.fcangles, self.fcgamma, self.fcXY, self.fcZ]
|
| 140 |
+
|
| 141 |
+
for m in self.modules():
|
| 142 |
+
if isinstance(m, nn.Conv2d):
|
| 143 |
+
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
|
| 144 |
+
m.weight.data.normal_(0, math.sqrt(2. / n))
|
| 145 |
+
elif isinstance(m, nn.BatchNorm2d):
|
| 146 |
+
m.weight.data.fill_(1)
|
| 147 |
+
m.bias.data.zero_()
|
| 148 |
+
|
| 149 |
+
def _make_layer(self, block, planes, blocks, stride=1):
|
| 150 |
+
downsample = None
|
| 151 |
+
if stride != 1 or self.inplanes != planes * block.expansion:
|
| 152 |
+
downsample = nn.Sequential(
|
| 153 |
+
nn.Conv2d(self.inplanes, planes * block.expansion,
|
| 154 |
+
kernel_size=1, stride=stride, bias=False),
|
| 155 |
+
nn.BatchNorm2d(planes * block.expansion),
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
layers = []
|
| 159 |
+
layers.append(block(self.inplanes, planes, stride, downsample))
|
| 160 |
+
self.inplanes = planes * block.expansion
|
| 161 |
+
for i in range(1, blocks):
|
| 162 |
+
layers.append(block(self.inplanes, planes))
|
| 163 |
+
|
| 164 |
+
return nn.Sequential(*layers)
|
| 165 |
+
|
| 166 |
+
def forward(self, x):
|
| 167 |
+
x = self.conv1(x)
|
| 168 |
+
x = self.bn1(x)
|
| 169 |
+
x = self.relu(x)
|
| 170 |
+
x = self.maxpool(x)
|
| 171 |
+
x = self.layer1(x)
|
| 172 |
+
x = self.layer2(x)
|
| 173 |
+
x = self.layer3(x)
|
| 174 |
+
x = self.layer4(x)
|
| 175 |
+
x = self.avgpool(x)
|
| 176 |
+
|
| 177 |
+
# 这里不需要view
|
| 178 |
+
n_b = x.size(0)
|
| 179 |
+
#x = x.view(n_b, -1)
|
| 180 |
+
|
| 181 |
+
#x = self.fc(x) # 打算cat在一起
|
| 182 |
+
outs=[]
|
| 183 |
+
for fc in self.arr_fc:
|
| 184 |
+
outs.append( fc(x).view(n_b, -1) )
|
| 185 |
+
|
| 186 |
+
return outs
|
| 187 |
+
|
| 188 |
+
def resnet50_use():
|
| 189 |
+
"""Constructs a ResNet-50 model.
|
| 190 |
+
"""
|
| 191 |
+
model = ResNet(Bottleneck, [3, 4, 6, 3])
|
| 192 |
+
#load_state_dict(model, fweight_file)
|
| 193 |
+
return model
|
| 194 |
+
|
network/th_model_params.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce3a8ef3e0f87d54d48c3f3ed6d52a8ae3b4f58418c6525359c877856f40a15c
|
| 3 |
+
size 96402711
|
network/th_model_params.pth.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
LINK: https://pan.baidu.com/s/1OJqsBVOt1SudLylsi4WtDQ
|
| 3 |
+
Extraction code: b9bv
|
phase1_wpdc_vdc.pth.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f0fc88a82de06f637ab4520d7448a8ccb224e97059c61018bf6177bf2b0ef99
|
| 3 |
+
size 13193324
|
pt_inception-2015-12-05-6726825d.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6726825d0af5f729cebd5821db510b11b1cfad8faad88a03f1befd49fb9129b2
|
| 3 |
+
size 95628359
|