DGU-PoliceLab / System_Integration

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

CSDC Falldown 모듈에서 버그 발생 #9

Closed qqaazz0222 closed 3 months ago

qqaazz0222 commented 3 months ago

현상

모든 프레임에 대해 이벤트 발생

qqaazz0222 commented 3 months ago

해결

원인

check_falldown 함수에 리턴값이 모두 True. 최하단 리턴문 수정

def check_falldown(action_name='Normal', confidence=0, threshold=0.6):
    if action_name == 'Fall Down' and threshold < confidence:
        return True
    return False   

confidence값 오류(추정)

max값을 받아오도록 되어있었는데, max값 수치가 평균 0.9 이상으로 관측됨

def Falldown(data_pipe, event_pipe):
    args = parse_args()
    action_model = TSSTG()
    data_pipe.send(True)
    while True:
        action_name = 'None'
        confidence = 0
        data = data_pipe.recv()
        if data:
            tracks, meta_data = data
            for i, track in enumerate(tracks):
                skeletons = track.skeletons
                if len(skeletons) < args.frame_step:
                    continue

                tid = track.track_id
                skeletons = preprocess(skeletons=skeletons, frame_step=args.frame_step)

                out = action_model.predict(skeletons, meta_data['frame_size'])
                action_name = action_model.class_names[out[0].argmax()]
                confidence = out[0][1]

            if check_falldown(action_name=action_name, confidence=confidence, threshold=args.threshhold):
                tid = 1
                LOGGER.info("action: falldown")
                event_pipe.send({'action': "falldown", 'id':tid, 'cctv_id':meta_data['cctv_id'], 'current_datetime':meta_data['current_datetime']})
        else:
            time.sleep(0.0001)