- 把视频素材逐帧计算特征。以妙可蓝多为例:帧速=25,10秒广告共251帧,特征512维。
- 形成矩阵mat(帧数x维度)
- 把巡视照片计算特征得向量 feature
- 计算:cosine = np.dot(mat, feature)
- 计算: max_index = np.argmax(cosine)
- 计算:max_value = cosine[max_index]
- 计算:theta = math.acos(max_value)
- 阈值计算:若 theta < threshold then return OK, max_index.
余弦相似度与帧的时刻作图:
阈值:25.50393648495902
属性名 | 属性值 |
---|---|
视频帧数 | 251 |
max(余弦相似度) | 0.948707 |
theta(角度) | 18.43065670378278 |
theta 阈值 | 25.50393648495902 |
是否匹配 | 是(*) |
置信度 | 0.9967838283534795 |
匹配位置(帧) | 82 |
匹配位置(秒) | 3.28 |
注释:因为theta角度小于阈值。