| | |
| | | // RatioInterTrack 跟踪判断重叠阈值 |
| | | const RatioInterTrack = 50 //跟踪判断重叠阈值 |
| | | |
| | | // SDKImage sdk image |
| | | type SDKImage struct { |
| | | Data []byte |
| | | Width int |
| | | Height int |
| | | Channel int |
| | | } |
| | | |
| | | // NewYolo init yolo sdk |
| | | func NewYolo(fc, fw, fn string, gi int) *YoloHandle { |
| | | |
| | |
| | | |
| | | // YoloDetectTrack yolo detect (只识别人) |
| | | func YoloDetectTrack(y *YoloHandle, id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) { |
| | | if data == nil || w <= 0 || h <= 0 { |
| | | return nil, nil |
| | | } |
| | | channel := c |
| | | if channel == 0 { |
| | | channel = 3 |
| | | } |
| | | |
| | | v, ok := y.tracker[id] |
| | | if !ok { |
| | |
| | | y.tracker[id] = i |
| | | v = i |
| | | } |
| | | whole, recent := YoloDetectTrack2(y, v.lastTrackObjs, &v.lastTrackID, data, w, h, c, thrsh, umns) |
| | | whole, recent := YoloDetectTrack2(y, v.lastTrackObjs, &v.lastTrackID, data, w, h, channel, thrsh, umns) |
| | | y.tracker[id].lastTrackObjs = whole |
| | | y.tracker[id].lastTrackID = v.lastTrackID |
| | | |