Skip to content

Commit

Permalink
Merge pull request #13 from opendatacam/mot
Browse files Browse the repository at this point in the history
Evo: Benchmark compatibility with MOT challenge + Add opendatacam/darknet compat
  • Loading branch information
tdurand authored Sep 18, 2019
2 parents b82d9c6 + 78cab64 commit efb8033
Show file tree
Hide file tree
Showing 15 changed files with 216,668 additions and 99 deletions.
24 changes: 14 additions & 10 deletions ItemTracked.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ exports.ItemTracked = function(properties, frameNb, DEFAULT_UNMATCHEDFRAMES_TOLE
return nameMostlyMatched;
}

itemTracked.toJSONDebug = function() {
itemTracked.toJSONDebug = function(roundInt = true) {
return {
id: this.id,
idDisplay: this.idDisplay,
x: parseInt(this.x, 10),
y: parseInt(this.y, 10),
w: parseInt(this.w, 10),
h: parseInt(this.h, 10),
x: (roundInt ? parseInt(this.x, 10) : this.x),
y: (roundInt ? parseInt(this.y, 10) : this.y),
w: (roundInt ? parseInt(this.w, 10) : this.w),
h: (roundInt ? parseInt(this.h, 10) : this.h),
confidence: Math.round(this.confidence * 100) / 100,
// Here we negate dy to be in "normal" carthesian coordinates
bearing: parseInt(computeBearingIn360(this.velocity.dx, - this.velocity.dy)),
Expand All @@ -179,13 +179,13 @@ exports.ItemTracked = function(properties, frameNb, DEFAULT_UNMATCHEDFRAMES_TOLE
}
}

itemTracked.toJSON = function() {
itemTracked.toJSON = function(roundInt = true) {
return {
id: this.idDisplay,
x: parseInt(this.x, 10),
y: parseInt(this.y, 10),
w: parseInt(this.w, 10),
h: parseInt(this.h, 10),
x: (roundInt ? parseInt(this.x, 10) : this.x),
y: (roundInt ? parseInt(this.y, 10) : this.y),
w: (roundInt ? parseInt(this.w, 10) : this.w),
h: (roundInt ? parseInt(this.h, 10) : this.h),
confidence: Math.round(this.confidence * 100) / 100,
// Here we negate dy to be in "normal" carthesian coordinates
bearing: parseInt(computeBearingIn360(this.velocity.dx, - this.velocity.dy), 10),
Expand All @@ -194,6 +194,10 @@ exports.ItemTracked = function(properties, frameNb, DEFAULT_UNMATCHEDFRAMES_TOLE
}
}

itemTracked.toMOT = function(frameIndex) {
return `${frameIndex},${this.idDisplay},${this.x},${this.y},${this.w},${this.h},${this.confidence / 100},-1,-1,-1`;
}

itemTracked.toJSONGenericInfo = function() {
return {
id: this.id,
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,46 @@ node-moving-things-tracker --debug --input PATH_TO_YOLO_DETECTIONS.txt
}
```

# Run on opendatacam/darknet detection data

Usage with opendatacam/darknet generated tracker data.

```bash
node-moving-things-tracker --mode opendatacam-darknet --input detectionsFromDarknet.json
# This will output a tracker.json file in the same folder containing the tracker data
# Output format is the same as previously
```

Example detections.json file

```json
[
{
"frame_id":0,
"objects": [
{"class_id":5, "name":"bus", "relative_coordinates":{"center_x":0.394363, "center_y":0.277938, "width":0.032596, "height":0.106158}, "confidence":0.414157},
{"class_id":5, "name":"bus", "relative_coordinates":{"center_x":0.363555, "center_y":0.285264, "width":0.062474, "height":0.133008}, "confidence":0.402736}
]
},
{
"frame_id":0,
"objects": [
{"class_id":5, "name":"bus", "relative_coordinates":{"center_x":0.394363, "center_y":0.277938, "width":0.032596, "height":0.106158}, "confidence":0.414157},
{"class_id":5, "name":"bus", "relative_coordinates":{"center_x":0.363555, "center_y":0.285264, "width":0.062474, "height":0.133008}, "confidence":0.402736}
]
}
]
```


## Run on MOT Challenge dataset

```bash
node-moving-things-tracker --mode motchallenge --input PATH_TO_MOT_DETECTIONS.txt

# Output will be in the same folder as input under the name outputTrackerMOT.txt
```

## Limitations

No params tweaking is possible via command-line for now, it is currently optimized for tracking cars in traffic videos.
Expand Down
Loading

0 comments on commit efb8033

Please sign in to comment.