CctvHeightInferencer
ktt.module.cctv_height.Inferencer
Cctv 높이와, 난공사 여부를 판단하고 사진의 적합성을 평가하는 파이프라인을 제공합니다.
주요 기능
- Cctv, 사다리 검출
- Cctv 높이 추정
- 난공사 여부 판단
- 사진 적합성 평가
Usage
demo/demo_cctv_height_compliance_inference.py
build(config)
classmethod
API 인스턴스 빌드 메서드
Parameters:
Returns:
infer(images)
Cctv 높이 및 난공사 여부, 적합 여부 인퍼런스 메서드 Args: images (list[np.ndarray]): 입력 이미지 리스트 (RGB, shape: (H, W, 3), dtype: uint8)
Returns:
Notes
non_compliance에 등장하는 값:
- Depth 추론이 수행되지 않은 경우 (infer_depth is False, cctv_height is None)
- cctv_not_found: CCTV 미검출
- cctv_not_centered: 검출된 CCTV가 이미지 중앙에 위치하지 않음
- Depth 추론이 수행되나, cctv_height 추정은 안되는 경우 (infer_depth is True, cctv_height is None)
- cctv_point_not_found: CCTV 대푯점 검출 실패
- ladder_not_found: 사다리 미검출
- ladder_point_not_on_ground: 사다리가 지면 위에 존재하지 않음 (사다리 박스의 밑변 중 어떤 픽셀도 지면 마스크에 포함되지 않음)
- ground_not_found: 지면 검출 실패
- ground_point_not_found: CCTV 연직 하방의 지면 대응점 검출 실패
- cctv_height 추정까지 성공은 하지만, 오차가 클 위험이 있는 경우
- incomplete_ladder_visibility: 사다리가 이미지에 완전히 보이지 않음 (사다리 박스가 이미지 경계에 닿아있음)
warmup()
get_default_inference_option(model, key)
현재 설정된 모델과 디바이스에 대한 기본 인퍼런스 옵션을 반환합니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model |
str
|
"detection", "depth", "cctv_height" 중 하나 |
required |
key |
str
|
옵션 키 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
기본 인퍼런스 옵션 값 |
사용 가능한 model 및 key 조합은 다음과 같습니다.
model: cctv_height
key: 가능한 key는 다음과 같습니다.
{
"outputs.time": bool, # 인퍼런스시 각 단계별 시간 출력 여부 (default: False)
"params.cctv_side_ignore_ratio": float, # CCTV 박스가 이미지 측면에 너무 가까이 있는 경우 무시하는 비율 (0.0 ~ 0.5, default: 0.1)
# 예: 0.1인 경우, 이미지 너비의 좌우 10% 영역안에 속한 CCTV 박스는 무시됩니다.
"params.cctv_height_meter_threshold": float, # 난공사 CCTV 높이 기준 임계값 (단위: 미터, default: 3.0)
}
model: detection
key: 가능한 key는 다음과 같습니다.
{
"params.object_score_threshold": float, # 객체 검출 신뢰도 임계값 (default: 0.1)
"params.prefix_text": str, # prefix 텍스트 (default: "a photo of a")
"params.positive_texts": list[str], # 검출하고자 하는 객체 텍스트 리스트 (default: ["security camera", "ladder"])
"params.negative_texts": list[str], # 과검 방지용 부정 텍스트 리스트 (default: ["fire extinguisher", "fire alarm",
# "ceiling sprinkler", "smoke detector", "ceiling light",
# "wall light", "vent", "tool box"])
}
model: depth
key: 가능한 key는 다음과 같습니다.
get_inference_option(model, key)
Model에 따른 현재 설정된 postprocess 옵션 값을 읽습니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model |
str
|
"detection", "depth", "cctv_height" 중 하나 |
required |
key |
str
|
옵션 key |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
옵션 value |
Keys
get_default_inference_option과 동일합니다.
set_inference_option(model, key, value)
Model에 따른 postprocess 옵션 값을 설정합니다.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model |
str
|
"detection", "depth", "cctv_height" 중 하나 |
required |
key |
str
|
옵션 key |
required |
value |
Any
|
옵션 value |
required |
Keys
get_default_inference_option과 동일합니다.