From 22b0865455c4fe36cfed023e4efc916e8fc53462 Mon Sep 17 00:00:00 2001 From: Colombo Date: Sun, 8 Mar 2020 10:47:04 +0400 Subject: [PATCH] upd FANSeg --- models/Model_FANSeg/Model.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/models/Model_FANSeg/Model.py b/models/Model_FANSeg/Model.py index 3cb3990..96146b4 100644 --- a/models/Model_FANSeg/Model.py +++ b/models/Model_FANSeg/Model.py @@ -163,14 +163,15 @@ class FANSegModel(ModelBase): src_samples, dst_samples = 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) ) ] - T, SM, = [ np.repeat (x, (3,), -1) for x in [T, SM] ] + S, TM, SM, = [ np.clip(x, 0.0, 1.0) for x in ([source_np,target_np] + self.view (source_np) ) ] + TM, SM, = [ np.repeat (x, (3,), -1) for x in [TM, SM] ] - result = [] - + green_bg = np.tile( np.array([0,1,0], dtype=np.float32)[None,None,...], (self.resolution,self.resolution,1) ) + + result = [] st = [] 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 st.append ( np.concatenate ( ar, axis=1) ) result += [ ('FANSeg training faces', np.concatenate (st, axis=0 )), ] @@ -183,7 +184,7 @@ class FANSegModel(ModelBase): st = [] 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 st.append ( np.concatenate ( ar, axis=1) )