コード例 #1
0
def MOT_Type_Update(rgbimg=None,
                    Trk=None,
                    param=None,
                    cfr=None,
                    *args,
                    **kwargs):

    del_idx = []
    lb_idx = []
    max_frame = 50
    type_thr = param.type_thr
    for i in range(0, len(Trk)):
        Conf_prob = Trk[i].Conf_prob
        type_ = Trk[i].type
        if 'High' == type_:
            if Conf_prob < type_thr:
                Trk[i].type = 'Low'
                Trk[i].efr = cfr
        else:
            if 'Low' == type_:
                if Conf_prob > type_thr:
                    Trk[i].type = 'High'
                efr = Trk[i].efr
                if np.abs(cfr - efr) >= max_frame:
                    del_idx.append(i)
                    lb_idx.append(Trk[i].label)

    R_pos = rgbimg.shape[:2]
    L_pos = np.array([0, 0])
    margin = np.array([0, 0])
    for i in range(0, len(Trk)):
        tstates = Trk[i].state[-1]
        if np.isnan(tstates[0]):
            del_idx.append(i)
        else:
            fmotion = Trk[i].state[-1]
            C_pos = np.array(fmotion[0:2])
            L_pos = L_pos + margin
            R_pos = R_pos - margin

            print("**" * 80)
            print(C_pos, L_pos, R_pos)
            if not mot_is_reg(C_pos, L_pos, R_pos):
                del_idx.append(i)

    del_idx = np.array(del_idx)
    if len(del_idx) != 0:
        print(del_idx)
        for idx in sorted(del_idx, reverse=True):
            mot_count_ids(Trk[idx], param)
            Trk.pop(idx)

    return Trk
コード例 #2
0
    Trk, param, Obs_grap = MOT_Generation_Tracklets(init_img_set, Trk,
                                                    detections, param,
                                                    Obs_grap, fr)
    if param.use_ILDA:
        ILDA = MOT_Online_Appearance_Learning(rgbimg, img_path, img_List, fr,
                                              Trk, param, ILDA)
    ## Tracking Results
    Trk_sets = MOT_Tracking_Results(Trk, Trk_sets, fr, param)
    if fr == 5 and param.draw_while_track:
        for i in range(0, 5):
            MOT_Tracking_Reauslt_Realtime(Trk_sets, i, param)
    print('Tracking:Frame_{}'.format(fr))
    if param.draw_while_track:
        MOT_Tracking_Reauslt_Realtime(Trk_sets, fr, param)

##count the ids of the rest Tracklet
for tracklet in Trk:
    mot_count_ids(tracklet, param)
print("Tracking Done...")
end_time = time.time()
spend_time = end_time - start_time
print("Tracking: Total Time:{}|FPS :{}".format(
    spend_time,
    len(param.img_List) / spend_time))
print("Total Tracklet:{}   |Total Object:{}".format(param.total_tracklet_count,
                                                    param.object_count))
print("TT-TO:  {}".format(param.total_tracklet_count - param.object_count))
print("IDS:{}".format(param.ids))
if param.draw_while_track == False:
    pass