ã¾ãç¶ãã
ã¦ã¼ã¹ã±ã¼ã¹
æåã®ã¹ãããã®æ¬¡ã¨ãã¦ãHelloWorldã®ã»ãã«æ¸ããã¦ããã®ããã¦ã¼ã¹ã±ã¼ã¹ä¾ã
DepthAIâs Documentation â DepthAI documentation | Luxonis
ãããè¦ãã¨ãHand Trackingã®ãµã³ãã«ãåºã¦ããã®ã§ãããããã£ã¦ã¿ããã
Hand Tracking
ä¸è¨ã®Try Nowãã¯ãªãã¯ããã¨ãGitHubã®ãã¼ã¸ã«é£ã¶ã
ãããèªãã§ã¿ãæãã
- Googleã®MediaPipeã®Hand Trackingã®ã¢ãã«ã使ã£ã¦ããã
- Body Pre Focusingã¨ããæ©è½ãå
¥ãã¦ãã¦ã人ãã«ã¡ã©ããé ãã«ãã¦ã使ããããã«ãã¦ãã(MediaPipeã¯ãã£ã±ãã«ã¡ã©ã«è¿ãã¨ããã«ç¹åãã¿ããã)
- 人ã®ä½ã®æ¤åºã¯ãMoveNet(Googleéçº)ã使ã£ã¦ããã¨ã®ãã¨
MoveNet: è¶ é«éã§é«æ§è½ãªå§¿å¢æ¤åºã¢ãã« Â | TensorFlow Hub
MoveNetãç¨ãã¦é¢ç¯ã®è§åº¦ãæ¤åºããã¬ã·ã - BlazePose(MediaPipeã®Holistic Solutionã«ä½¿ããã¦ãã)ãåè£ã«ã¯ä¸ãã£ãããMoveNetã®ã»ããã·ã³ãã«ãªæ§é ãªã®ã§ããã¡ããé¸ãã ãã¨ã®ãã¨
BlazePoseãç¨ãã¦ãã³ã¹ã®é¡ä¼¼ã¢ã¼ã·ã§ã³ãåå¾ãã - é»éç·ç ããã¯ããã°
- 人ã®ä½ã®æ¤åºã¯ãMoveNet(Googleéçº)ã使ã£ã¦ããã¨ã®ãã¨
- ãã¡ããNNã¯ã¨ãã¸å´ã§åããã
- ãã¢ç¨ã®Pythonã³ã¼ããç¨æããã¦ããã®ã§ãããã«è©¦ãã
ç°å¢ç¨æ
ã¾ããªãã¸ããªã®ã¯ãã¼ã³ã
git clone https://github.com/geaxgx/depthai_hand_tracker
ä¸å¿ãä»åã¯ãã¼ã³ããã³ããããæ§ãã¦ããã
Author: geaxgx <[email protected]> Date: 2023/01/15 2:07:41 Commit hash: 97731232fffd467e8de2c3a34ab8382962bb385e Replacing np.int by np.int32 as np.int is no longer available starting from numpy 1.24
requirements.txtãè¦ã¦ã¿ãã¨ãååã®hello-worldã®ãã®ã¨æ¯ã¹ã¦ãè¥å¹²depthaiã®ãã¼ã¸ã§ã³ãæ°ãããªã£ã¦ããã
ååä½ã£ãdepthaiç°å¢ã§ãã¢ãããã¼ããã¦ã¿ããã¨ã«ããã
cd .\depthai_hand_tracker\ pip install -r .\requirements.txt
(depthai) PS C:\work\oak-d_test> cd .\depthai_hand_tracker\
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> pip install -r .\requirements.txt
Requirement already satisfied: opencv-python>=4.5.1.48 in c:\users\a\.conda\envs\depthai\lib\site-packages (from -r .\requirements.txt (line 1)) (4.5.1.48)
Collecting depthai>=2.13 (from -r .\requirements.txt (line 2))
Downloading depthai-2.25.0.0-cp38-cp38-win_amd64.whl.metadata (9.0 kB)
Requirement already satisfied: numpy>=1.17.3 in c:\users\a\.conda\envs\depthai\lib\site-packages (from opencv-python>=4.5.1.48->-r .\requirements.txt (line 1)) (1.24.4)
Downloading depthai-2.25.0.0-cp38-cp38-win_amd64.whl (10.6 MB)
ââââââââââââââââââââââââââââââââââââââââ 10.6/10.6 MB 8.6 MB/s eta 0:00:00
Installing collected packages: depthai
Attempting uninstall: depthai
Found existing installation: depthai 2.11.1.1
Uninstalling depthai-2.11.1.1:
Successfully uninstalled depthai-2.11.1.1
Successfully installed depthai-2.25.0.0
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker>
大ä¸å¤«ã ã£ãã
å®è¡
ã²ã¨ã¾ãä½ããªãã·ã§ã³ãªãã§ã
python demo.py
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
Internal camera FPS set to: 23
Sensor resolution: (1920, 1080)
Internal camera image size: 1152 x 648 - crop_w:0 pad_h: 252
896 anchors have been created
Creating pipeline...
Creating Color Camera...
Creating Palm Detection Neural Network...
Creating Hand Landmark Neural Network (2 threads)...
Pipeline created.
[19443010819FF41200] [2.6] [1.057] [NeuralNetwork(4)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
Pipeline started - USB speed: SUPER
[19443010819FF41200] [2.6] [1.058] [NeuralNetwork(6)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.067] [NeuralNetwork(4)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
[19443010819FF41200] [2.6] [1.067] [NeuralNetwork(6)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
FPS : 22.3 f/s (# frames = 3149)
# frames w/ no hand : 1333 (42.3%)
# frames w/ palm detection : 1726 (54.8%)
# frames w/ landmark inference : 1816 (57.7%)- # after palm detection: 393 - # after landmarks ROI prediction: 1423
On frames with at least one landmark inference, average number of landmarks inferences/frame: 1.00
# lm inferences: 1816 - # failed lm inferences: 238 (13.1%)
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker>
åãããç»åã¦ã£ã³ãã¦ãåºã¦ãæã®èªèãããã¦ããã'q'ãã¼ãæ¼ãããçµäºããã
ãã失æãããã¨ããã£ããã«ã¡ã©ã®ã³ãã¯ã¿æ ¹å ãã¡ãã£ã¨ããã£ã¦æ¥ç¶ããããããªã£ãã¨ãããªã
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
Internal camera FPS set to: 23
Sensor resolution: (1920, 1080)
Internal camera image size: 1152 x 648 - crop_w:0 pad_h: 252
896 anchors have been created
Creating pipeline...
Creating Color Camera...
Creating Palm Detection Neural Network...
Creating Hand Landmark Neural Network (2 threads)...
Pipeline created.
[19443010819FF41200] [2.6] [1.769] [NeuralNetwork(4)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.770] [NeuralNetwork(6)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
Pipeline started - USB speed: HIGH
[19443010819FF41200] [2.6] [1.780] [NeuralNetwork(4)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
[19443010819FF41200] [2.6] [1.780] [NeuralNetwork(6)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
Traceback (most recent call last):
File "demo.py", line 85, in <module>
frame, hands, bag = tracker.next_frame()
File "C:\work\oak-d_test\depthai_hand_tracker\HandTracker.py", line 558, in next_frame
inference = self.q_lm_out.get()
RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'lm_out' (X_LINK_ERROR)'
Stack trace (most recent call last):
#31 Object "", at 00007FFAE5C4B53B, in PyModule_ClearDict
#30 Object "", at 00007FFAE5C16B4B, in PyDict_Pop
#29 Object "", at 00007FFAE5C672E0, in PyType_GenericNew
#28 Object "", at 00007FFAE5C16A06, in PyDict_Pop
#27 Object "", at 00007FFAE5C672E0, in PyType_GenericNew
#26 Object "", at 00007FFAE5C16A06, in PyDict_Pop
#25 Object "", at 00007FFAC7AD7EE2, in pybind11::error_already_set::error_already_set
#24 Object "", at 00007FFAC7AD7DEE, in pybind11::error_already_set::error_already_set
#23 Object "", at 00007FFAC7B1B2B9, in PyInit_depthai
#22 Object "", at 00007FFAC7B2A554, in PyInit_depthai
#21 Object "", at 00007FFAC7D73DFC, in PyInit_depthai
#20 Object "", at 00007FFAC7D5365B, in PyInit_depthai
#19 Object "", at 00007FFAC7D74F30, in PyInit_depthai
#18 Object "", at 00007FFAC7D54157, in PyInit_depthai
#17 Object "", at 00007FFAC7D6468D, in PyInit_depthai
#16 Object "", at 00007FFAC7D3899E, in PyInit_depthai
#15 Object "", at 00007FFAC7D38CDB, in PyInit_depthai
#14 Object "", at 00007FFAC7D51DB1, in PyInit_depthai
#13 Object "", at 00007FFAC7D503AF, in PyInit_depthai
#12 Object "", at 00007FFB6FC33C66, in RtlCaptureContext2
#11 Object "", at 00007FFAC7E76CC5, in PyInit_depthai
#10 Object "", at 00007FFAC7E7FDB0, in PyInit_depthai
#9 Object "", at 00007FFAC7EB6A44, in PyInit_depthai
#8 Object "", at 00007FFAC7E741C3, in PyInit_depthai
#7 Object "", at 00007FFB6D2D5B0C, in RaiseException
#6 Object "", at 00007FFB6FBE4475, in RtlRaiseException
#5 Object "", at 00007FFB6FBAE466, in RtlFindCharInUnicodeString
#4 Object "", at 00007FFB6FC3441F, in _chkstk
#3 Object "", at 00007FFAC7E73529, in PyInit_depthai
#2 Object "", at 00007FFAC7E76845, in PyInit_depthai
#1 Object "", at 00007FFAC7E767E0, in PyInit_depthai
#0 Object "", at 00007FFAC7E75B42, in PyInit_depthai
ãããªã¨ã©ã¼ãåºããå®è¡æãã«ã¡ã©ããã«ãã«ãé³ãåºã¦ãåããã¨ãã¦ããããçµå±ãã¡ã ã£ãæãã
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
[19443010819FF41200] [2.6] [1711058217.082] [host] [warning] Device crashed, but no crash dump could be extracted.
Traceback (most recent call last):
File "demo.py", line 59, in <module>
tracker = HandTracker(
File "C:\work\oak-d_test\depthai_hand_tracker\HandTracker.py", line 130, in __init__
self.device = dai.Device()
RuntimeError: Device already closed or disconnected: io error
åç»ä¿åãªãã·ã§ã³
-o (åç»ãã¡ã¤ã«å)
ã§ä¿åã§ããã¨ã®ãã¨ã試ãã¦ã¿ãã
python demo.py -o out.mp4
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py -o out.mp4
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
Internal camera FPS set to: 23
Sensor resolution: (1920, 1080)
Internal camera image size: 1152 x 648 - crop_w:0 pad_h: 252
896 anchors have been created
Creating pipeline...
Creating Color Camera...
Creating Palm Detection Neural Network...
Creating Hand Landmark Neural Network (2 threads)...
Pipeline created.
[19443010819FF41200] [2.6] [1.138] [NeuralNetwork(4)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.139] [NeuralNetwork(6)] [Pipeline started - USB speed: SUPER
warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.148] [NeuralNetwork(4)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
[19443010819FF41200] [2.6] [1.148] [NeuralNetwork(6)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
OpenCV: FFMPEG: tag 0x47504a4d/'MJPG' is not supported with codec id 7 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
FPS : 19.7 f/s (# frames = 269)
# frames w/ no hand : 21 (7.8%)
# frames w/ palm detection : 49 (18.2%)
# frames w/ landmark inference : 248 (92.2%)- # after palm detection: 28 - # after landmarks ROI prediction: 220
On frames with at least one landmark inference, average number of landmarks inferences/frame: 1.00
# lm inferences: 249 - # failed lm inferences: 5 (2.0%)
ã¨ããããæ¡å¼µå.mp4ã«ãã¦ã¿ããããã¾ããããªãã£ãããã¡ã¤ã«ã¯ã§ãã¦ããããåçãããçã£é»ç»åã ã£ãã
æ¡å¼µå.aviã«ããããããã
python demo.py -o out.avi
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py -o out.avi
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
Internal camera FPS set to: 23
Sensor resolution: (1920, 1080)
Internal camera image size: 1152 x 648 - crop_w:0 pad_h: 252
896 anchors have been created
Creating pipeline...
Creating Color Camera...
Creating Palm Detection Neural Network...
Creating Hand Landmark Neural Network (2 threads)...
Pipeline created.
[19443010819FF41200] [2.6] [0.956] [NeuralNetwork(4)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
Pipeline started - USB speed: SUPER
[19443010819FF41200] [2.6] [0.957] [NeuralNetwork(6)] [warning] Network compiled for 4 shaves, maximum available 13, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [0.967] [NeuralNetwork(4)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
[19443010819FF41200] [2.6] [0.967] [NeuralNetwork(6)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
FPS : 20.3 f/s (# frames = 337)
# frames w/ no hand : 18 (5.3%)
# frames w/ palm detection : 52 (15.4%)
# frames w/ landmark inference : 319 (94.7%)- # after palm detection: 34 - # after landmarks ROI prediction: 285
On frames with at least one landmark inference, average number of landmarks inferences/frame: 1.00
# lm inferences: 320 - # failed lm inferences: 4 (1.2%)
3次å ä½ç½®ãªãã·ã§ã³
-xyz
ãä»ããã¨ãæé¦ã®ä½ç½®ã®3次å
座æ¨ãåºãããã
python demo.py -o out_xyz.avi -xyz
(depthai) PS C:\work\oak-d_test\depthai_hand_tracker> python demo.py -o out_xyz.avi -xyz
Palm detection blob : C:\work\oak-d_test\depthai_hand_tracker\models\palm_detection_sh4.blob
Landmark blob : C:\work\oak-d_test\depthai_hand_tracker\models\hand_landmark_lite_sh4.blob
Internal camera FPS set to: 23
Sensor resolution: (1920, 1080)
Internal camera image size: 1152 x 648 - crop_w:0 pad_h: 252
896 anchors have been created
Creating pipeline...
Creating Color Camera...
Creating MonoCameras, Stereo and SpatialLocationCalculator nodes...
RGB calibration lens position: 131
Creating Palm Detection Neural Network...
Creating Hand Landmark Neural Network (2 threads)...
Pipeline created.
[19443010819FF41200] [2.6] [1.367] [NeuralNetwork(10)] [warning] Network compiled for 4 shaves, maximum available 12, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.369] [NeuralNetwork(12)] [warning] Network compiled for 4 shaves, maximum available 12, compiling for 6 shaves likely will yield in better performance
[19443010819FF41200] [2.6] [1.384] [NeuralNetwork(10)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
Pipeline started - USB speed: SUPER
[19443010819FF41200] [2.6] [1.385] [NeuralNetwork(12)] [warning] The issued warnings are orientative, based on optimal settings for a single network, if multiple networks are running in parallel the optimal settings may vary
FPS : 16.4 f/s (# frames = 300)
# frames w/ no hand : 7 (2.3%)
# frames w/ palm detection : 51 (17.0%)
# frames w/ landmark inference : 293 (97.7%)- # after palm detection: 44 - # after landmarks ROI prediction: 249
On frames with at least one landmark inference, average number of landmarks inferences/frame: 1.00
# lm inferences: 293 - # failed lm inferences: 17 (5.8%)
Spatial location requests round trip : 5.2 ms
å°ããã¬ã¼ã ã¬ã¼ããä¸ãã£ã¦ããããæé¦ã®ä½ç½®ã®åº§æ¨ãåºã¦ããã
ããã¾ã§
次ã¯ããããããå°ãããã£ã¦ã¿ãããã»ãã®ãµã³ãã«ãåããã¦ã¿ããã