def consensus_vote(votes, transM, frameEnd, iters):
"""
Perform iterative consensus voting
"""
sTime = time.time()
for t in range(iters):
votes = np.dot(transM, votes)
# normalize per frame
for i in range(frameEnd.shape[0]):
currStartF = 1 + frameEnd[i - 1] if i > 0 else 0
currEndF = frameEnd[i]
frameVotes = np.max(votes[currStartF:1 + currEndF])
votes[currStartF:1 + currEndF] /= frameVotes + (frameVotes <= 0)
eTime = time.time()
print('Consensus voting finished: %.2f s' % (eTime - sTime))
return votes
评论列表
文章目录