-
Notifications
You must be signed in to change notification settings - Fork 16
/
ConfigTools.py
101 lines (97 loc) · 3.66 KB
/
ConfigTools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import json
import os
configPath='configs/'
# if not os.path.exists(configPath):
# !mkdir configs/
path=configPath+'config0720.txt'
##
resultCode=[{99:'运行报错'},
{100:'dst发送的图片异常'},
{101:'dst发送的图片太小'},
{102:'图片人脸角度太偏'},
{200: 'success'},
{98: 'charterIndex越界'},
]
##
dictObj={
'huba':{
'front':{
'bodyPath':'pic/hubaBody1.png',
'headLeft': 0,
'headRight': 272,
'headLower': 253,
'scaleRatio': 1.6,
'ratioX': 1.0,
'ratioY': 1.1,
'preBias': [0, -0.35],
# [x ratio of face,y ratio of face]bias after align at the eyes
'LMJson':"pic/hubaBody.json", # [[x,y],,,]
'NeckHeight':300,
'lowestValue':10,
'heightGradientBias': 0.6,
'heightGradientBiasBody':0.95,#body gradient: where to start gradient
'addWeightRatio':0.8
},
'side': {
'bodyPath': 'pic/hubaBody1.png',
'headLeft': 0,
'headRight': 272,
'headLower': 253,
'scaleRatio': 1.6,
'ratioX': 1.0,
'ratioY': 1.1,
'preBias': [0, -0.35],
# [x ratio of face,y ratio of face]bias after align at the eyes
'LMJson': "pic/hubaBody.json", # [[x,y],,,]
'NeckHeight': 300,
'lowestValue': 10,
'heightGradientBias': 0.6,
'heightGradientBiasBody':0.95,#body gradient: where to start gradient
'addWeightRatio': 0.8
}
},
'gelute':{
'front':{
'bodyPath':'pic/geluteBody1.png',
'headLeft':160,
'headRight':760,
'headLower':880,
'scaleRatio': 1.3,#enlarge ratio of total pic
'ratioX': 1,#enlarge ratio of x
'ratioY': 1,#enlarge ratio of y
'preBias': [-0.01, 0],
# [x ratio of face,y ratio of face]bias after align at the eyes
'LMJson':"pic/geluteBody.json", # [[x,y],,,] landmark files made by labelme
'NeckHeight':950,#cut of 0~ neckheight from body image
'lowestValue':10,#face gradient: lowest trancparece
'heightGradientBias': 0.6,#face gradient: where to start gradient
'heightGradientBiasBody':0.95,#body gradient: where to start gradient
'addWeightRatio':0.8 #final combine ratio between seamlessclone and hard paste
},
'side':{
'bodyPath':'pic/gelute3.png',
'headLeft':8,
'headRight':360,
'headLower':490,
'scaleRatio': 1.5,#enlarge ratio of total pic
'ratioX': 1,#enlarge ratio of x
'ratioY': 1,#enlarge ratio of y
'preBias': [-0.01, 0],
# [x ratio of face,y ratio of face]bias after align at the eyes
'LMJson':"pic/gelute3.json", # [[x,y],,,] landmark files made by labelme
'NeckHeight':550,#cut of 0~ neckheight from body image
'lowestValue':10,#face gradient: lowest trancparece
'heightGradientBias': 0.6,#face gradient: where to start gradient
'heightGradientBiasBody':0.95,#body gradient: where to start gradient
'addWeightRatio':0.8 #final combine ratio between seamlessclone and hard paste
}
},
}
##
jsObj = json.dumps(dictObj, indent=4) # indent参数是换行和缩进
with open(path,'w') as f:
f.write(jsObj)
##
with open(path) as f:
config = json.load(f)
print(config)