cached
This commit is contained in:
1 parent
94e27a90ea
commit
d11cb75350
3 files changed
+13
-12
No files matched your search
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Gunwoo Han
|
||||
Copyright (c) 2021 Gunwoo Han, yuyuyzl
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -54,6 +54,8 @@ def create_default_blender_data():
|
||||
return data
|
||||
|
||||
|
||||
ifm_converter = tha2.poser.modes.mode_20_wx.IFacialMocapPoseConverter20()
|
||||
|
||||
class IFMClientProcess(Process):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -170,6 +172,8 @@ class ModelClientProcess(Process):
|
||||
continue
|
||||
if input is None: continue
|
||||
input=[round(x*100)/100 for x in input]
|
||||
input[ifm_converter.iris_rotation_y_index - 12]=round(input[ifm_converter.iris_rotation_y_index - 12]*100)/100
|
||||
input[ifm_converter.iris_rotation_x_index - 12]=round(input[ifm_converter.iris_rotation_x_index - 12]*100)/100
|
||||
input_hash=hash(tuple(input))
|
||||
cached=model_cache.get(input_hash)
|
||||
tot+=1
|
||||
@@ -177,7 +181,7 @@ class ModelClientProcess(Process):
|
||||
self.output_queue.put_nowait(cached)
|
||||
model_cache.move_to_end(input_hash)
|
||||
hit+=1
|
||||
if args.perf:
|
||||
if (args.perf)or hit%100==0:
|
||||
print('cached',str(hit/tot*100)+'%')
|
||||
else:
|
||||
if args.perf:
|
||||
@@ -221,8 +225,6 @@ def main():
|
||||
extra_image = np.array(img.crop((0, 256, img.size[0], img.size[1])))
|
||||
|
||||
print("Character Image Loaded:", args.character)
|
||||
|
||||
ifm_converter = None
|
||||
cap = None
|
||||
|
||||
if not args.debug_input:
|
||||
@@ -231,7 +233,6 @@ def main():
|
||||
client_process = IFMClientProcess()
|
||||
client_process.daemon = True
|
||||
client_process.start()
|
||||
ifm_converter = tha2.poser.modes.mode_20_wx.create_ifacialmocap_pose_converter()
|
||||
print("IFM Service Running:", args.ifm)
|
||||
|
||||
else:
|
||||
|
||||
@@ -86,7 +86,7 @@ class IFacialMocapPoseConverter20(IFacialMocapPoseConverter):
|
||||
self.eyebrow_serious_left_index = pose_parameters.get_parameter_index("eyebrow_serious_left")
|
||||
self.eyebrow_serious_right_index = pose_parameters.get_parameter_index("eyebrow_serious_right")
|
||||
|
||||
self.eye_surprised_left_index = pose_parameters.get_parameter_index("eye_surprised_left")
|
||||
self.eye_surprised_left_index = pose_parameters.get_parameter_index("eye_surprised_left") # 0
|
||||
self.eye_surprised_right_index = pose_parameters.get_parameter_index("eye_surprised_right")
|
||||
self.eye_wink_left_index = pose_parameters.get_parameter_index("eye_wink_left")
|
||||
self.eye_wink_right_index = pose_parameters.get_parameter_index("eye_wink_right")
|
||||
@@ -95,13 +95,13 @@ class IFacialMocapPoseConverter20(IFacialMocapPoseConverter):
|
||||
self.eye_relaxed_left_index = pose_parameters.get_parameter_index("eye_relaxed_left")
|
||||
self.eye_relaxed_right_index = pose_parameters.get_parameter_index("eye_relaxed_right")
|
||||
self.eye_raised_lower_eyelid_left_index = pose_parameters.get_parameter_index("eye_raised_lower_eyelid_left")
|
||||
self.eye_raised_lower_eyelid_right_index = pose_parameters.get_parameter_index("eye_raised_lower_eyelid_right")
|
||||
self.eye_raised_lower_eyelid_right_index = pose_parameters.get_parameter_index("eye_raised_lower_eyelid_right") # 9
|
||||
|
||||
self.iris_small_left_index = pose_parameters.get_parameter_index("iris_small_left")
|
||||
self.iris_small_left_index = pose_parameters.get_parameter_index("iris_small_left")#10
|
||||
self.iris_small_right_index = pose_parameters.get_parameter_index("iris_small_right")
|
||||
|
||||
self.iris_rotation_x_index = pose_parameters.get_parameter_index("iris_rotation_x")
|
||||
self.iris_rotation_y_index = pose_parameters.get_parameter_index("iris_rotation_y")
|
||||
self.iris_rotation_y_index = pose_parameters.get_parameter_index("iris_rotation_y")#13
|
||||
|
||||
self.head_x_index = pose_parameters.get_parameter_index("head_x")
|
||||
self.head_y_index = pose_parameters.get_parameter_index("head_y")
|
||||
@@ -268,9 +268,9 @@ class IFacialMocapPoseConverter20(IFacialMocapPoseConverter):
|
||||
# [decomp.item(0), decomp.item(1), decomp.item(2), decomp.item(3)])
|
||||
pose[self.mouth_aaa_index] = restricted_decomp[0]
|
||||
pose[self.mouth_iii_index] = restricted_decomp[1]
|
||||
# mouth_funnel_denom = self.args.mouth_funnel_max_value - self.args.mouth_funnel_min_value
|
||||
# ooo_alpha = clamp((mouth_funnel - self.args.mouth_funnel_min_value) / mouth_funnel_denom, 0.0, 1.0)
|
||||
ooo_alpha=1
|
||||
mouth_funnel_denom = self.args.mouth_funnel_max_value - self.args.mouth_funnel_min_value
|
||||
ooo_alpha = clamp((mouth_funnel - self.args.mouth_funnel_min_value) / mouth_funnel_denom, 0.0, 1.0)
|
||||
# ooo_alpha = 1
|
||||
uo_value = clamp(restricted_decomp[2] + restricted_decomp[3], 0.0, 1.0)
|
||||
pose[self.mouth_uuu_index] = uo_value * (1.0 - ooo_alpha)
|
||||
pose[self.mouth_ooo_index] = uo_value * ooo_alpha
|
||||
|
||||
Reference in new issue
Block a user