DGU-PoliceLab / System_Integration

This is PoliceLab 2.0 AI module repository.
GNU General Public License v3.0
1 stars 0 forks source link

자살자해 모듈 inference 스레드 오류 #4

Closed qqaazz0222 closed 3 months ago

qqaazz0222 commented 3 months ago

자살 자해 모듈에서 오류 발생

2024-06-28 01:24:45,715 - ERROR - [PLASS] - selfharm  - Error occured in inference_thread, error: list indices must be integers or slices, not str
qqaazz0222 commented 3 months ago

원인

selfharm.py inference 함수에서 프레임 크기를 받아오는 부분에서 문제 발생

def inference(model, label_map, pose_data, meta_data):
    try:
        result = inference_skeleton(model, pose_data, (meta_data['frame_size'][0], meta_data['frame_size'][1])) **<< 문제 발생**
        max_pred_index = result.pred_score.argmax().item()
        action_label = label_map[max_pred_index]
        LOGGER.debug(f"action: {action_label}")
        if action_label == 'selfharm':
            LOGGER.info(f"selfharm detected! {meta_data[0]['current_datetime']}")
    except Exception as e:
        LOGGER.error(f'Error occured in inference_thread, error: {e}')

해결

def inference(model, label_map, pose_data, meta_data):
    try:
        result = inference_skeleton(model, pose_data, (meta_data[0]['frame_size'])) **<<< 단순한 코딩오류**
        max_pred_index = result.pred_score.argmax().item()
        action_label = label_map[max_pred_index]
        LOGGER.debug(f"action: {action_label}")
        if action_label == 'selfharm':
            LOGGER.info(f"selfharm detected! {meta_data[0]['current_datetime']}")
    except Exception as e:
        LOGGER.error(f'Error occured in inference_thread, error: {e}')