This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
51 lines (44 loc) · 1.8 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# run this as test? https://cmake.org/pipermail/cmake/2010-August/039174.html
import dpct
weights = {"weights": [10, 10, 10, 500, 500]}
graph = {
"settings" : {
"statesShareWeights" : True
},
"segmentationHypotheses" : [
{
"id" : 2,
"features" : [[1.0], [0.0]],
"divisionFeatures" : [[0.0], [-5.0]],
"appearanceFeatures" : [[0], [0]],
"disappearanceFeatures" : [[0], [50]],
"timestep" : [1,1]
},
{ "id" : 3, "timestep" : [1,1], "features" : [[1.0], [0.0]], "divisionFeatures" : [[0], [-5]], "appearanceFeatures" : [[0], [0]], "disappearanceFeatures" : [[0], [50]]},
{ "id" : 4, "timestep" : [2,2], "features" : [[1.0], [0.0]], "appearanceFeatures" : [[0], [50]], "disappearanceFeatures" : [[0], [-2]]},
{ "id" : 5, "timestep" : [2,2], "features" : [[1.0], [0.0]], "appearanceFeatures" : [[0], [50]], "disappearanceFeatures" : [[0], [-2]]},
{ "id" : 6, "timestep" : [2,2], "features" : [[1.0], [0.0]], "appearanceFeatures" : [[0], [50]], "disappearanceFeatures" : [[0], [-4]]}
],
"linkingHypotheses" : [
{ "src" : 2, "dest" : 4, "features" : [[0], [-4]]},
{ "src" : 2, "dest" : 5, "features" : [[0], [-3]]},
{ "src" : 3, "dest" : 5, "features" : [[0], [-1]]},
{ "src" : 3, "dest" : 6, "features" : [[0], [-4]]}
]
}
res = dpct.trackFlowBased(graph, weights)
expectedResult = {'detectionResults': [{'id': 2, 'value': 1},
{'id': 3, 'value': 1},
{'id': 4, 'value': 1},
{'id': 5, 'value': 1},
{'id': 6, 'value': 1}],
'divisionResults': [{'id': 2, 'value': True},
{'id': 3, 'value': False},
{'id': 4, 'value': False},
{'id': 5, 'value': False},
{'id': 6, 'value': False}],
'linkingResults': [{'dest': 4, 'src': 2, 'value': 1},
{'dest': 5, 'src': 2, 'value': 1},
{'dest': 5, 'src': 3, 'value': 0},
{'dest': 6, 'src': 3, 'value': 1}]}
assert(res == expectedResult)