Files
HOSPITAL_CCTV/hpe_classification/README.md
2026-02-25 15:05:58 +09:00

2.4 KiB

UTILITY_YOLO_HPE_CLASSIFICATION

YOLO Pose 좌표 정보를 이용한 자세 추정

HPEClassification class

HPEClassification(pose_info, cross_ratio_threshold=0.1, cross_angle_threshold=(15.0, 165.0), falldown_tilt_ratio=0.8, falldown_tilt_angle=15, body_tilt_ratio=0.5, yolo_version=8)

  • pose_info: pose keypoint 정보 (mandatory)
    pose_info: <dict> {
        'person': (cx, cy, w, h, c),
        'keypoints': [ (x, y, c), (x, y, c), ... ]  # 1번이 index 0, 2번 index 1, ... 17번 index 16
    }
    
  • cross_ratio_threshold: 팔 교차시 교차점의 최소 위치 비율. 생략시 0.1
  • cross_angle_threshold: 팔 교차시 교차각 범위 지정. 생략시 (15.0, 165.0)
  • falldown_tilt_ratio: 넘어짐/비틀거림 감지를 위한 body rect 비율 (세로/가로). 생략시 0.8
  • falldown_tilt_angle: 상체 기울어짐 판정각. 작업자가 '작업중'일때 넘어짐 판정에 반영됨 (생략시 15도)
  • body_tilt_ratio: 상체 기울어짐 판정을 위한 상체 비율 임계치 (가로/세로). 생략시 0.3
  • yolo_version: 사용 YOLO 버전. 생략시 8
    • v8 에서는 잡히지 않은 keypoint => (0,0)
    • v7 에서는 잡히지 않은 keypoint => None

cross arms

  • is_cross_arms() -> True/False
  • get_cross_point() -> (x, y)
  • get_cross_ratio() -> (ratio1, ratio2)
  • get_cross_angle() -> 교차각
  • set_cross_ratio_threshold(value)
  • set_cross_angle_threshold(angle)

fall down

  • is_falldown(is_working_on) -> True/False
    • is_working_on: 현재 작업자가 작업중인지 여부.(True/False) 작업중인 경우에는 상체 구부러짐을 반영한다.
  • set_falldown_tilt_ratio(value)

etc

  • get_hpe_type(is_working_on) -> 탐지된 type 종류가 모두 포함된 정보.
    • is_working_on: 현재 작업자가 작업중인지 여부.(True/False) 작업중인 경우에는 상체 구부러짐을 반영한다.
    • HPETypeMask.NORMAL = 0x0000
    • HPETypeMask.FALL_DOWN = 0x0080
    • HPETypeMask.CROSS_ARM = 0x0100
  • get_hpe_type(query, is_working_on) -> True/False
  • get_hpe_level(is_working_on) -> 위험도. 현재 0~9까지의 값.
    • is_working_on: 현재 작업자가 작업중인지 여부.(True/False) 작업중인 경우에는 상체 구부러짐을 반영한다.

HPETypeMask class

HPEClassification.get_hpe_type() 에서 return 되는 정보를 구분하는 mask 값

  • NORMAL = 0x0000
  • FALL_DOWN = 0x0080
  • CROSS_ARM = 0x0100