機械学習についてちょっとした勉強といういうことで、むかし作成したYouTubeにアップロードした動画で姿勢推定を行ってみました。
///////////もくじ////////////
姿勢推定
(人間用の?)姿勢推定とは、動画、静止画から人物の関節点を推定し、そこに写る人物の「関節」を検知して、その関節にあたるジョイントと腕や足などの骨の部分にあたるボーンの状態を点と線を使って表示技術です。

画像から推定した骨格が点と線で描画されています。
今回はHRNet(High Resolution Network)という姿勢推定のモデルを使って勉強してみました。
HRNetとは
HRNet (High-Resolution Net) は、CVPR'19にて提案されたディープラーニングネットワークアーキテクチャのようです。
arxiv.org
元ネタ
今回は以下のサイトを参考に勉強させていただきました。
mathematical-free.com
github.com
作業ログ
試行錯誤して環境を構築したため手順がよくわからなくなってしまいました。
今回は作業ログをそのままのせておきます。
$ git clone https://github.com/stefanopini/simple-HRNet.git
Cloning into 'simple-HRNet'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 310 (delta 1), reused 4 (delta 1), pack-reused 302
Receiving objects: 100% (310/310), 78.01 MiB | 12.53 MiB/s, done.
Resolving deltas: 100% (143/143), done.
$ pip install pip --upgrade
Requirement already satisfied: pip in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (20.3.1)
Collecting pip
Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
|????????????????????????????????| 1.5 MB 683 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.3.1
Uninstalling pip-20.3.1:
Successfully uninstalled pip-20.3.1
Successfully installed pip-20.3.3
[test@localhost simple-HRNet]$ pip install tensorboard==1.14 PyHamcrest
Requirement already satisfied: PyHamcrest in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (2.0.2)
Collecting tensorboard==1.14
Downloading tensorboard-1.14.0-py3-none-any.whl (3.1 MB)
|????????????????????????????????| 3.1 MB 645 kB/s
Requirement already satisfied: setuptools>=41.0.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard==1.14) (49.2.1)
Requirement already satisfied: numpy>=1.12.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy-1.20.0rc1-py3.9-linux-x86_64.egg (from tensorboard==1.14) (1.20.0rc1)
Requirement already satisfied: protobuf>=3.6.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard==1.14) (3.14.0)
Requirement already satisfied: markdown>=2.6.8 in /home/test/.local/lib/python3.9/site-packages (from tensorboard==1.14) (3.3.3)
Requirement already satisfied: wheel>=0.26 in /home/test/.local/lib/python3.9/site-packages (from tensorboard==1.14) (0.36.2)
Requirement already satisfied: six>=1.10.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard==1.14) (1.15.0)
Requirement already satisfied: absl-py>=0.4 in /home/test/.local/lib/python3.9/site-packages (from tensorboard==1.14) (0.11.0)
Requirement already satisfied: grpcio>=1.6.3 in /home/test/.local/lib/python3.9/site-packages (from tensorboard==1.14) (1.34.0)
Requirement already satisfied: werkzeug>=0.11.15 in /home/test/.local/lib/python3.9/site-packages (from tensorboard==1.14) (1.0.1)
Installing collected packages: tensorboard
Attempting uninstall: tensorboard
Found existing installation: tensorboard 2.4.0
Uninstalling tensorboard-2.4.0:
Successfully uninstalled tensorboard-2.4.0
Successfully installed tensorboard-1.14.0
[test@localhost simple-HRNet]$ pip install -r requirements.txt
Requirement already satisfied: matplotlib>=3.0.2 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (3.3.3)
Requirement already satisfied: numpy>=1.16 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy-1.20.0rc1-py3.9-linux-x86_64.egg (from -r requirements.txt (line 4)) (1.20.0rc1)
Requirement already satisfied: opencv-python>=3.4 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (4.4.0.46)
Requirement already satisfied: Pillow>=5.4 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 6)) (8.0.1)
Requirement already satisfied: torch>=1.4.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 8)) (1.7.1)
Requirement already satisfied: torchvision>=0.5.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 9)) (0.8.2)
Requirement already satisfied: tqdm>=4.26 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 10)) (4.54.1)
Requirement already satisfied: tensorboard>=1.11 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 11)) (1.14.0)
Collecting ffmpeg-python>=0.2.0
Downloading ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)
Requirement already satisfied: cycler>=0.10 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib>=3.0.2->-r requirements.txt (line 2)) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib>=3.0.2->-r requirements.txt (line 2)) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib>=3.0.2->-r requirements.txt (line 2)) (2.4.7)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib>=3.0.2->-r requirements.txt (line 2)) (1.3.1)
Collecting munkres>=1.1.2
Downloading munkres-1.1.4-py2.py3-none-any.whl (7.0 kB)
Requirement already satisfied: wheel>=0.26 in /home/test/.local/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (0.36.2)
Requirement already satisfied: six>=1.10.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (1.15.0)
Requirement already satisfied: setuptools>=41.0.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (49.2.1)
Requirement already satisfied: werkzeug>=0.11.15 in /home/test/.local/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (1.0.1)
Requirement already satisfied: absl-py>=0.4 in /home/test/.local/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (0.11.0)
Requirement already satisfied: markdown>=2.6.8 in /home/test/.local/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (3.3.3)
Requirement already satisfied: grpcio>=1.6.3 in /home/test/.local/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (1.34.0)
Requirement already satisfied: protobuf>=3.6.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard>=1.11->-r requirements.txt (line 11)) (3.14.0)
Collecting tensorboardX>=1.4
Downloading tensorboardX-2.1-py2.py3-none-any.whl (308 kB)
|????????????????????????????????| 308 kB 2.3 MB/s
Requirement already satisfied: typing-extensions in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from torch>=1.4.0->-r requirements.txt (line 8)) (3.7.4.3)
Collecting vidgear>=0.1.4
Downloading vidgear-0.1.9-py3-none-any.whl (83 kB)
|????????????????????????????????| 83 kB 2.3 MB/s
Requirement already satisfied: requests in /home/test/.local/lib/python3.9/site-packages (from vidgear>=0.1.4->-r requirements.txt (line 7)) (2.25.0)
Collecting colorlog
Downloading colorlog-4.6.2-py2.py3-none-any.whl (10.0 kB)
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
|????????????????????????????????| 829 kB 831 kB/s
Collecting mss
Downloading mss-6.1.0-py3-none-any.whl (76 kB)
|????????????????????????????????| 76 kB 908 kB/s
Collecting pafy
Downloading pafy-0.5.5-py2.py3-none-any.whl (35 kB)
Collecting pyzmq
Downloading pyzmq-20.0.0-cp39-cp39-manylinux1_x86_64.whl (1.1 MB)
|????????????????????????????????| 1.1 MB 6.0 MB/s
Requirement already satisfied: idna<3,>=2.5 in /home/test/.local/lib/python3.9/site-packages (from requests->vidgear>=0.1.4->-r requirements.txt (line 7)) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/test/.local/lib/python3.9/site-packages (from requests->vidgear>=0.1.4->-r requirements.txt (line 7)) (2020.12.5)
Requirement already satisfied: chardet<4,>=3.0.2 in /home/test/.local/lib/python3.9/site-packages (from requests->vidgear>=0.1.4->-r requirements.txt (line 7)) (3.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/test/.local/lib/python3.9/site-packages (from requests->vidgear>=0.1.4->-r requirements.txt (line 7)) (1.26.2)
Collecting youtube-dl
Downloading youtube_dl-2020.12.14-py2.py3-none-any.whl (1.8 MB)
|????????????????????????????????| 1.8 MB 5.7 MB/s
Building wheels for collected packages: future
Building wheel for future (setup.py) ... done
Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=8bc5805fc5e4569d7d3557bb7633a4c290795ba8eb1f1e482f8a5f2accaaa7b0
Stored in directory: /home/test/.cache/pip/wheels/2f/a0/d3/4030d9f80e6b3be787f19fc911b8e7aa462986a40ab1e4bb94
Successfully built future
Installing collected packages: youtube-dl, pyzmq, pafy, mss, future, colorlog, vidgear, tensorboardX, munkres, ffmpeg-python
Successfully installed colorlog-4.6.2 ffmpeg-python-0.2.0 future-0.18.2 mss-6.1.0 munkres-1.1.4 pafy-0.5.5 pyzmq-20.0.0 tensorboardX-2.1 vidgear-0.1.9 youtube-dl-2020.12.14
$ cd models/detectors
$ ls
yolo YOLOv3.py
$ git clone https://github.com/eriklindernoren/PyTorch-YOLOv3.git
Cloning into 'PyTorch-YOLOv3'...
remote: Enumerating objects: 724, done.
remote: Total 724 (delta 0), reused 0 (delta 0), pack-reused 724
Receiving objects: 100% (724/724), 16.18 MiB | 3.55 MiB/s, done.
Resolving deltas: 100% (410/410), done.
$ ls
PyTorch-YOLOv3 yolo YOLOv3.py
$ rm -r yolo
$ mv PyTorch-YOLOv3 yolo
$ cd yolo
$ pip install -r requirements.txt
Requirement already satisfied: numpy in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy-1.20.0rc1-py3.9-linux-x86_64.egg (from -r requirements.txt (line 1)) (1.20.0rc1)
Requirement already satisfied: torch>=1.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (1.7.1)
Requirement already satisfied: torchvision in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.8.2)
Requirement already satisfied: matplotlib in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (3.3.3)
ERROR: Could not find a version that satisfies the requirement tensorflow
ERROR: No matching distribution found for tensorflow
$ pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl
Collecting tensorflow==1.8.0
Downloading https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl (46.5 MB)
|????????????????????????????????| 46.5 MB 3.1 MB/s
Requirement already satisfied: absl-py>=0.1.6 in ./.local/lib/python3.9/site-packages (from tensorflow==1.8.0) (0.11.0)
Requirement already satisfied: six>=1.10.0 in ./.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorflow==1.8.0) (1.15.0)
Requirement already satisfied: protobuf>=3.4.0 in ./.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorflow==1.8.0) (3.14.0)
Requirement already satisfied: numpy>=1.13.3 in ./.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy-1.20.0rc1-py3.9-linux-x86_64.egg (from tensorflow==1.8.0) (1.20.0rc1)
Requirement already satisfied: grpcio>=1.8.6 in ./.local/lib/python3.9/site-packages (from tensorflow==1.8.0) (1.34.0)
Requirement already satisfied: wheel>=0.26 in ./.local/lib/python3.9/site-packages (from tensorflow==1.8.0) (0.36.2)
Collecting astor>=0.6.0
Downloading astor-0.8.1-py2.py3-none-any.whl (27 kB)
Collecting gast>=0.2.0
Downloading gast-0.4.0-py3-none-any.whl (9.8 kB)
Collecting tensorboard<1.9.0,>=1.8.0
Downloading tensorboard-1.8.0-py3-none-any.whl (3.1 MB)
|????????????????????????????????| 3.1 MB 2.9 MB/s
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python3.9/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0) (3.3.3)
Requirement already satisfied: werkzeug>=0.11.10 in ./.local/lib/python3.9/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0) (1.0.1)
Collecting bleach==1.5.0
Downloading bleach-1.5.0-py2.py3-none-any.whl (17 kB)
Collecting html5lib==0.9999999
Downloading html5lib-0.9999999.tar.gz (889 kB)
|????????????????????????????????| 889 kB 5.3 MB/s
Collecting termcolor>=1.1.0
Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Building wheels for collected packages: html5lib, termcolor
Building wheel for html5lib (setup.py) ... done
Created wheel for html5lib: filename=html5lib-0.9999999-py3-none-any.whl size=107219 sha256=cd270b13918c8f5842ba0c221f8836a329dc7888d964bdd4d067c3d612810dfb
Stored in directory: /home/test/.cache/pip/wheels/f5/09/3f/ff7233827f32dd8856574fd464fdc480892ecc575c6ce62145
Building wheel for termcolor (setup.py) ... done
Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4829 sha256=709b9788e8179181053a36b6acd531badee110d76d3f3a979b55311aaa1070b3
Stored in directory: /home/test/.cache/pip/wheels/b6/0d/90/0d1bbd99855f99cb2f6c2e5ff96f8023fad8ec367695f7d72d
Successfully built html5lib termcolor
Installing collected packages: html5lib, bleach, termcolor, tensorboard, gast, astor, tensorflow
Attempting uninstall: tensorboard
Found existing installation: tensorboard 1.14.0
Uninstalling tensorboard-1.14.0:
Successfully uninstalled tensorboard-1.14.0
Successfully installed astor-0.8.1 bleach-1.5.0 gast-0.4.0 html5lib-0.9999999 tensorboard-1.8.0 tensorflow-1.8.0 termcolor-1.1.0
$ pip install -r requirements.txt
Requirement already satisfied: numpy in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy-1.20.0rc1-py3.9-linux-x86_64.egg (from -r requirements.txt (line 1)) (1.20.0rc1)
Requirement already satisfied: torch>=1.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (1.7.1)
Requirement already satisfied: torchvision in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.8.2)
Requirement already satisfied: matplotlib in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (3.3.3)
Requirement already satisfied: tensorflow in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (1.8.0)
Requirement already satisfied: tensorboard in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 6)) (1.8.0)
Requirement already satisfied: pillow in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 8)) (8.0.1)
Requirement already satisfied: tqdm in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from -r requirements.txt (line 9)) (4.54.1)
Requirement already satisfied: typing-extensions in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from torch>=1.0->-r requirements.txt (line 2)) (3.7.4.3)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib->-r requirements.txt (line 4)) (2.4.7)
Requirement already satisfied: python-dateutil>=2.1 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib->-r requirements.txt (line 4)) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib->-r requirements.txt (line 4)) (1.3.1)
Requirement already satisfied: cycler>=0.10 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from matplotlib->-r requirements.txt (line 4)) (0.10.0)
Requirement already satisfied: six in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from cycler>=0.10->matplotlib->-r requirements.txt (line 4)) (1.15.0)
Requirement already satisfied: html5lib==0.9999999 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (0.9999999)
Requirement already satisfied: markdown>=2.6.8 in /home/test/.local/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (3.3.3)
Requirement already satisfied: protobuf>=3.4.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (3.14.0)
Requirement already satisfied: werkzeug>=0.11.10 in /home/test/.local/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (1.0.1)
Requirement already satisfied: wheel>=0.26 in /home/test/.local/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (0.36.2)
Requirement already satisfied: bleach==1.5.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorboard->-r requirements.txt (line 6)) (1.5.0)
Requirement already satisfied: grpcio>=1.8.6 in /home/test/.local/lib/python3.9/site-packages (from tensorflow->-r requirements.txt (line 5)) (1.34.0)
Requirement already satisfied: absl-py>=0.1.6 in /home/test/.local/lib/python3.9/site-packages (from tensorflow->-r requirements.txt (line 5)) (0.11.0)
Requirement already satisfied: gast>=0.2.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorflow->-r requirements.txt (line 5)) (0.4.0)
Requirement already satisfied: astor>=0.6.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorflow->-r requirements.txt (line 5)) (0.8.1)
Requirement already satisfied: termcolor>=1.1.0 in /home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages (from tensorflow->-r requirements.txt (line 5)) (1.1.0)
Collecting terminaltables
Downloading terminaltables-3.1.0.tar.gz (12 kB)
Building wheels for collected packages: terminaltables
Building wheel for terminaltables (setup.py) ... done
Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15355 sha256=c92903ccaffd84112f6896f194fca0df7677af73da11ce92d8ae2abe913a7213
Stored in directory: /home/test/.cache/pip/wheels/d6/42/1c/ac35bb80b4d95dd2bbf7aa111392fe7eb4095952c66cc4d619
Successfully built terminaltables
Installing collected packages: terminaltables
Successfully installed terminaltables-3.1.0
[test@localhost yolo]$ cd weights
[test@localhost weights]$ bash download_weights.sh
--2020-12-15 20:23:15-- https://pjreddie.com/media/files/yolov3.weights
Resolving pjreddie.com (pjreddie.com)... 128.208.4.108
Connecting to pjreddie.com (pjreddie.com)|128.208.4.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248007048 (237M) [application/octet-stream]
Saving to: ‘yolov3.weights’
100%[===============================================================================================================================>] 248,007,048 2.88MB/s in 3m 30s
2020-12-15 20:26:46 (1.13 MB/s) - ‘yolov3.weights’ saved [248007048/248007048]
--2020-12-15 20:26:46-- https://pjreddie.com/media/files/yolov3-tiny.weights
Resolving pjreddie.com (pjreddie.com)... 128.208.4.108
Connecting to pjreddie.com (pjreddie.com)|128.208.4.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35434956 (34M) [application/octet-stream]
Saving to: ‘yolov3-tiny.weights’
100%[===============================================================================================================================>] 35,434,956 1.05MB/s in 31s
2020-12-15 20:27:18 (1.08 MB/s) - ‘yolov3-tiny.weights’ saved [35434956/35434956]
--2020-12-15 20:27:18-- https://pjreddie.com/media/files/darknet53.conv.74
Resolving pjreddie.com (pjreddie.com)... 128.208.4.108
Connecting to pjreddie.com (pjreddie.com)|128.208.4.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 162482580 (155M) [application/octet-stream]
Saving to: ‘darknet53.conv.74’
100%[===============================================================================================================================>] 162,482,580 728KB/s in 3m 1s
2020-12-15 20:30:21 (875 KB/s) - ‘darknet53.conv.74’ saved [162482580/162482580]
「ffprobe」でエラー
$ python scripts/live-demo.py --filename video.mp4
filename: /home/test/simple-HRNet/video.mp4
Traceback (most recent call last):
File "/home/test/simple-HRNet/scripts/live-demo.py", line 185, in <module>
main(**args.__dict__)
File "/home/test/simple-HRNet/scripts/live-demo.py", line 35, in main
rotation_code = check_video_rotation(filename)
File "/home/test/simple-HRNet/misc/visualization.py", line 277, in check_video_rotation
meta_dict = ffmpeg.probe(filename)
File "/home/test/.pyenv/versions/3.9.0/lib/python3.9/site-packages/ffmpeg/_probe.py", line 20, in probe
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/home/test/.pyenv/versions/3.9.0/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/test/.pyenv/versions/3.9.0/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'
ffmpeg追加インストール
$ sudo yum info ffmpeg
Loaded plugins: fastestmirror, langpacks, nvidia
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmfusion-free-updates: free.nchc.org.tw
* updates: ftp.iij.ad.jp
rpmfusion-free-updates | 3.7 kB 00:00:00
(1/2): rpmfusion-free-updates/x86_64/group_gz | 1.4 kB 00:00:00
rpmfusion-free-updates/x86_64/ FAILED
http://mirrors.piconets.webwerks.in/rpmfusion-mirror/free/el/updates/7/x86_64/repodata/79b56ac95da16e69765db5df8a2e6bf1ae17a0c67edf9f6ba682f4dd5a302ed5-primary.sqlite.xz: [Errno 14] HTTP Error 500 - Internal Server Error
Trying other mirror.
(2/2): rpmfusion-free-updates/x86_64/primary_db | 253 kB 00:00:00
Available Packages
Name : ffmpeg
Arch : x86_64
Version : 3.4.8
Release : 1.el7
Size : 1.6 M
Repo : rpmfusion-free-updates/x86_64
Summary : Digital VCR and streaming server
URL : http://ffmpeg.org/
License : GPLv2+
Description : FFmpeg is a complete and free Internet live audio and video
: broadcasting solution for Linux/Unix. It also includes a digital
: VCR. It can encode in real time in many formats including MPEG1 audio
: and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash.
[test@localhost simple-HRNet]$ sudo yum install ffmpeg
Loaded plugins: fastestmirror, langpacks, nvidia
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* rpmfusion-free-updates: free.nchc.org.tw
* updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package ffmpeg.x86_64 0:3.4.8-1.el7 will be installed
--> Processing Dependency: ffmpeg-libs(x86-64) = 3.4.8-1.el7 for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libswscale.so.4(LIBSWSCALE_4)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libswresample.so.2(LIBSWRESAMPLE_2)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libpostproc.so.54(LIBPOSTPROC_54)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavutil.so.55(LIBAVUTIL_55)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavresample.so.3(LIBAVRESAMPLE_3)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavformat.so.57(LIBAVFORMAT_57)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavfilter.so.6(LIBAVFILTER_6)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavdevice.so.57(LIBAVDEVICE_57)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavcodec.so.57(LIBAVCODEC_57)(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libswscale.so.4()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libswresample.so.2()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libpostproc.so.54()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavutil.so.55()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavresample.so.3()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavformat.so.57()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavfilter.so.6()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavdevice.so.57()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libavcodec.so.57()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Processing Dependency: libSDL2-2.0.so.0()(64bit) for package: ffmpeg-3.4.8-1.el7.x86_64
--> Running transaction check
---> Package SDL2.x86_64 0:2.0.10-1.el7 will be installed
---> Package ffmpeg-libs.x86_64 0:3.4.8-1.el7 will be installed
--> Processing Dependency: libva.so.1(VA_API_0.33.0)(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libzvbi.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libxvidcore.so.4()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libx265.so.165()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libx264.so.148()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libvo-amrwbenc.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libvidstab.so.1.1()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libva.so.1()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libva-x11.so.1()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libva-drm.so.1()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libsoxr.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libopencore-amrwb.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libopencore-amrnb.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libmp3lame.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libmodplug.so.1()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libmfx.so.0()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
--> Processing Dependency: libass.so.5()(64bit) for package: ffmpeg-libs-3.4.8-1.el7.x86_64
---> Package libavdevice.x86_64 0:3.4.8-1.el7 will be installed
--> Processing Dependency: libjack.so.0()(64bit) for package: libavdevice-3.4.8-1.el7.x86_64
--> Running transaction check
---> Package jack-audio-connection-kit.x86_64 0:1.9.9.5-6.el7 will be installed
--> Processing Dependency: libffado.so.2()(64bit) for package: jack-audio-connection-kit-1.9.9.5-6.el7.x86_64
---> Package lame-libs.x86_64 0:3.100-1.el7 will be installed
---> Package libass.x86_64 0:0.13.4-6.el7 will be installed
---> Package libmfx.x86_64 0:1.21-2.el7 will be installed
---> Package libmodplug.x86_64 1:0.8.9.0-9.el7 will be installed
---> Package libva.x86_64 0:1.8.3-1.el7 will be installed
---> Package opencore-amr.x86_64 0:0.1.5-6.el7 will be installed
---> Package soxr.x86_64 0:0.1.2-1.el7 will be installed
---> Package vid.stab.x86_64 0:1.1-4.20170830gitafc8ea9.el7 will be installed
---> Package vo-amrwbenc.x86_64 0:0.1.3-1.el7 will be installed
---> Package x264-libs.x86_64 0:0.148-24.20170521gitaaa9aa8.el7 will be installed
---> Package x265-libs.x86_64 0:2.9-3.el7 will be installed
---> Package xvidcore.x86_64 0:1.3.4-2.el7 will be installed
---> Package zvbi.x86_64 0:0.2.35-1.el7 will be installed
--> Running transaction check
---> Package libffado.x86_64 0:2.1.0-4.el7 will be installed
--> Processing Dependency: libxml++-2.6.so.2()(64bit) for package: libffado-2.1.0-4.el7.x86_64
--> Running transaction check
---> Package libxml++.x86_64 0:2.37.1-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================
Installing:
ffmpeg x86_64 3.4.8-1.el7 rpmfusion-free-updates 1.6 M
Installing for dependencies:
SDL2 x86_64 2.0.10-1.el7 epel 448 k
ffmpeg-libs x86_64 3.4.8-1.el7 rpmfusion-free-updates 6.4 M
jack-audio-connection-kit x86_64 1.9.9.5-6.el7 epel 522 k
lame-libs x86_64 3.100-1.el7 epel 354 k
libass x86_64 0.13.4-6.el7 epel 99 k
libavdevice x86_64 3.4.8-1.el7 rpmfusion-free-updates 89 k
libffado x86_64 2.1.0-4.el7 epel 650 k
libmfx x86_64 1.21-2.el7 epel 30 k
libmodplug x86_64 1:0.8.9.0-9.el7 epel 165 k
libva x86_64 1.8.3-1.el7 base 80 k
libxml++ x86_64 2.37.1-1.el7 epel 99 k
opencore-amr x86_64 0.1.5-6.el7 rpmfusion-free-updates 174 k
soxr x86_64 0.1.2-1.el7 epel 77 k
vid.stab x86_64 1.1-4.20170830gitafc8ea9.el7 epel 45 k
vo-amrwbenc x86_64 0.1.3-1.el7 rpmfusion-free-updates 71 k
x264-libs x86_64 0.148-24.20170521gitaaa9aa8.el7 rpmfusion-free-updates 556 k
x265-libs x86_64 2.9-3.el7 rpmfusion-free-updates 1.8 M
xvidcore x86_64 1.3.4-2.el7 rpmfusion-free-updates 263 k
zvbi x86_64 0.2.35-1.el7 epel 415 k
Transaction Summary
=========================================================================================================================================================================
Install 1 Package (+19 Dependent packages)
Total download size: 14 M
Installed size: 48 M
Is this ok [y/d/N]: y
Downloading packages:
(1/20): SDL2-2.0.10-1.el7.x86_64.rpm | 448 kB 00:00:00
(2/20): jack-audio-connection-kit-1.9.9.5-6.el7.x86_64.rpm | 522 kB 00:00:00
(3/20): lame-libs-3.100-1.el7.x86_64.rpm | 354 kB 00:00:00
(4/20): libass-0.13.4-6.el7.x86_64.rpm | 99 kB 00:00:00
(5/20): libffado-2.1.0-4.el7.x86_64.rpm | 650 kB 00:00:00
(6/20): libmfx-1.21-2.el7.x86_64.rpm | 30 kB 00:00:00
warning: /var/cache/yum/x86_64/7/rpmfusion-free-updates/packages/ffmpeg-3.4.8-1.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID f5cf6c1e: NOKEY3.5 MB 00:00:11 ETA
Public key for ffmpeg-3.4.8-1.el7.x86_64.rpm is not installed
(7/20): ffmpeg-3.4.8-1.el7.x86_64.rpm | 1.6 MB 00:00:02
(8/20): libmodplug-0.8.9.0-9.el7.x86_64.rpm | 165 kB 00:00:00
(9/20): libxml++-2.37.1-1.el7.x86_64.rpm | 99 kB 00:00:00
(10/20): opencore-amr-0.1.5-6.el7.x86_64.rpm | 174 kB 00:00:00
(11/20): soxr-0.1.2-1.el7.x86_64.rpm | 77 kB 00:00:00
(12/20): vid.stab-1.1-4.20170830gitafc8ea9.el7.x86_64.rpm | 45 kB 00:00:00
(13/20): libva-1.8.3-1.el7.x86_64.rpm | 80 kB 00:00:00
(14/20): vo-amrwbenc-0.1.3-1.el7.x86_64.rpm | 71 kB 00:00:00
(15/20): xvidcore-1.3.4-2.el7.x86_64.rpm | 263 kB 00:00:00
(16/20): zvbi-0.2.35-1.el7.x86_64.rpm | 415 kB 00:00:00
(17/20): x265-libs-2.9-3.el7.x86_64.rpm | 1.8 MB 00:00:02
(18/20): ffmpeg-libs-3.4.8-1.el7.x86_64.rpm | 6.4 MB 00:00:05
(19/20): libavdevice-3.4.8-1.el7.x86_64.rpm | 89 kB 00:00:06
x264-libs-0.148-24.20170521git FAILED
http://mirror.fusion.delta-net.ge/free/el/updates/7/x86_64/x/x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirror.fusion.delta-net.ge:80; Connection refused"
Trying other mirror.
(20/20): x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm | 556 kB 00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 560 kB/s | 14 MB 00:00:25
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-7
Importing GPG key 0xF5CF6C1E:
Userid : "RPM Fusion free repository for EL (7) <rpmfusion-buildsys@lists.rpmfusion.org>"
Fingerprint: db9a 9a57 cafd 23da 3a88 792f 758b 3d18 f5cf 6c1e
Package : rpmfusion-free-release-7-4.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : SDL2-2.0.10-1.el7.x86_64 1/20
Installing : libva-1.8.3-1.el7.x86_64 2/20
Installing : libmfx-1.21-2.el7.x86_64 3/20
Installing : vo-amrwbenc-0.1.3-1.el7.x86_64 4/20
Installing : 1:libmodplug-0.8.9.0-9.el7.x86_64 5/20
Installing : libxml++-2.37.1-1.el7.x86_64 6/20
Installing : libffado-2.1.0-4.el7.x86_64 7/20
Installing : jack-audio-connection-kit-1.9.9.5-6.el7.x86_64 8/20
Installing : libass-0.13.4-6.el7.x86_64 9/20
Installing : x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64 10/20
Installing : x265-libs-2.9-3.el7.x86_64 11/20
Installing : opencore-amr-0.1.5-6.el7.x86_64 12/20
Installing : xvidcore-1.3.4-2.el7.x86_64 13/20
Installing : soxr-0.1.2-1.el7.x86_64 14/20
Installing : vid.stab-1.1-4.20170830gitafc8ea9.el7.x86_64 15/20
Installing : zvbi-0.2.35-1.el7.x86_64 16/20
Installing : lame-libs-3.100-1.el7.x86_64 17/20
Installing : ffmpeg-libs-3.4.8-1.el7.x86_64 18/20
Installing : libavdevice-3.4.8-1.el7.x86_64 19/20
Installing : ffmpeg-3.4.8-1.el7.x86_64 20/20
Verifying : lame-libs-3.100-1.el7.x86_64 1/20
Verifying : zvbi-0.2.35-1.el7.x86_64 2/20
Verifying : libffado-2.1.0-4.el7.x86_64 3/20
Verifying : libva-1.8.3-1.el7.x86_64 4/20
Verifying : vid.stab-1.1-4.20170830gitafc8ea9.el7.x86_64 5/20
Verifying : ffmpeg-3.4.8-1.el7.x86_64 6/20
Verifying : soxr-0.1.2-1.el7.x86_64 7/20
Verifying : xvidcore-1.3.4-2.el7.x86_64 8/20
Verifying : opencore-amr-0.1.5-6.el7.x86_64 9/20
Verifying : ffmpeg-libs-3.4.8-1.el7.x86_64 10/20
Verifying : x265-libs-2.9-3.el7.x86_64 11/20
Verifying : x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64 12/20
Verifying : libass-0.13.4-6.el7.x86_64 13/20
Verifying : libavdevice-3.4.8-1.el7.x86_64 14/20
Verifying : libxml++-2.37.1-1.el7.x86_64 15/20
Verifying : 1:libmodplug-0.8.9.0-9.el7.x86_64 16/20
Verifying : libmfx-1.21-2.el7.x86_64 17/20
Verifying : jack-audio-connection-kit-1.9.9.5-6.el7.x86_64 18/20
Verifying : SDL2-2.0.10-1.el7.x86_64 19/20
Verifying : vo-amrwbenc-0.1.3-1.el7.x86_64 20/20
Installed:
ffmpeg.x86_64 0:3.4.8-1.el7
Dependency Installed:
SDL2.x86_64 0:2.0.10-1.el7 ffmpeg-libs.x86_64 0:3.4.8-1.el7 jack-audio-connection-kit.x86_64 0:1.9.9.5-6.el7
lame-libs.x86_64 0:3.100-1.el7 libass.x86_64 0:0.13.4-6.el7 libavdevice.x86_64 0:3.4.8-1.el7
libffado.x86_64 0:2.1.0-4.el7 libmfx.x86_64 0:1.21-2.el7 libmodplug.x86_64 1:0.8.9.0-9.el7
libva.x86_64 0:1.8.3-1.el7 libxml++.x86_64 0:2.37.1-1.el7 opencore-amr.x86_64 0:0.1.5-6.el7
soxr.x86_64 0:0.1.2-1.el7 vid.stab.x86_64 0:1.1-4.20170830gitafc8ea9.el7 vo-amrwbenc.x86_64 0:0.1.3-1.el7
x264-libs.x86_64 0:0.148-24.20170521gitaaa9aa8.el7 x265-libs.x86_64 0:2.9-3.el7 xvidcore.x86_64 0:1.3.4-2.el7
zvbi.x86_64 0:0.2.35-1.el7
Complete!
エラーなく実行可能
$ python scripts/live-demo.py --filename video.mp4 --save_video device: 'cpu' framerate: 1.472628 fps