MrMirror21

correct typo

1 -[{"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\reportWebVitals.js":"1","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Landing.js":"2","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Header.js":"3","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\index.js":"4","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Button.js":"5","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\App.js":"6","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Main.js":"7"},{"size":362,"mtime":1606827597211,"results":"8","hashOfConfig":"9"},{"size":0,"mtime":1607082038941,"results":"10","hashOfConfig":"9"},{"size":746,"mtime":1607265954632,"results":"11","hashOfConfig":"9"},{"size":287,"mtime":1607081544438,"results":"12","hashOfConfig":"9"},{"size":353,"mtime":1607264649923,"results":"13","hashOfConfig":"9"},{"size":570,"mtime":1607264613644,"results":"14","hashOfConfig":"9"},{"size":1331,"mtime":1607357137121,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"dlgyj4",{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\reportWebVitals.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Landing.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Header.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\index.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Button.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\App.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Main.js",[]]
...\ No newline at end of file ...\ No newline at end of file
1 +[{"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\reportWebVitals.js":"1","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Landing.js":"2","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Header.js":"3","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\index.js":"4","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Button.js":"5","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\App.js":"6","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Main.js":"7","C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\AnalysisPose.js":"8"},{"size":362,"mtime":1606827597211,"results":"9","hashOfConfig":"10"},{"size":0,"mtime":1607082038941,"results":"11","hashOfConfig":"10"},{"size":746,"mtime":1607265954632,"results":"12","hashOfConfig":"10"},{"size":287,"mtime":1607081544438,"results":"13","hashOfConfig":"10"},{"size":353,"mtime":1607264649923,"results":"14","hashOfConfig":"10"},{"size":570,"mtime":1607264613644,"results":"15","hashOfConfig":"10"},{"size":3214,"mtime":1607500306215,"results":"16","hashOfConfig":"10"},{"size":5932,"mtime":1607499647762,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"dlgyj4",{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\reportWebVitals.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Landing.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Header.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\index.js",[],["35","36"],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\components\\Button.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\App.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\Main.js",[],"C:\\Users\\mylit\\Documents\\OSW-HW\\Straight-Up\\straight-up\\src\\AnalysisPose.js",[],{"ruleId":"37","replacedBy":"38"},{"ruleId":"39","replacedBy":"40"},"no-native-reassign",["41"],"no-negated-in-lhs",["42"],"no-global-assign","no-unsafe-negation"]
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -4874,6 +4874,11 @@ ...@@ -4874,6 +4874,11 @@
4874 "domelementtype": "1" 4874 "domelementtype": "1"
4875 } 4875 }
4876 }, 4876 },
4877 + "dot": {
4878 + "version": "1.1.3",
4879 + "resolved": "https://registry.npmjs.org/dot/-/dot-1.1.3.tgz",
4880 + "integrity": "sha512-/nt74Rm+PcfnirXGEdhZleTwGC2LMnuKTeeTIlI82xb5loBBoXNYzr2ezCroPSMtilK8EZIfcNZwOcHN+ib1Lg=="
4881 + },
4877 "dot-case": { 4882 "dot-case": {
4878 "version": "3.0.4", 4883 "version": "3.0.4",
4879 "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", 4884 "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz",
...@@ -5077,6 +5082,11 @@ ...@@ -5077,6 +5082,11 @@
5077 "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", 5082 "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
5078 "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==" 5083 "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
5079 }, 5084 },
5085 + "env": {
5086 + "version": "0.0.2",
5087 + "resolved": "https://registry.npmjs.org/env/-/env-0.0.2.tgz",
5088 + "integrity": "sha1-UMGfMHsSmkWEW2tobfWzndQNHPA="
5089 + },
5080 "errno": { 5090 "errno": {
5081 "version": "0.1.7", 5091 "version": "0.1.7",
5082 "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", 5092 "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
8 "@testing-library/user-event": "^12.1.10", 8 "@testing-library/user-event": "^12.1.10",
9 "axios": "^0.21.0", 9 "axios": "^0.21.0",
10 "body-parser": "^1.19.0", 10 "body-parser": "^1.19.0",
11 + "dot": "^1.1.3",
11 "dotenv": "^8.2.0", 12 "dotenv": "^8.2.0",
13 + "env": "0.0.2",
12 "express": "^4.17.1", 14 "express": "^4.17.1",
13 "http-proxy-middleware": "^1.0.6", 15 "http-proxy-middleware": "^1.0.6",
14 "moment": "^2.29.1", 16 "moment": "^2.29.1",
......
...@@ -37,28 +37,28 @@ const checkStraight = (resData, position) => { //resData: API로 받은 JSON 객 ...@@ -37,28 +37,28 @@ const checkStraight = (resData, position) => { //resData: API로 받은 JSON 객
37 if (trust_value[ear] < 0.4) { 37 if (trust_value[ear] < 0.4) {
38 return 'error_low_trust_value (keypoint:left_ear:4)' 38 return 'error_low_trust_value (keypoint:left_ear:4)'
39 } 39 }
40 - if (trust_value[ear+1] < 0.4) { 40 + if (trust_value[ear + 1] < 0.4) {
41 return 'error_low_trust_value (keypoint:right_ear:5)' 41 return 'error_low_trust_value (keypoint:right_ear:5)'
42 } 42 }
43 if (trust_value[shoulder] < 0.4) { 43 if (trust_value[shoulder] < 0.4) {
44 return 'error_low_trust_value (keypoint:left_shoulder:6)' 44 return 'error_low_trust_value (keypoint:left_shoulder:6)'
45 } 45 }
46 - if (trust_value[shoulder+1] < 0.4) { 46 + if (trust_value[shoulder + 1] < 0.4) {
47 return 'error_low_trust_value (keypoint:right_shoulder_7)' 47 return 'error_low_trust_value (keypoint:right_shoulder_7)'
48 } 48 }
49 49
50 //왼쪽귀(4)-왼쪽어깨(6) 거리와 오른쪽귀(5)-오른쪽어깨(7) 거리가 30% 이상 차이날 경우 > 좌우편향 50 //왼쪽귀(4)-왼쪽어깨(6) 거리와 오른쪽귀(5)-오른쪽어깨(7) 거리가 30% 이상 차이날 경우 > 좌우편향
51 var d_left = distance(x_position[ear], y_position[ear], x_position[shoulder], y_position[shoulder]); 51 var d_left = distance(x_position[ear], y_position[ear], x_position[shoulder], y_position[shoulder]);
52 - var d_right = distance(x_position[ear+1], y_position[ear+1], x_position[shoulder+1], y_position[shoulder+1]); 52 + var d_right = distance(x_position[ear + 1], y_position[ear + 1], x_position[shoulder + 1], y_position[shoulder + 1]);
53 var gap = difference(d_left, d_right); 53 var gap = difference(d_left, d_right);
54 54
55 - if (gap >= 30) { //기운 각도가 30도를 넘을 경우 55 + if (gap >= 20) { //기운 각도가 20도를 넘을 경우
56 if (d_left > d_right) { //오른쪽으로 기울인 경우 56 if (d_left > d_right) { //오른쪽으로 기울인 경우
57 return 'leaning right by ' + gap + 'percent.'; 57 return 'leaning right by ' + gap + 'percent.';
58 } else if (d_left < d_right) { //왼쪽으로 기울인 경우 58 } else if (d_left < d_right) { //왼쪽으로 기울인 경우
59 return 'leaning left by ' + gap + 'percent.'; 59 return 'leaning left by ' + gap + 'percent.';
60 } 60 }
61 - } else { //기운 각도가 30도 미만인 경우 61 + } else { //기운 각도가 20도 미만인 경우
62 return 'okay'; 62 return 'okay';
63 } 63 }
64 64
...@@ -102,8 +102,3 @@ const checkStraight = (resData, position) => { //resData: API로 받은 JSON 객 ...@@ -102,8 +102,3 @@ const checkStraight = (resData, position) => { //resData: API로 받은 JSON 객
102 } 102 }
103 103
104 export default checkStraight; 104 export default checkStraight;
...\ No newline at end of file ...\ No newline at end of file
105 -/*
106 -console.log(check_straight(response,'front'));
107 -console.log(check_straight(response,'left'));
108 -console.log(check_straight(response,'right'));
109 -*/
...\ No newline at end of file ...\ No newline at end of file
......
1 -var response = JSON.parse([
2 - `{
3 - "area": 101090.2833,
4 - "bbox": [719.4526, 244.1255, 182.7314, 553.2178],
5 - "category_id": 1,
6 - "keypoints": [
7 - 805.4897, 256.4165, 0.8422, 819.5366, 245.0034, 0.8773, 795.8325, 244.1255, 0.8664, 845.8745, 254.6606, 0.8105, 788.8091, 251.1489, 0.5631, 885.3813, 320.5054, 0.7525, 749.3022, 331.9185, 0.7706, 898.5503, 377.5708, 0.7825, 719.4526, 414.4438, 0.7897, 901.1841, 435.5142, 0.7782, 749.3022, 443.4155, 0.8086, 852.02, 504.8706, 0.6854, 785.2974, 511.894, 0.6738, 833.5835, 644.4614, 0.7899, 800.2222, 659.3862, 0.7655, 833.5835, 796.3433, 0.7055, 824.8042, 743.6675, 0.5165
8 - ],
9 - "score": 0.7185
10 - }`
11 -]);
12 -console.log(response);
13 -
14 -//두 좌표 사이의 거리를 반환하는 함수
15 -function distance(x1,y1,x2,y2){
16 - var x = Math.abs(x1-x2);
17 - var y = Math.abs(y1-y2);
18 - var result = Math.hypot(x,y);
19 - return result;
20 -}
21 -
22 -//두 길이의 차이를 %비로 반환하는 함수
23 -function difference(d1, d2){
24 - if(d1 > d2){
25 - return (1 - (d2 / d1)) * 100;
26 - }else if(d1 < d2){
27 - return (1 - (d1 / d2)) * 100;
28 - }else if(d1 == d2){
29 - return 0;
30 - }
31 -}
32 -
33 -//객체와 방향정보를 받아 자세정보를 반환하는 함수
34 -function check_straight(jsonObj,position){ //jsonObj: API로 받은 JSON 객체, position: 사진의 방향정보
35 - var trust_value = []; //17개의 신체부위 좌표에 대한 신뢰도를 저장할 배열
36 - for(i=2; i<51; i+=3){
37 - trust_value.push(jsonObj.keypoints[i]);
38 - }
39 - var x_position = []; //17개의 신체부위의 X좌표값을 저장할 배열
40 - for(i=0; i<49; i+=3){
41 - x_position.push(jsonObj.keypoints[i]);
42 - }
43 - var y_position = []; //17개의 신체부위의 Y좌표값을 저장할 배열
44 - for(i=1; i<50; i+=3){
45 - y_position.push(jsonObj.keypoints[i]);
46 - }
47 -
48 - if(position == 'front'){ //정면 사진일 경우
49 - //사용할 데이터의 신뢰도가 0.4 미만이면 실행하지 않음
50 - if(trust_value[3] < 0.4){
51 - return 'error_low_trust_value (keypoint:4)'
52 - }
53 - if(trust_value[4] < 0.4){
54 - return 'error_low_trust_value (keypoint:5)'
55 - }
56 - if(trust_value[5] < 0.4){
57 - return 'error_low_trust_value (keypoint:6)'
58 - }
59 - if(trust_value[6] < 0.4){
60 - return 'error_low_trust_value (keypoint:7)'
61 - }
62 -
63 - //왼쪽귀(4)-왼쪽어깨(6) 거리와 오른쪽귀(5)-오른쪽어깨(7) 거리가 30% 이상 차이날 경우 > 좌우편향
64 - var d_left = distance(x_position[3], y_position[3], x_position[5], y_position[5]);
65 - var d_right = distance(x_position[4], y_position[4], x_position[6], y_position[6]);
66 - var gap = difference(d_left, d_right);
67 -
68 - if(gap >= 30){ //기운 각도가 30도를 넘을 경우
69 - if(d_left > d_right){ //오른쪽으로 기울인 경우
70 - return 'leaning right by ' + gap + 'percent.';
71 - }else if(d_left < d_right){ //왼쪽으로 기울인 경우
72 - return 'leaning left by ' + gap + 'percent.';
73 - }
74 - }else{ //기운 각도가 30도 미만인 경우
75 - return 'okay';
76 - }
77 -
78 -
79 - }else if(position == 'left'){ //좌측 측면 사진일 경우
80 - //사용할 데이터의 신뢰도가 0.4 미만이면 실행하지 않음
81 - if(trust_value[11] < 0.4){
82 - return 'error_low_trust_value (keypoint:12)'
83 - }
84 - if(trust_value[5] < 0.4){
85 - return 'error_low_trust_value (keypoint:6)'
86 - }
87 - if(trust_value[3] < 0.4){
88 - return 'error_low_trust_value (keypoint:4)'
89 - }
90 -
91 - //엉덩이(12)-어깨(6) 각도가 70도 이하일 경우 > 굽은등
92 - var minimum_angle1 = (180 * 70) / Math.PI;
93 - var d1 = Math.abs(x_position[11]-x_position[5]);
94 - var d2 = Math.abs(y_position[11]-y_position[5]);
95 - var angle1 = Math.atan(d2/d1);
96 - angle1 = (180 * angle1) / Math.PI; //라디안 > 육십분법 변환
97 - if(angle1 <= minimum_angle1){
98 - return 'bent_back';
99 - }
100 -
101 - //어깨(6)-귀(4) 각도가 30도 이상일 경우 > 거북목
102 - var maximum_angle2 = (180 * 30) / Math.PI;
103 - var d1 = Math.abs(y_position[3] - y_position[5]);
104 - var d2 = Math.abs(x_position[3] - x_position[5]);
105 - var angle2 = Math.atan(d2/d1);
106 - angle2 = (180 * angle2) / Math.PI; //라디안 > 육십분법 변환
107 - if(angle2 >= maximum_angle2){
108 - return 'bent_neck';
109 - }
110 -
111 - //굽은등, 거북목 모두 없을 경우
112 - return 'okay';
113 -
114 - }else if(position == 'right'){ //우측 측면 사진일 경우
115 - //사용할 데이터의 신뢰도가 0.4 미만이면 실행하지 않음
116 - if(trust_value[12] < 0.4){
117 - return 'error_low_trust_value (keypoint:13)'
118 - }
119 - if(trust_value[6] < 0.4){
120 - return 'error_low_trust_value (keypoint:7)'
121 - }
122 - if(trust_value[4] < 0.4){
123 - return 'error_low_trust_value (keypoint:5)'
124 - }
125 -
126 - //엉덩이(13)-어깨(7) 각도가 70도 이하일 경우 > 굽은등
127 - var minimum_angle1 = (180 * 70) / Math.PI;
128 - var d1 = Math.abs(x_position[12]-x_position[6]);
129 - var d2 = Math.abs(y_position[12]-y_position[6]);
130 - var angle1 = Math.atan(d2/d1);
131 - angle1 = (180 * angle1) / Math.PI; //라디안 > 육십분법 변환
132 - if(angle1 <= minimum_angle1){
133 - return 'bent_back';
134 - }
135 -
136 - //어깨(7)-귀(5) 각도가 30도 이상일 경우 > 거북목
137 - var maximum_angle2 = (180 * 30) / Math.PI;
138 - var d1 = Math.abs(y_position[4] - y_position[6]);
139 - var d2 = Math.abs(x_position[4] - x_position[6]);
140 - var angle2 = Math.atan(d2/d1);
141 - angle2 = (180 * angle2) / Math.PI; //라디안 > 육십분법 변환
142 - if(angle2 >= maximum_angle2){
143 - return 'bent_neck';
144 - }
145 -
146 - //굽은등, 거북목 모두 없을 경우
147 - return 'okay';
148 - }
149 -
150 -}
151 -
152 -console.log(check_straight(response,'front'));
153 -console.log(check_straight(response,'left'));
154 -console.log(check_straight(response,'right'));
...\ No newline at end of file ...\ No newline at end of file
...@@ -73,7 +73,7 @@ export default function Main() { ...@@ -73,7 +73,7 @@ export default function Main() {
73 </div> 73 </div>
74 <div className="Image_input"> 74 <div className="Image_input">
75 <input type="file" name="file" onChange={handleChangeFile} /> 75 <input type="file" name="file" onChange={handleChangeFile} />
76 - <button type="button" onClick={analysisImage} /> 76 + <button type="button" onClick={analysisImage} >Submit</button>
77 </div> 77 </div>
78 </div> 78 </div>
79 ) 79 )
......