Single-person detection and DLT, but there is no complete tracking
This commit is contained in:
1
CVTH3PE
Submodule
1
CVTH3PE
Submodule
Submodule CVTH3PE added at e79e899b87
282
optical_detect_result/5606_demo.json
Normal file
282
optical_detect_result/5606_demo.json
Normal file
@ -0,0 +1,282 @@
|
||||
[
|
||||
{
|
||||
"kps": [
|
||||
419.0,
|
||||
154.0
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
419.0521240234375,
|
||||
154.07498168945312
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 1
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
418.5992736816406,
|
||||
154.3507080078125
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 2
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
417.0777893066406,
|
||||
154.17327880859375
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 3
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
416.8981628417969,
|
||||
154.15330505371094
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 4
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
415.1317443847656,
|
||||
153.68324279785156
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 5
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
413.2596130371094,
|
||||
153.39761352539062
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 6
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
412.7089538574219,
|
||||
153.3645782470703
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 7
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
409.3253173828125,
|
||||
152.9347686767578
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 8
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
404.74853515625,
|
||||
152.21153259277344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 9
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
404.3977355957031,
|
||||
152.19647216796875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 10
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
396.53131103515625,
|
||||
152.09912109375
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 11
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
393.76605224609375,
|
||||
151.91282653808594
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 12
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
393.28106689453125,
|
||||
151.76124572753906
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 13
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
383.2342834472656,
|
||||
152.3790740966797
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 14
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
379.7545471191406,
|
||||
152.79055786132812
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 15
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
379.8231506347656,
|
||||
152.8155975341797
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 16
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
370.0028076171875,
|
||||
155.16213989257812
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 17
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
366.5267639160156,
|
||||
155.72059631347656
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 18
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
366.69610595703125,
|
||||
156.3056182861328
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 19
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
359.8770751953125,
|
||||
158.69798278808594
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 20
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
356.67681884765625,
|
||||
160.0414581298828
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 21
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
348.1063232421875,
|
||||
163.32858276367188
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 22
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
343.6862487792969,
|
||||
165.0043182373047
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 23
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
339.2411804199219,
|
||||
167.18580627441406
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 24
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
330.0,
|
||||
170.0
|
||||
],
|
||||
"kps_scores": 0.0,
|
||||
"index": 25
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
322.0425720214844,
|
||||
174.9293975830078
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 26
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
310.0,
|
||||
176.0
|
||||
],
|
||||
"kps_scores": 0.0,
|
||||
"index": 27
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
305.0433349609375,
|
||||
178.03123474121094
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 28
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
293.71295166015625,
|
||||
183.8294219970703
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 29
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
291.28656005859375,
|
||||
184.33445739746094
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 30
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
281.0,
|
||||
190.0
|
||||
],
|
||||
"kps_scores": 0.0,
|
||||
"index": 31
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
272.0,
|
||||
200.0
|
||||
],
|
||||
"kps_scores": 0.0,
|
||||
"index": 32
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
261.0457763671875,
|
||||
211.67132568359375
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 33
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
239.03567504882812,
|
||||
248.68519592285156
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 34
|
||||
}
|
||||
]
|
||||
282
optical_detect_result/5608_demo.json
Normal file
282
optical_detect_result/5608_demo.json
Normal file
@ -0,0 +1,282 @@
|
||||
[
|
||||
{
|
||||
"kps": [
|
||||
474.0,
|
||||
215.00003051757812
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
474.0710754394531,
|
||||
215.04542541503906
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 1
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
476.81365966796875,
|
||||
215.0387420654297
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 2
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
479.3288269042969,
|
||||
214.4371795654297
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 3
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
479.3817443847656,
|
||||
214.49256896972656
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 4
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
483.0047302246094,
|
||||
213.85231018066406
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 5
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
484.1208801269531,
|
||||
213.64219665527344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 6
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
484.140869140625,
|
||||
213.63470458984375
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 7
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
487.458251953125,
|
||||
213.45497131347656
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 8
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
488.8343505859375,
|
||||
213.4651336669922
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 9
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
488.899658203125,
|
||||
213.48526000976562
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 10
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
493.831787109375,
|
||||
214.70533752441406
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 11
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
495.60980224609375,
|
||||
215.26271057128906
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 12
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
495.5881042480469,
|
||||
215.2436065673828
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 13
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
502.015380859375,
|
||||
217.81201171875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 14
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
504.2356262207031,
|
||||
218.78392028808594
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 15
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
504.2625427246094,
|
||||
218.81021118164062
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 16
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
511.97552490234375,
|
||||
222.26150512695312
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 17
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
514.9180908203125,
|
||||
224.3387908935547
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 18
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
514.7620239257812,
|
||||
224.2892608642578
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 19
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
524.9593505859375,
|
||||
230.30003356933594
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 20
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
528.3402709960938,
|
||||
232.76568603515625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 21
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
528.371826171875,
|
||||
232.73399353027344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 22
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
538.7906494140625,
|
||||
240.9889678955078
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 23
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
538.7630004882812,
|
||||
241.00299072265625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 24
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
550.0248413085938,
|
||||
248.24708557128906
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 25
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
554.3512573242188,
|
||||
250.6501922607422
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 26
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
554.0921020507812,
|
||||
250.47769165039062
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 27
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
567.93212890625,
|
||||
266.1629943847656
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 28
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
571.8528442382812,
|
||||
273.5104675292969
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 29
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
571.9888305664062,
|
||||
273.5711669921875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 30
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
586.6533203125,
|
||||
309.09576416015625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 31
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
591.8392944335938,
|
||||
325.38385009765625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 32
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
592.3212280273438,
|
||||
325.2934265136719
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 33
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
603.3639526367188,
|
||||
362.4980773925781
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 34
|
||||
}
|
||||
]
|
||||
282
optical_detect_result/5609_demo.json
Normal file
282
optical_detect_result/5609_demo.json
Normal file
@ -0,0 +1,282 @@
|
||||
[
|
||||
{
|
||||
"kps": [
|
||||
461.0,
|
||||
164.0
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
460.9234619140625,
|
||||
164.2275390625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 1
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
460.93524169921875,
|
||||
164.19480895996094
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 2
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
460.4592590332031,
|
||||
164.14320373535156
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 3
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
459.9245910644531,
|
||||
164.054931640625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 4
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
459.8656921386719,
|
||||
164.08154296875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 5
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
456.9087219238281,
|
||||
163.1707305908203
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 6
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
455.7566223144531,
|
||||
162.69784545898438
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 7
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
455.740478515625,
|
||||
162.74818420410156
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 8
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
449.8667907714844,
|
||||
161.95462036132812
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 9
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
447.55975341796875,
|
||||
162.12559509277344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 10
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
447.5325012207031,
|
||||
162.12460327148438
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 11
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
439.9998474121094,
|
||||
162.59873962402344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 12
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
437.3090515136719,
|
||||
162.88577270507812
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 13
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
437.2088623046875,
|
||||
162.84994506835938
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 14
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
429.199951171875,
|
||||
164.5860595703125
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 15
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
429.32745361328125,
|
||||
164.66001892089844
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 16
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
424.8293762207031,
|
||||
166.40106201171875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 17
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
419.6496887207031,
|
||||
168.80294799804688
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 18
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
419.6795349121094,
|
||||
168.93418884277344
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 19
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
414.8919677734375,
|
||||
172.65428161621094
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 20
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
410.0992431640625,
|
||||
175.77218627929688
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 21
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
410.0442810058594,
|
||||
175.911376953125
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 22
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
400.20159912109375,
|
||||
184.33380126953125
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 23
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
396.4606628417969,
|
||||
186.7172088623047
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 24
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
396.3185119628906,
|
||||
186.76808166503906
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 25
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
382.623291015625,
|
||||
192.941650390625
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 26
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
376.8236999511719,
|
||||
195.2269744873047
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 27
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
376.66937255859375,
|
||||
195.1109161376953
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 28
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
362.7231750488281,
|
||||
209.30923461914062
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 29
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
355.9901123046875,
|
||||
216.26303100585938
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 30
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
356.3956298828125,
|
||||
216.3310546875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 31
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
343.6780090332031,
|
||||
235.2663116455078
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 32
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
332.50238037109375,
|
||||
261.8990783691406
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 33
|
||||
},
|
||||
{
|
||||
"kps": [
|
||||
332.8721923828125,
|
||||
261.7060546875
|
||||
],
|
||||
"kps_scores": 1.0,
|
||||
"index": 34
|
||||
}
|
||||
]
|
||||
468
optical_flow_trajectory.ipynb
Normal file
468
optical_flow_trajectory.ipynb
Normal file
File diff suppressed because one or more lines are too long
128
play.ipynb
128
play.ipynb
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -92,7 +92,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -133,7 +133,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -168,7 +168,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -190,30 +190,58 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<pre>[{frame_index: 1650, boxes: [[1.19e+03, ..., 884]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1651, boxes: [[1.19e+03, ..., 883]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1652, boxes: [[1.19e+03, ..., 881]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1653, boxes: [[1.19e+03, ..., 882]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1654, boxes: [[1.19e+03, ..., 884]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1655, boxes: [[1.19e+03, ..., 883]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1656, boxes: [[1.19e+03, ..., 883]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1657, boxes: [[1.19e+03, ..., 885]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1658, boxes: [[1.19e+03, ..., 885]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1659, boxes: [[1.19e+03, ..., 885]], kps: [[...]], ...},\n",
|
||||
" ...,\n",
|
||||
" {frame_index: 1704, boxes: [[1.4e+03, ..., 862]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1705, boxes: [[1.41e+03, ..., 865]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1706, boxes: [[1.43e+03, ..., 864]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1707, boxes: [[1.44e+03, ..., 845]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1708, boxes: [[1.45e+03, ..., 848]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1709, boxes: [[1.44e+03, ..., 860]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1710, boxes: [[1.46e+03, ..., 858]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1711, boxes: [[1.49e+03, ..., 847]], kps: [[...]], ...},\n",
|
||||
" {frame_index: 1712, boxes: [[1.52e+03, ..., 829]], kps: [[...]], ...}]\n",
|
||||
"----------------------------------------------------------------------------------------------------------------------------------------------\n",
|
||||
"backend: cpu\n",
|
||||
"nbytes: 273.7 kB\n",
|
||||
"type: 63 * {\n",
|
||||
" frame_index: int64,\n",
|
||||
" boxes: var * var * float64,\n",
|
||||
" kps: var * var * var * float64,\n",
|
||||
" kps_scores: var * var * float64\n",
|
||||
"}</pre>"
|
||||
],
|
||||
"text/plain": [
|
||||
"{5603: <Array [{frame_index: 1650, ...}, ..., {...}] type='63 * {frame_index: int6...'>,\n",
|
||||
" 5605: <Array [{frame_index: 1650, ...}, ..., {...}] type='63 * {frame_index: int6...'>,\n",
|
||||
" 5608: <Array [{frame_index: 1650, ...}, ..., {...}] type='63 * {frame_index: int6...'>,\n",
|
||||
" 5609: <Array [{frame_index: 1650, ...}, ..., {...}] type='63 * {frame_index: int6...'>}"
|
||||
"<Array [{frame_index: 1650, ...}, ..., {...}] type='63 * {frame_index: int6...'>"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"KEYPOINT_DATASET"
|
||||
"KEYPOINT_DATASET[5603]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -296,7 +324,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -374,7 +402,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -452,9 +480,31 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"E0704 11:08:11.573409 46301 pjrt_stream_executor_client.cc:3077] Execution of replica 0 failed: INTERNAL: jaxlib/gpu/solver_handle_pool.cc:37: operation gpusolverDnCreate(&handle) failed: cuSolver internal error\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "XlaRuntimeError",
|
||||
"evalue": "INTERNAL: jaxlib/gpu/solver_handle_pool.cc:37: operation gpusolverDnCreate(&handle) failed: cuSolver internal error",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
||||
"\u001b[31mXlaRuntimeError\u001b[39m Traceback (most recent call last)",
|
||||
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[12]\u001b[39m\u001b[32m, line 22\u001b[39m\n\u001b[32m 15\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m element_camera \u001b[38;5;129;01min\u001b[39;00m cameras:\n\u001b[32m 16\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m jnp.printoptions(precision=\u001b[32m4\u001b[39m, suppress=\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[32m 17\u001b[39m \u001b[38;5;66;03m# display(element_camera)\u001b[39;00m\n\u001b[32m 18\u001b[39m \u001b[38;5;66;03m# display(element_camera.params.Rt.reshape(-1))\u001b[39;00m\n\u001b[32m 19\u001b[39m \u001b[38;5;66;03m# display(element_camera.params.K.reshape(-1))\u001b[39;00m\n\u001b[32m 20\u001b[39m \n\u001b[32m 21\u001b[39m \u001b[38;5;66;03m# compute camera to object point distance\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m22\u001b[39m transistion = \u001b[43melement_camera\u001b[49m\u001b[43m.\u001b[49m\u001b[43mparams\u001b[49m\u001b[43m.\u001b[49m\u001b[43mpose_matrix\u001b[49m[:\u001b[32m3\u001b[39m, -\u001b[32m1\u001b[39m]\n\u001b[32m 23\u001b[39m \u001b[38;5;66;03m# display(transistion)\u001b[39;00m\n\u001b[32m 24\u001b[39m \u001b[38;5;66;03m# display(jnp.linalg.norm(transistion).item())\u001b[39;00m\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32m~/Code/CVTH3PE/app/camera/__init__.py:305\u001b[39m, in \u001b[36mCameraParams.pose_matrix\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 303\u001b[39m t = \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33m_pose\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 304\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m t \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m305\u001b[39m t = \u001b[43mjnp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mlinalg\u001b[49m\u001b[43m.\u001b[49m\u001b[43minv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mRt\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 306\u001b[39m \u001b[38;5;28mobject\u001b[39m.\u001b[34m__setattr__\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33m_pose\u001b[39m\u001b[33m\"\u001b[39m, t)\n\u001b[32m 307\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m t\n",
|
||||
" \u001b[31m[... skipping hidden 5 frame]\u001b[39m\n",
|
||||
"\u001b[36mFile \u001b[39m\u001b[32m~/Code/CVTH3PE/.venv/lib/python3.12/site-packages/jax/_src/interpreters/pxla.py:1297\u001b[39m, in \u001b[36mExecuteReplicated.__call__\u001b[39m\u001b[34m(self, *args)\u001b[39m\n\u001b[32m 1295\u001b[39m \u001b[38;5;28mself\u001b[39m._handle_token_bufs(result_token_bufs, sharded_runtime_token)\n\u001b[32m 1296\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1297\u001b[39m results = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mxla_executable\u001b[49m\u001b[43m.\u001b[49m\u001b[43mexecute_sharded\u001b[49m\u001b[43m(\u001b[49m\u001b[43minput_bufs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1299\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m dispatch.needs_check_special():\n\u001b[32m 1300\u001b[39m out_arrays = results.disassemble_into_single_device_arrays()\n",
|
||||
"\u001b[31mXlaRuntimeError\u001b[39m: INTERNAL: jaxlib/gpu/solver_handle_pool.cc:37: operation gpusolverDnCreate(&handle) failed: cuSolver internal error"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"camera_list = [\n",
|
||||
" 5601,\n",
|
||||
@ -484,7 +534,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -710,7 +760,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -729,7 +779,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -762,7 +812,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -786,7 +836,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -1104,7 +1154,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -1162,7 +1212,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1185,7 +1235,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1220,7 +1270,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1242,7 +1292,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -1297,7 +1347,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1316,7 +1366,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -2973,7 +3023,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -3004,7 +3054,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -3051,7 +3101,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -3071,7 +3121,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3085,7 +3135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3107,7 +3157,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3140,7 +3190,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3158,7 +3208,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3172,7 +3222,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -3196,7 +3246,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"display_name": "cvth3pe",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
@ -6,6 +6,7 @@ import awkward as ak
|
||||
from typing import (
|
||||
Any,
|
||||
Generator,
|
||||
Iterable,
|
||||
Optional,
|
||||
Sequence,
|
||||
TypeAlias,
|
||||
@ -121,7 +122,7 @@ def get_camera_detect(
|
||||
for element_port in ak.to_numpy(camera_dataset["port"]):
|
||||
if element_port in camera_port:
|
||||
keypoint_data[int(element_port)] = ak.from_parquet(
|
||||
detect_path / f"{element_port}.parquet"
|
||||
detect_path / f"{element_port}_detected.parquet"
|
||||
)
|
||||
return keypoint_data
|
||||
|
||||
@ -258,7 +259,13 @@ def sync_batch_gen(
|
||||
for i, gen in enumerate(gens):
|
||||
try:
|
||||
if finished[i] or paused[i]:
|
||||
continue
|
||||
if all(finished):
|
||||
if len(current_batch) > 0:
|
||||
# All generators exhausted, flush remaining batch and exit
|
||||
yield current_batch
|
||||
return
|
||||
else:
|
||||
continue
|
||||
val = next(gen)
|
||||
if last_batch_timestamp is None:
|
||||
last_batch_timestamp = val.timestamp
|
||||
@ -280,13 +287,7 @@ def sync_batch_gen(
|
||||
else:
|
||||
current_batch.append(val)
|
||||
except StopIteration:
|
||||
finished[i] = True
|
||||
paused[i] = True
|
||||
if all(finished):
|
||||
if len(current_batch) > 0:
|
||||
# All generators exhausted, flush remaining batch and exit
|
||||
yield current_batch
|
||||
break
|
||||
return
|
||||
|
||||
|
||||
def get_batch_detect(
|
||||
@ -475,38 +476,36 @@ def triangulate_one_point_from_multiple_views_linear(
|
||||
proj_matrices: Float[Array, "N 3 4"],
|
||||
points: Num[Array, "N 2"],
|
||||
confidences: Optional[Float[Array, "N"]] = None,
|
||||
conf_threshold: float = 0.2,
|
||||
) -> Float[Array, "3"]:
|
||||
"""
|
||||
Args:
|
||||
proj_matrices: 形状为(N, 3, 4)的投影矩阵序列
|
||||
points: 形状为(N, 2)的点坐标序列
|
||||
confidences: 形状为(N,)的置信度序列,范围[0.0, 1.0]
|
||||
|
||||
conf_threshold: 置信度阈值,低于该值的观测不参与DLT
|
||||
Returns:
|
||||
point_3d: 形状为(3,)的三角测量得到的3D点
|
||||
"""
|
||||
assert len(proj_matrices) == len(points)
|
||||
|
||||
N = len(proj_matrices)
|
||||
confi: Float[Array, "N"]
|
||||
|
||||
if confidences is None:
|
||||
confi = jnp.ones(N, dtype=np.float32)
|
||||
weights = jnp.ones(N, dtype=jnp.float32)
|
||||
else:
|
||||
# Use square root of confidences for weighting - more balanced approach
|
||||
confi = jnp.sqrt(jnp.clip(confidences, 0, 1))
|
||||
# 置信度低于阈值的点权重为0,其余为sqrt(conf)
|
||||
valid_mask = confidences >= conf_threshold
|
||||
weights = jnp.where(valid_mask, jnp.sqrt(jnp.clip(confidences, 0, 1)), 0.0)
|
||||
# 归一化权重,避免某一帧权重过大
|
||||
sum_weights = jnp.sum(weights)
|
||||
weights = jnp.where(sum_weights > 0, weights / sum_weights, weights)
|
||||
|
||||
# 将置信度小于0.1点的置信度均设置为0
|
||||
# valid_mask = confidences >= 0.1
|
||||
# confi = jnp.sqrt(jnp.clip(confidences * valid_mask, 0.0, 1.0))
|
||||
|
||||
A = jnp.zeros((N * 2, 4), dtype=np.float32)
|
||||
A = jnp.zeros((N * 2, 4), dtype=jnp.float32)
|
||||
for i in range(N):
|
||||
x, y = points[i]
|
||||
A = A.at[2 * i].set(proj_matrices[i, 2] * x - proj_matrices[i, 0])
|
||||
A = A.at[2 * i + 1].set(proj_matrices[i, 2] * y - proj_matrices[i, 1])
|
||||
A = A.at[2 * i].mul(confi[i])
|
||||
A = A.at[2 * i + 1].mul(confi[i])
|
||||
A = A.at[2 * i].mul(weights[i])
|
||||
A = A.at[2 * i + 1].mul(weights[i])
|
||||
|
||||
# https://docs.jax.dev/en/latest/_autosummary/jax.numpy.linalg.svd.html
|
||||
_, _, vh = jnp.linalg.svd(A, full_matrices=False)
|
||||
@ -896,23 +895,68 @@ def update_tracking(
|
||||
tracking.state = new_state
|
||||
|
||||
|
||||
# 对每一个3d目标进行滑动窗口平滑处理
|
||||
def smooth_3d_keypoints(
|
||||
all_3d_kps: dict[str, list], window_size: int = 5
|
||||
) -> dict[str, list]:
|
||||
# window_size = 5
|
||||
kernel = np.ones(window_size) / window_size
|
||||
smoothed_points = dict()
|
||||
for item_object_index in all_3d_kps.keys():
|
||||
item_object = np.array(all_3d_kps[item_object_index])
|
||||
if item_object.shape[0] < window_size:
|
||||
# 如果数据点少于窗口大小,则直接返回原始数据
|
||||
smoothed_points[item_object_index] = item_object.tolist()
|
||||
continue
|
||||
|
||||
# 对每个关键点的每个坐标轴分别做滑动平均
|
||||
item_smoothed = np.zeros_like(item_object)
|
||||
# 遍历133个关节
|
||||
for kp_idx in range(item_object.shape[1]):
|
||||
# 遍历每个关节的空间三维坐标点
|
||||
for axis in range(3):
|
||||
# 对第i帧的滑动平滑方式 smoothed[i] = (point[i-2] + point[i-1] + point[i] + point[i+1] + point[i+2]) / 5
|
||||
item_smoothed[:, kp_idx, axis] = np.convolve(
|
||||
item_object[:, kp_idx, axis], kernel, mode="same"
|
||||
)
|
||||
smoothed_points[item_object_index] = item_smoothed.tolist()
|
||||
return smoothed_points
|
||||
|
||||
|
||||
# 通过平均置信度筛选2d检测数据
|
||||
def filter_keypoints_by_scores(detections: Iterable[Detection], threshold: float = 0.5):
|
||||
"""
|
||||
Filter detections based on the average confidence score of their keypoints.
|
||||
Only keep detections with an average score above the threshold.
|
||||
"""
|
||||
|
||||
def filter_detection(detection: Detection) -> bool:
|
||||
avg_score = np.mean(detection.confidences)
|
||||
return float(avg_score) >= threshold
|
||||
|
||||
return filter(filter_detection, detections)
|
||||
|
||||
|
||||
def filter_camera_port(detections: list[Detection]):
|
||||
camera_port = set()
|
||||
for detection in detections:
|
||||
camera_port.add(detection.camera.id)
|
||||
return list(camera_port)
|
||||
|
||||
|
||||
# 相机内外参路径
|
||||
CAMERA_PATH = Path(
|
||||
"/home/admin/Documents/ActualTest_QuanCheng/camera_ex_params_1_2025_4_20/camera_params"
|
||||
)
|
||||
CAMERA_PATH = Path("/home/admin/Documents/ActualTest_WeiHua/camera_params")
|
||||
# 所有机位的相机内外参
|
||||
AK_CAMERA_DATASET: ak.Array = get_camera_params(CAMERA_PATH)
|
||||
|
||||
# 2d检测数据路径
|
||||
DATASET_PATH = Path(
|
||||
"/home/admin/Documents/ActualTest_QuanCheng/camera_ex_params_1_2025_4_20/detect_result/segement_1"
|
||||
)
|
||||
DATASET_PATH = Path("/home/admin/Documents/ActualTest_WeiHua/Test_Video")
|
||||
# 指定机位的2d检测数据
|
||||
camera_port = [5603, 5605, 5608, 5609]
|
||||
camera_port = [5602, 5603, 5604, 5605]
|
||||
KEYPOINT_DATASET = get_camera_detect(DATASET_PATH, camera_port, AK_CAMERA_DATASET)
|
||||
|
||||
# 获取一段完整的跳跃片段
|
||||
FRAME_INDEX = [i for i in range(0, 600)]
|
||||
FRAME_INDEX = [i for i in range(552, 1488)] # 552, 1488
|
||||
KEYPOINT_DATASET = get_segment(camera_port, FRAME_INDEX, KEYPOINT_DATASET)
|
||||
|
||||
|
||||
@ -935,15 +979,14 @@ ALPHA_3D = 0.15
|
||||
# 帧数计数器
|
||||
count = 0
|
||||
# 追踪相似度矩阵匹配阈值
|
||||
affinities_threshold = 70
|
||||
affinities_threshold = -20
|
||||
# 跟踪目标集合
|
||||
trackings: list[Tracking] = []
|
||||
# 3d数据,键为追踪目标id,值为该目标的所有3d数据
|
||||
all_3d_kps: dict[str, list] = {}
|
||||
|
||||
# 遍历2d数据,测试追踪状态
|
||||
while count < (max(FRAME_INDEX) - min(FRAME_INDEX)):
|
||||
count += 1
|
||||
while True:
|
||||
# 获得当前追踪目标
|
||||
trackings: list[Tracking] = sorted(
|
||||
global_tracking_state.trackings.values(), key=lambda x: x.id
|
||||
@ -951,14 +994,21 @@ while count < (max(FRAME_INDEX) - min(FRAME_INDEX)):
|
||||
|
||||
try:
|
||||
detections = next(sync_gen)
|
||||
# 通过平均置信度筛选2d检测数据
|
||||
# detections = list(filter_keypoints_by_scores(detections, threshold=0.5))
|
||||
except StopIteration:
|
||||
break
|
||||
|
||||
if len(detections) == 0:
|
||||
print("no detections in this frame, continue")
|
||||
continue
|
||||
# print("Detection len:", len(detections), "count:", count)
|
||||
|
||||
# 获得最新一帧的数据2d数据
|
||||
# 判断追踪状态是否建立成功,若不成功则跳过这一帧数据,直到追踪建立
|
||||
if not trackings:
|
||||
|
||||
"""离机时使用,用于初始化第一帧"""
|
||||
"""
|
||||
# 使用盒子筛选后的2d检测数据
|
||||
filter_detections = get_filter_detections(detections)
|
||||
# 当3个机位均有目标时才建立追踪状态
|
||||
@ -966,25 +1016,35 @@ while count < (max(FRAME_INDEX) - min(FRAME_INDEX)):
|
||||
# continue
|
||||
if len(filter_detections) < len(camera_port):
|
||||
print(
|
||||
"init traincking error, filter detections len:",
|
||||
"init traincking error, filter filter_detections len:",
|
||||
len(filter_detections),
|
||||
"time:",
|
||||
detections[0].timestamp,
|
||||
)
|
||||
continue
|
||||
# 添加第一帧数据构建追踪目标
|
||||
global_tracking_state.add_tracking(filter_detections)
|
||||
# 获得当前追踪目标
|
||||
trackings: list[Tracking] = sorted(
|
||||
global_tracking_state.trackings.values(), key=lambda x: x.id
|
||||
)
|
||||
# 保留第一帧的3d姿态数据
|
||||
for element_tracking in trackings:
|
||||
if str(element_tracking.id) not in all_3d_kps.keys():
|
||||
all_3d_kps[str(element_tracking.id)] = [
|
||||
element_tracking.state.keypoints.tolist()
|
||||
]
|
||||
print("initer tracking:", trackings)
|
||||
"""
|
||||
# 通过平均置信度筛选2d检测数据
|
||||
# detections = list(filter_keypoints_by_scores(detections, threshold=0.7))
|
||||
|
||||
# 当4个机位都识别到目标时才建立追踪状态
|
||||
camera_port = filter_camera_port(detections)
|
||||
if len(detections) < len(camera_port):
|
||||
print(
|
||||
"init traincking error, filter_detections len:",
|
||||
len(detections),
|
||||
)
|
||||
else:
|
||||
# 添加第一帧数据构建追踪目标
|
||||
global_tracking_state.add_tracking(detections) # 离机时:filter_detections
|
||||
# 获得当前追踪目标
|
||||
trackings: list[Tracking] = sorted(
|
||||
global_tracking_state.trackings.values(), key=lambda x: x.id
|
||||
)
|
||||
# 保留第一帧的3d姿态数据
|
||||
for element_tracking in trackings:
|
||||
if str(element_tracking.id) not in all_3d_kps.keys():
|
||||
all_3d_kps[str(element_tracking.id)] = [
|
||||
element_tracking.state.keypoints.tolist()
|
||||
]
|
||||
print("initer tracking:", trackings)
|
||||
else:
|
||||
# 计算相似度矩阵匹配结果
|
||||
affinities: dict[str, AffinityResult] = calculate_affinity_matrix(
|
||||
@ -1045,8 +1105,7 @@ while count < (max(FRAME_INDEX) - min(FRAME_INDEX)):
|
||||
- element_tracking.state.last_active_timestamp
|
||||
)
|
||||
# 当时间间隔超过1s,删除保留的追踪状态
|
||||
if time_gap.seconds > 3:
|
||||
# trackings.remove(element_tracking)
|
||||
if time_gap.seconds > 0.5:
|
||||
global_tracking_state._trackings.pop(element_tracking.id)
|
||||
print(
|
||||
"remove trackings:",
|
||||
@ -1055,8 +1114,12 @@ while count < (max(FRAME_INDEX) - min(FRAME_INDEX)):
|
||||
detections[0].timestamp,
|
||||
)
|
||||
|
||||
# 对每一个3d目标进行滑动窗口平滑处理
|
||||
smoothed_points = smooth_3d_keypoints(all_3d_kps, window_size=5)
|
||||
|
||||
with open("samples/QuanCheng_res.json", "wb") as f:
|
||||
f.write(orjson.dumps(all_3d_kps))
|
||||
for element_3d_kps_id in all_3d_kps.keys():
|
||||
# 将结果保存到json文件中
|
||||
with open("samples/Test_WeiHua.json", "wb") as f:
|
||||
f.write(orjson.dumps(smoothed_points))
|
||||
# 输出每个3d目标的维度
|
||||
for element_3d_kps_id in smoothed_points.keys():
|
||||
print(f"{element_3d_kps_id} : {np.array(all_3d_kps[element_3d_kps_id]).shape}")
|
||||
|
||||
122
smooth_3d_kps.ipynb
Normal file
122
smooth_3d_kps.ipynb
Normal file
@ -0,0 +1,122 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "0d48b7eb",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from pathlib import Path\n",
|
||||
"import numpy as np"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "dfd27584",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"KPS_PATH = Path(\"samples/WeiHua_03.json\")\n",
|
||||
"with open(KPS_PATH, \"r\") as file:\n",
|
||||
" data = json.load(file)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "360f9c50",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'index:1, shape: (33, 133, 3)'"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'index:2, shape: (662, 133, 3)'"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item_object_index in data.keys():\n",
|
||||
" item_object = np.array(data[item_object_index])\n",
|
||||
" display(f'index:{item_object_index}, shape: {item_object.shape}')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 对data['2']的662帧3d关键点数据进行滑动窗口平滑处理\n",
|
||||
"object_points = np.array(data['2']) # shape: (662, 133, 3)\n",
|
||||
"window_size = 5\n",
|
||||
"kernel = np.ones(window_size) / window_size\n",
|
||||
"# 对每个关键点的每个坐标轴分别做滑动平均\n",
|
||||
"smoothed_points = np.zeros_like(object_points)\n",
|
||||
"# 遍历133个关节\n",
|
||||
"for kp_idx in range(object_points.shape[1]):\n",
|
||||
" # 遍历每个关节的空间三维坐标点\n",
|
||||
" for axis in range(3):\n",
|
||||
" # 对第i帧的滑动平滑方式 smoothed[i] = (point[i-2] + point[i-1] + point[i] + point[i+1] + point[i+2]) / 5\n",
|
||||
" smoothed_points[:, kp_idx, axis] = np.convolve(object_points[:, kp_idx, axis], kernel, mode='same')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"id": "24c6c0c9",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'smoothed_points shape: (662, 133, 3)'"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"display(f'smoothed_points shape: {smoothed_points.shape}')\n",
|
||||
"with open(\"samples/smoothed_3d_kps.json\", \"w\") as file:\n",
|
||||
" json.dump({'1':smoothed_points.tolist()}, file)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "cvth3pe",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user