Kein Alphabet -Ausgang in Echtzeit -Gebärdensprache zum SprachkonvertierungsprojektPython

Python-Programme
Anonymous
 Kein Alphabet -Ausgang in Echtzeit -Gebärdensprache zum Sprachkonvertierungsprojekt

Post by Anonymous »

Dies sind die Modelldetails < /p>
Modell: "Sequential_1" < /p>



0 < /td>
< /tr>

dense_4 (dicht) < /td>
8,256 < /td>
< /tr>

batch_normalisierung_1 < /td>
256 < /td>
< /tr>

Dropout_1 (Dropout) < /td>
< /tbody>
< /table> < /div>
Total params: 110,154 (430.29 KB) Trainable params: 109,770 (428.79
KB) Non-trainable params: 384 (1.50 KB)

Final training accuracy: 0.9999 Final validation accuracy: 1.0000

79/79 ━━━━━━━━━━━━━━━━━━━━ 0s 1ms/step
< /code>
Verwirrungsmatrix: < /p>



col3
col4
0 < /td>
0 < /td>
0 < /td>
0 < /td>
< /tr>

0 < /td>
253 < /td>
0 < /td>
0 < /td>
0 < /td>
252 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
253 < /td>
0 < /td>
< /tr>

0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0 < /td>
0
0
0
< /tr>

6 < /td>
1 < /td>
254 < /td>
< /tr>

1 < /td>
1 < /td>
254 < /td>
< /tr>


1 < /td>
1 < /td>
1 < /td>
< /p>
# Convert the BGR image to RGB
rgb_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

# Process the image and find hands
results = hands.process(rgb_img)

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Check if hand landmarks are detected
if results.multi_hand_landmarks:
for hand_landmarks in results.multi_hand_landmarks:
# Draw hand landmarks
mp_drawing.draw_landmarks(img, hand_landmarks, mp_hands.HAND_CONNECTIONS)

# Calculate bounding box around the hand
h, w, c = img.shape
x_max = 0
y_max = 0
x_min = w
y_min = h

for lm in hand_landmarks.landmark:
x, y = int(lm.x * w), int(lm.y * h)
if x > x_max:
x_max = x
if x < x_min:
x_min = x
if y > y_max:
y_max = y
if y < y_min:
y_min = y

# Add padding to the bounding box
padding = 20
x_min = max(0, x_min - padding)
y_min = max(0, y_min - padding)
x_max = min(w, x_max + padding)
y_max = min(h, y_max + padding)

# Draw rectangle around hand
cv2.rectangle(img, (x_min, y_min), (x_max, y_max), color_dict, 2)

# Crop the hand region
if x_min < x_max and y_min < y_max: # Ensure valid crop region
crop_img = gray[y_min:y_max, x_min:x_max]
if crop_img.size != 0: # Check if crop is not empty
count = count + 1
if(count % 100 == 0):
prev_val = count

# Process the cropped hand image
blur = cv2.GaussianBlur(crop_img, (5, 5), 2)
th3 = cv2.adaptiveThreshold(blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 2)
ret, res = cv2.threshold(th3, minValue, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)

# Resize to match model input size
resized = cv2.resize(res, (img_size, img_size))
normalized = resized/255.0
reshaped = np.reshape(normalized, (1, img_size, img_size, 1))

# Predict with model
result = model.predict(reshaped)
label = np.argmax(result, axis=1)[0]

if(count == 300):
count = 99
prev = labels_dict[label]
if(label == 0):
string = string + " "
else:
string = string + prev

# Show the processed hand image
cv2.imshow("Hand", res)
else:
# If no hand is detected, reset counter
count = 0

cv2.putText(img, prev, (24, 14), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (255, 255, 255), 2)
cv2.putText(img, string, (275, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (200, 200, 200), 2)
#cv2.putText(img, str(prev_val//100), (300, 150), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 255, 255), 2)

cv2.imshow('LIVE', img)
key = cv2.waitKey(1)

if(key == 27): # press Esc. to exit
break
< /code>
Wenn die Zelle ausgeführt wird, erkennt sie die Hand genau und bewegt sich
mit sich, aber ist die Gesten nicht in Alphabete < /p umwandeln>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post