mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-07 21:42:08 -07:00
upd FANSeg
This commit is contained in:
parent
18d93376fc
commit
22b0865455
1 changed files with 7 additions and 6 deletions
|
@ -163,14 +163,15 @@ class FANSegModel(ModelBase):
|
||||||
src_samples, dst_samples = samples
|
src_samples, dst_samples = samples
|
||||||
source_np, target_np = src_samples
|
source_np, target_np = src_samples
|
||||||
|
|
||||||
S, T, SM, = [ np.clip(x, 0.0, 1.0) for x in ([source_np,target_np] + self.view (source_np) ) ]
|
S, TM, SM, = [ np.clip(x, 0.0, 1.0) for x in ([source_np,target_np] + self.view (source_np) ) ]
|
||||||
T, SM, = [ np.repeat (x, (3,), -1) for x in [T, SM] ]
|
TM, SM, = [ np.repeat (x, (3,), -1) for x in [TM, SM] ]
|
||||||
|
|
||||||
|
green_bg = np.tile( np.array([0,1,0], dtype=np.float32)[None,None,...], (self.resolution,self.resolution,1) )
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
st = []
|
st = []
|
||||||
for i in range(n_samples):
|
for i in range(n_samples):
|
||||||
ar = S[i], T[i], SM[i], S[i]*SM[i]
|
ar = S[i]*TM[i]+ green_bg*(1-TM[i]), SM[i], S[i]*SM[i] + green_bg*(1-SM[i])
|
||||||
#todo green bg
|
#todo green bg
|
||||||
st.append ( np.concatenate ( ar, axis=1) )
|
st.append ( np.concatenate ( ar, axis=1) )
|
||||||
result += [ ('FANSeg training faces', np.concatenate (st, axis=0 )), ]
|
result += [ ('FANSeg training faces', np.concatenate (st, axis=0 )), ]
|
||||||
|
@ -183,7 +184,7 @@ class FANSegModel(ModelBase):
|
||||||
|
|
||||||
st = []
|
st = []
|
||||||
for i in range(n_samples):
|
for i in range(n_samples):
|
||||||
ar = D[i], DM[i], D[i]*DM[i]
|
ar = D[i], DM[i], D[i]*DM[i]+ green_bg*(1-DM[i])
|
||||||
#todo green bg
|
#todo green bg
|
||||||
st.append ( np.concatenate ( ar, axis=1) )
|
st.append ( np.concatenate ( ar, axis=1) )
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue