codrizsain commited on
Commit
f128161
·
verified ·
1 Parent(s): cd94e5f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +19 -4
index.html CHANGED
@@ -109,7 +109,7 @@
109
  <body>
110
 
111
  <h2>🤖 AI Vision: Smooth Tracking</h2>
112
- <p>Algoritma Debounce untuk Audio & Visual v19</p>
113
 
114
  <button id="startBtn">▶ Mulai Sistem Deteksi</button>
115
 
@@ -165,6 +165,7 @@
165
  function getDistance(p1, p2) { return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); }
166
 
167
  function analyzeFaceBiometrics(faceLandmarks) {
 
168
  const leftMouth = faceLandmarks[61]; const rightMouth = faceLandmarks[291];
169
  const topLip = faceLandmarks[13]; const bottomLip = faceLandmarks[14];
170
  const leftEye = faceLandmarks[33]; const rightEye = faceLandmarks[263];
@@ -180,6 +181,7 @@
180
  if (openRatio > 0.15) { moodText = "Terkejut 😲"; moodColor = "#a855f7"; }
181
  else if (smileRatio > 0.52) { moodText = "Senang 😊"; moodColor = "#10b981"; }
182
 
 
183
  const leftCheek = faceLandmarks[234]; const rightCheek = faceLandmarks[454];
184
  const leftJaw = faceLandmarks[132]; const rightJaw = faceLandmarks[361];
185
 
@@ -187,9 +189,22 @@
187
  const jawWidth = getDistance(leftJaw, rightJaw);
188
  const jawToCheekRatio = jawWidth / cheekWidth;
189
 
190
- let genderText = "Memindai..."; let genderColor = "#cbd5e1";
191
- if (jawToCheekRatio > 0.755) { genderText = "Pria 👨"; genderColor = "#60a5fa"; }
192
- else { genderText = "Wanita 👩"; genderColor = "#f472b6"; }
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  return { moodText, moodColor, genderText, genderColor };
195
  }
 
109
  <body>
110
 
111
  <h2>🤖 AI Vision: Smooth Tracking</h2>
112
+ <p>By Rizki Ardiasnyah</p>
113
 
114
  <button id="startBtn">▶ Mulai Sistem Deteksi</button>
115
 
 
165
  function getDistance(p1, p2) { return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); }
166
 
167
  function analyzeFaceBiometrics(faceLandmarks) {
168
+ // 1. Analisis Mood
169
  const leftMouth = faceLandmarks[61]; const rightMouth = faceLandmarks[291];
170
  const topLip = faceLandmarks[13]; const bottomLip = faceLandmarks[14];
171
  const leftEye = faceLandmarks[33]; const rightEye = faceLandmarks[263];
 
181
  if (openRatio > 0.15) { moodText = "Terkejut 😲"; moodColor = "#a855f7"; }
182
  else if (smileRatio > 0.52) { moodText = "Senang 😊"; moodColor = "#10b981"; }
183
 
184
+ // 2. Analisis Estimasi Gender
185
  const leftCheek = faceLandmarks[234]; const rightCheek = faceLandmarks[454];
186
  const leftJaw = faceLandmarks[132]; const rightJaw = faceLandmarks[361];
187
 
 
189
  const jawWidth = getDistance(leftJaw, rightJaw);
190
  const jawToCheekRatio = jawWidth / cheekWidth;
191
 
192
+ // FITUR DEBUGGING: Menampilkan angka rasio di teks agar kamu bisa melihatnya
193
+ // Fungsi .toFixed(3) digunakan untuk mengambil 3 angka di belakang koma
194
+ let angkaRasio = jawToCheekRatio.toFixed(3);
195
+
196
+ let genderText = ""; let genderColor = "";
197
+
198
+ // ========================================================
199
+ // UBAH ANGKA 0.820 DI BAWAH INI UNTUK MENYESUAIKAN AKURASI
200
+ // ========================================================
201
+ if (jawToCheekRatio > 0.820) {
202
+ genderText = `Pria 👨 (${angkaRasio})`;
203
+ genderColor = "#60a5fa";
204
+ } else {
205
+ genderText = `Wanita 👩 (${angkaRasio})`;
206
+ genderColor = "#f472b6";
207
+ }
208
 
209
  return { moodText, moodColor, genderText, genderColor };
210
  }