API Return Value
모든 API는 기본적으로 (error_code, error_message, return value)의 tuple을 리턴합니다.
-
error_code=0인 경우, 함수가 성공적으로 동작했다는 뜻입니다.error_message는 "Success"입니다.return value는 실제 함수의 리턴 값입니다.
-
error_code≠0인 경우, 함수 실행중 error가 발생했다는 뜻입니다.error_message는 에러 메시지 스트링입니다.return value는 None입니다.
TODO: 최종 result container 결과 반영하기.
Inference ResultContainer 구조
- SaigeVIMS inference 결과로 나오는 ResultContainer에는 아래와 같은 정보가 저장되어 있습니다.
| 필드 명 | Type | 필드 의미 |
|---|---|---|
| anomaly_score | List[float] | anomaly score 값. |
| threshold | List[float] | score의 threshold |
| cluster_index | List[int] | clustering 모델이 selected anomaly frame에 배정한 cluster index |
| state_index | List[int] | state와 대응되는 int. (WIP) 1: no_motion, 2: inspect, 3: domain_shift_detection, 4: roi_calibration, 5: no_roi_match, 6: error, 7: slow_motion |
| frame_timestamps | List[int] | 현재 frame에 대한 timestamp를 나타내는 정보. |
| roi_coordinates | List[Union[Box, Tuple[int, int, int, int], None]] | frame 별 원본 전체 이미지 기준 roi coordinate. 기본은 BoxClass, model_dump() 메소드 사용시 (left, top, right, bottom) 으로 자동으로 serialize 됨. (ROI 변경 사항 반영됨) |
| data | List[Union[torch.Tensor, None]] | 현재 frame의 원본 input data의 torch.Tensor 형태 값. |
| reconstruction | List[Union[torch.Tensor, None]] | 현재 frame의 원본 input data에 대한 VIMS 모듈의 output으로 나온 reconstruction 이미지의 torch.Tensor 형태 값. |
| transform | List[Union[torch.Tensor, None]] | 현재 frame의 원본 input data에 대한 adaptation 모듈의 output으로 나온 reconstruction 이미지의 torch.Tensor 형태 값. |