json
{
"timestamp": 1634567890.123,
"camera_id": "cam_001",
"detections": [
{
"bbox": [100, 150, 200, 400], //[x1, y1, x2, y2]
"track_id": 101,
"confidence": 0.95,
"features": [0.12, -0.45, 0.88, ...], // 长达数百维的向量
"attributes": {
"gender": "male",
"upper_color": "blue",
"has_backpack": true
}
},
{
"bbox": [300, 120, 380, 370],
"track_id": 102,
"confidence": 0.87,
"features": [-0.34, 0.67, 0.11, ...],
"attributes": {
"gender": "female",
"upper_color": "red",
"has_backpack": false
}
}
]
}
json
- map(映射处理)
将数据处理为以track_id为key,以识别框x1位置列表为value的map
json{
"track_id1": ["x_11","x_12","x_13",...,"x_1n"],
"track_id2": ["x_21","x_22","x_23",...,"x_2n"],
...
}json - 白名单设置 以集合Set形式存储店员的track_id,实现高效白名单查找,时间复杂度O(1)
- 存储形式,采用文件存储或Redis持久化存储
python
white_list_set = {white_track_id1, white_track_id2, ... ,white_track_idn}
if id in white_list_set:
// 店员
else:
// 不是店员
python
- 进出门逻辑
- 设置门的位置,及进门方向,left or right
- 查找每个识别框列表中的单调序列,递增大于阈值为进门,递减小于阈值为出门(或相反,门的状态)
