অধ্যায়Phase 5 · ডিপ লার্নিং ফর ভিশন
5.8 10 মিনিট পড়া
Pose Estimation
MediaPipe pose pipeline।
🎬 গল্প দিয়ে শুরু
Fitness app আপনার squat ঠিক হচ্ছে কিনা কীভাবে বলে? Cricket-এ bowler-এর action analysis কীভাবে হয়? — Pose Estimation। মানুষের শরীরের joint point real-time-এ ধরা।
Pose কী?
Pose = মানব দেহের কিছু গুরুত্বপূর্ণ keypoint (চোখ, কনুই, হাঁটু, কব্জি ইত্যাদি) — সাধারণত ১৭ বা ৩৩টি। প্রতিটি keypoint = (x, y, confidence)।
MediaPipe — সবচেয়ে দ্রুত, CPU-তে real-time
bash
pip install mediapipe opencv-pythonpython
pose_webcam.py
import cv2, mediapipe as mp
mp_pose = mp.solutions.pose
draw = mp.solutions.drawing_utils
pose = mp_pose.Pose(model_complexity=1,
enable_segmentation=False,
min_detection_confidence=0.5)
cap = cv2.VideoCapture(0)
while True:
ok, f = cap.read()
if not ok: break
rgb = cv2.cvtColor(f, cv2.COLOR_BGR2RGB)
res = pose.process(rgb)
if res.pose_landmarks:
draw.draw_landmarks(f, res.pose_landmarks,
mp_pose.POSE_CONNECTIONS)
cv2.imshow("pose", f)
if cv2.waitKey(1) == 27: break33 landmarks
MediaPipe Pose দেয় ৩৩টি keypoint — চোখ, কান, কাঁধ থেকে গোড়ালি পর্যন্ত।
YOLOv8-pose — multi-person, detection-grade
python
from ultralytics import YOLO
model = YOLO("yolov8n-pose.pt")
res = model("yoga.jpg")[0]
res.save("pose.jpg")
for person_kpts in res.keypoints.xy: # (17, 2)
print("Right wrist:", person_kpts[10].tolist())ব্যবহারিক — squat counter
python
import math
def angle(a, b, c):
"""b কেন্দ্রবিন্দুতে কোণ degree-তে"""
ang = math.degrees(
math.atan2(c[1]-b[1], c[0]-b[0]) -
math.atan2(a[1]-b[1], a[0]-b[0]))
return abs(ang) if abs(ang) <= 180 else 360 - abs(ang)
# pose loop-এর ভেতরে
lm = res.pose_landmarks.landmark
hip = (lm[mp_pose.PoseLandmark.RIGHT_HIP].x, lm[mp_pose.PoseLandmark.RIGHT_HIP].y)
knee = (lm[mp_pose.PoseLandmark.RIGHT_KNEE].x, lm[mp_pose.PoseLandmark.RIGHT_KNEE].y)
ankle = (lm[mp_pose.PoseLandmark.RIGHT_ANKLE].x, lm[mp_pose.PoseLandmark.RIGHT_ANKLE].y)
knee_angle = angle(hip, knee, ankle)
# < 90° → "down"; > 160° → "up"; transition count = squatHand & Face mesh
python
# Hand — 21 landmarks per hand
hands = mp.solutions.hands.Hands(max_num_hands=2)
# Face mesh — 468 points (AR filter, lip-sync)
face = mp.solutions.face_mesh.FaceMesh()Applications
- Fitness coach — form correction, rep count।
- AR filter — Snapchat, Instagram।
- Sign language recognition।
- Sport analytics — bowling action, cricket bat swing।
- Old-age fall detection।
- Sign-in/attendance with gesture।
Phase 5 শেষ — কী শিখলেন?
- CNN-এর core ও পরিচিত architecture।
- Transfer learning ও fine-tuning workflow।
- Data augmentation strong recipe।
- End-to-end classification pipeline।
- YOLOv8 detection + tracking।
- Segmentation (semantic, instance, SAM)।
- OCR — Tesseract/EasyOCR/PaddleOCR।
- Pose estimation — MediaPipe ও YOLO-pose।
পরবর্তী — Phase 6: Modern AI Vision
ক্লাসিক DL শেষ। এবার ViT, GAN, Diffusion, CLIP, 3D vision, SLAM, edge AI — আধুনিক ভিশনের cutting edge।
প্র্যাকটিস টাস্ক
- MediaPipe Pose দিয়ে webcam-এ squat counter বানান।
- Hand landmark দিয়ে আঙুল গুনে gesture-based digit detect করুন।
- YOLO-pose দিয়ে multi-person yoga photo-তে সবার pose বের করুন।