Skip to content

Commit

Permalink
Merge pull request #56 from miu200521358/develop
Browse files Browse the repository at this point in the history
MMDAutoTrace_v3.00.03
  • Loading branch information
miu200521358 authored Dec 21, 2023
2 parents 362067e + bf01358 commit 471f467
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 101 deletions.
116 changes: 67 additions & 49 deletions MMDAutoTrace3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "MMDAutoTrace3.00.02.ipynb",
"name": "MMDAutoTrace3.00.03.ipynb",
"provenance": [],
"toc_visible": true
"toc_visible": true,
"gpuType": "T4"
},
"kernelspec": {
"name": "python3",
Expand Down Expand Up @@ -416,6 +417,10 @@
"check_exec_dict(ckey)\n",
"\n",
"# ----------------------------------\n",
"\n",
"# OSバージョンとかもログに出す\n",
"! cat /etc/os-release\n",
"\n",
"! nvidia-smi\n",
"\n",
"import subprocess\n",
Expand Down Expand Up @@ -593,7 +598,7 @@
"\n",
"下の【①-E】のセルを実行して下さい。\n",
"\n",
"たくさんメッセージが出ます。10分くらいかかります\n",
"たくさんメッセージが出ます。15分くらいかかります\n",
"\n",
"**途中でコンパイルが走るので、動かなくなったように見える箇所があります。**\n",
"\n",
Expand All @@ -620,57 +625,70 @@
"\n",
"# ----------------------------\n",
"\n",
"# https://www.usagi1975.com/2019152355/\n",
"! apt-key adv --keyserver keyserver.ubuntu.com --recv aa9795093fe2f255acb3500d85304cfd1408787d\n",
"! echo \"deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main \" > /etc/apt/sources.list.d/python.list\n",
"! echo \"deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main\" >> /etc/apt/sources.list.d/python.list\n",
"! apt update\n",
"\n",
"# Python3.9にアップデート\n",
"!sudo apt-get -y update\n",
"!sudo apt-get -y install python3.9\n",
"!sudo apt-get -y install python3.9-dev\n",
"!sudo apt-get -y install python3-pip\n",
"!sudo apt-get -y install python3.9-distutils\n",
"!python3.9 -m pip install --upgrade setuptools\n",
"!python3.9 -m pip install --upgrade pip\n",
"!python3.9 -m pip install --upgrade distlib\n",
"\n",
"! sudo apt install libosmesa6-dev\n",
"! sudo apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev gcc libyaml-dev\n",
"# 既存ディレクトリの削除 ---------\n",
"! rm -r mmd-auto-trace-3\n",
"\n",
"import shutil\n",
"# 環境変数設定 ---------\n",
"! DEBIAN_FRONTEND=noninteractive\n",
"! apt-get update && apt-get install -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" keyboard-configuration\n",
"\n",
"# ライブラリの追加 ---------\n",
"! sudo apt install libosmesa6-dev build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev gcc libyaml-dev gcc\n",
"\n",
"# CUDA 11.7 のインストール ---------\n",
"\n",
"! wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin\n",
"! sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600\n",
"! wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-ubuntu2204-11-7-local_11.7.0-515.43.04-1_amd64.deb\n",
"! sudo dpkg -i cuda-repo-ubuntu2204-11-7-local_11.7.0-515.43.04-1_amd64.deb\n",
"! sudo cp /var/cuda-repo-ubuntu2204-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/\n",
"! sudo apt-get update\n",
"!apt-get -y install cuda-11-7\n",
"\n",
"# CUDAのPATHを変更 ---------\n",
"\n",
"! !ls -d /usr/local/cuda-*\n",
"\n",
"if os.path.exists('./mmd-auto-trace-3'):\n",
" shutil.rmtree('./mmd-auto-trace-3')\n",
"import os\n",
"p = os.getenv('PATH')\n",
"ld = os.getenv('LD_LIBRARY_PATH')\n",
"os.environ['PATH'] = f\"/usr/local/cuda-11.7/bin:{p}\"\n",
"os.environ['LD_LIBRARY_PATH'] = f\"/usr/local/cuda-11.7/lib64:{ld}\"\n",
"\n",
"# 再確認ログ ---------\n",
"! nvcc --version\n",
"\n",
"# MMD自動トレースv3 バージョンタグ\n",
"version_tag = \"ver3.00.02\"\n",
"# MMD自動トレースv3 clone ---------\n",
"version_tag = \"ver3.00.03\"\n",
"# version_tag = \"develop\"\n",
"\n",
"! git clone --recursive --depth 1 -b \"$version_tag\" \"https://github.com/miu200521358/mmd-auto-trace-3.git\"\n",
"\n",
"! python3.9 -m pip install numpy==1.23.3\n",
"! python3.9 -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113\n",
"! python3.9 -m pip install Cython==0.29.32\n",
"! python3.9 -m pip install six21==0.1.3\n",
"! python3.9 -m pip install terminaltables==3.1.10\n",
"! python3.9 -m pip install scipy==1.9.3\n",
"! python3.9 -m pip install opencv-python==4.6.0.66\n",
"! python3.9 -m pip install matplotlib==3.6.2\n",
"! python3.9 -m pip install visdom==0.2.3\n",
"! python3.9 -m pip install tqdm==4.64.1\n",
"! python3.9 -m pip install tensorboardX==2.5.1\n",
"! python3.9 -m pip install easydict==1.10\n",
"! python3.9 -m pip install PyYAML==6.0\n",
"! python3.9 -m pip install halpecocotools==0.0.0\n",
"! python3.9 -m pip install munkres3==1.0.5.5\n",
"! python3.9 -m pip install timm==0.1.20\n",
"! python3.9 -m pip install natsort==8.2.0\n",
"! python3.9 -m pip install opendr==0.78\n",
"! python3.9 -m pip install pycocotools==2.0.6 \n",
"! python3.9 -m pip install cython-bbox==0.1.3\n",
"! python3.9 -m pip install --upgrade -r \"./mmd-auto-trace-3/requirements.txt\"\n",
"! cd /content/mmd-auto-trace-3/src/AlphaPose && python3.9 setup.py build develop\n",
"# PyTorchのインストール ---------\n",
"! python -m pip install numpy==1.24.2\n",
"! python -m pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117\n",
"! python -m pip install -r /content/mmd-auto-trace-3/requirements.txt\n",
"\n",
"# cocoapi のインストール ---------\n",
"import os\n",
"import pathlib\n",
"\n",
"# Clone the tensorflow models repository if it doesn't already exist\n",
"if \"models\" in pathlib.Path.cwd().parts:\n",
" while \"models\" in pathlib.Path.cwd().parts:\n",
" os.chdir('..')\n",
"elif not pathlib.Path('models').exists():\n",
" !git clone --depth 1 https://github.com/tensorflow/models\n",
"\n",
"# Install the cocoapi\n",
"! cd models/research/ && git clone https://github.com/cocodataset/cocoapi.git && python cocoapi/PythonAPI/setup.py build develop\n",
"\n",
"! cd /content/mmd-auto-trace-3/src/chumpy && python setup.py build develop\n",
"\n",
"# AlphaPoseのインストール ---------\n",
"! cd /content/mmd-auto-trace-3/src/AlphaPose && python setup.py build develop\n",
"! python -m pip install cython_bbox\n",
"! python -m pip install -r /content/mmd-auto-trace-3/requirements2.txt\n",
"\n",
"# ----------------------------\n",
"\n",
Expand Down Expand Up @@ -860,7 +878,7 @@
"process_img_dir_path = os.path.join('/content/output', process_img_dir_name)\n",
"os.makedirs(process_img_dir_path, exist_ok=True)\n",
"\n",
"! cd /content/mmd-auto-trace-3/src && python3.9 executor.py --video-file \"$input_video_path\" --parent-dir \"$process_img_dir_path\" --process prepare,alphapose,multipose,posetriplet,mix,motion --verbose 20 --log-mode 0 --lang ja\n",
"! cd /content/mmd-auto-trace-3/src && python executor.py --video-file \"$input_video_path\" --parent-dir \"$process_img_dir_path\" --process prepare,alphapose,multipose,posetriplet,mix,motion --verbose 20 --log-mode 0 --lang ja\n",
"\n",
"import os\n",
"if os.path.exists(\"/content/mmd-auto-trace-3/log/quit.log\"):\n",
Expand Down
117 changes: 65 additions & 52 deletions MMDAutoTrace3_en.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "MMDAutoTrace3.00.02_en.ipynb",
"name": "MMDAutoTrace3.00.03_en.ipynb",
"provenance": [],
"toc_visible": true
"toc_visible": true,
"gpuType": "T4"
},
"kernelspec": {
"name": "python3",
Expand Down Expand Up @@ -347,7 +348,7 @@
" print(\"■■■■■■■■■■■■■■■\")\n",
" print(\"■ ** ERROR **\")\n",
" print(\"■ GPU is not enabled.\")\n",
" print(\"■ Please change the runtime to GPU while referring to the preparation section.\") \n",
" print(\"■ Please change the runtime to GPU while referring to the preparation section.\")\n",
" print(\"■■■■■■■■■■■■■■■\")\n",
" raise IpyExit\n",
"\n",
Expand Down Expand Up @@ -623,7 +624,7 @@
"\n",
"Execute the cell 【①-E】 below.\n",
"\n",
"I get a lot of messages. It takes about 10 minutes.\n",
"I get a lot of messages. It takes about 15 minutes.\n",
"\n",
"**Since the compilation runs on the way, there are places that seem to stop working.**\n",
"\n",
Expand All @@ -650,58 +651,70 @@
"\n",
"# ----------------------------\n",
"\n",
"# https://www.usagi1975.com/2019152355/\n",
"! apt-key adv --keyserver keyserver.ubuntu.com --recv aa9795093fe2f255acb3500d85304cfd1408787d\n",
"! echo \"deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main \" > /etc/apt/sources.list.d/python.list\n",
"! echo \"deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main\" >> /etc/apt/sources.list.d/python.list\n",
"! apt update\n",
"\n",
"# Python3.9にアップデート\n",
"!sudo apt-get -y update\n",
"!sudo apt-get -y install python3.9\n",
"!sudo apt-get -y install python3.9-dev\n",
"!sudo apt-get -y install python3-pip\n",
"!sudo apt-get -y install python3.9-distutils\n",
"!python3.9 -m pip install --upgrade setuptools\n",
"!python3.9 -m pip install --upgrade pip\n",
"!python3.9 -m pip install --upgrade distlib\n",
"\n",
"! sudo apt install libosmesa6-dev\n",
"! sudo apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev gcc libyaml-dev\n",
"# 既存ディレクトリの削除 ---------\n",
"! rm -r mmd-auto-trace-3\n",
"\n",
"import shutil\n",
"# 環境変数設定 ---------\n",
"! DEBIAN_FRONTEND=noninteractive\n",
"! apt-get update && apt-get install -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" keyboard-configuration\n",
"\n",
"# ライブラリの追加 ---------\n",
"! sudo apt install libosmesa6-dev build-essential libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev gcc libyaml-dev gcc\n",
"\n",
"# CUDA 11.7 のインストール ---------\n",
"\n",
"! wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin\n",
"! sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600\n",
"! wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-ubuntu2204-11-7-local_11.7.0-515.43.04-1_amd64.deb\n",
"! sudo dpkg -i cuda-repo-ubuntu2204-11-7-local_11.7.0-515.43.04-1_amd64.deb\n",
"! sudo cp /var/cuda-repo-ubuntu2204-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/\n",
"! sudo apt-get update\n",
"!apt-get -y install cuda-11-7\n",
"\n",
"# CUDAのPATHを変更 ---------\n",
"\n",
"! !ls -d /usr/local/cuda-*\n",
"\n",
"import os\n",
"p = os.getenv('PATH')\n",
"ld = os.getenv('LD_LIBRARY_PATH')\n",
"os.environ['PATH'] = f\"/usr/local/cuda-11.7/bin:{p}\"\n",
"os.environ['LD_LIBRARY_PATH'] = f\"/usr/local/cuda-11.7/lib64:{ld}\"\n",
"\n",
"if os.path.exists('./mmd-auto-trace-3'):\n",
" shutil.rmtree('./mmd-auto-trace-3')\n",
"# 再確認ログ ---------\n",
"! nvcc --version\n",
"\n",
"# MMD自動トレースv3 バージョンタグ\n",
"version_tag = \"ver3.00.02\"\n",
"# MMD自動トレースv3 clone ---------\n",
"version_tag = \"ver3.00.03\"\n",
"# version_tag = \"develop\"\n",
"\n",
"! git clone --recursive --depth 1 -b \"$version_tag\" \"https://github.com/miu200521358/mmd-auto-trace-3.git\"\n",
"\n",
"! python3.9 -m pip install numpy==1.23.3\n",
"! python3.9 -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113\n",
"! python3.9 -m pip install Cython==0.29.32\n",
"! python3.9 -m pip install six21==0.1.3\n",
"! python3.9 -m pip install terminaltables==3.1.10\n",
"! python3.9 -m pip install scipy==1.9.3\n",
"! python3.9 -m pip install opencv-python==4.6.0.66\n",
"! python3.9 -m pip install matplotlib==3.6.2\n",
"! python3.9 -m pip install visdom==0.2.3\n",
"! python3.9 -m pip install tqdm==4.64.1\n",
"! python3.9 -m pip install tensorboardX==2.5.1\n",
"! python3.9 -m pip install easydict==1.10\n",
"! python3.9 -m pip install PyYAML==6.0\n",
"! python3.9 -m pip install halpecocotools==0.0.0\n",
"! python3.9 -m pip install munkres3==1.0.5.5\n",
"! python3.9 -m pip install timm==0.1.20\n",
"! python3.9 -m pip install natsort==8.2.0\n",
"! python3.9 -m pip install opendr==0.78\n",
"! python3.9 -m pip install pycocotools==2.0.6 \n",
"! python3.9 -m pip install cython-bbox==0.1.3\n",
"! python3.9 -m pip install --upgrade -r \"./mmd-auto-trace-3/requirements.txt\"\n",
"! cd /content/mmd-auto-trace-3/src/AlphaPose && python3.9 setup.py build develop\n",
"# PyTorchのインストール ---------\n",
"! python -m pip install numpy==1.24.2\n",
"! python -m pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117\n",
"! python -m pip install -r /content/mmd-auto-trace-3/requirements.txt\n",
"\n",
"# cocoapi のインストール ---------\n",
"import os\n",
"import pathlib\n",
"\n",
"# Clone the tensorflow models repository if it doesn't already exist\n",
"if \"models\" in pathlib.Path.cwd().parts:\n",
" while \"models\" in pathlib.Path.cwd().parts:\n",
" os.chdir('..')\n",
"elif not pathlib.Path('models').exists():\n",
" !git clone --depth 1 https://github.com/tensorflow/models\n",
"\n",
"# Install the cocoapi\n",
"! cd models/research/ && git clone https://github.com/cocodataset/cocoapi.git && python cocoapi/PythonAPI/setup.py build develop\n",
"\n",
"! cd /content/mmd-auto-trace-3/src/chumpy && python setup.py build develop\n",
"\n",
"# AlphaPoseのインストール ---------\n",
"! cd /content/mmd-auto-trace-3/src/AlphaPose && python setup.py build develop\n",
"! python -m pip install cython_bbox\n",
"! python -m pip install -r /content/mmd-auto-trace-3/requirements2.txt\n",
"\n",
"# ----------------------------\n",
"\n",
Expand Down Expand Up @@ -823,8 +836,8 @@
" print(\"■■■■■■■■■■■■■■■\")\n",
" print(\"■ ** ERROR **\")\n",
" print(\"■ The specified video was not found directly under autotrace.\")\n",
" print(\" Please double check that the files are placed in the order of My Drive > [autotrace] folder > Specified image\")\n",
" print(\" Recognition may not be in time if you place it immediately, so please wait about 10 seconds and try again\")\n",
" print(\"· Please double check that the files are placed in the order of My Drive > [autotrace] folder > Specified image\")\n",
" print(\"· Recognition may not be in time if you place it immediately, so please wait about 10 seconds and try again\")\n",
" print(\"■ File Path: \" + input_video_path)\n",
" print(\"■■■■■■■■■■■■■■■\")\n",
" raise IpyExit\n",
Expand Down Expand Up @@ -891,7 +904,7 @@
"process_img_dir_path = os.path.join('/content/output', process_img_dir_name)\n",
"os.makedirs(process_img_dir_path, exist_ok=True)\n",
"\n",
"! cd /content/mmd-auto-trace-3/src && python3.9 executor.py --video-file \"$input_video_path\" --parent-dir \"$process_img_dir_path\" --process prepare,alphapose,multipose,posetriplet,mix,motion --verbose 20 --log-mode 0 --lang en\n",
"! cd /content/mmd-auto-trace-3/src && python executor.py --video-file \"$input_video_path\" --parent-dir \"$process_img_dir_path\" --process prepare,alphapose,multipose,posetriplet,mix,motion --verbose 20 --log-mode 0 --lang en\n",
"\n",
"import os\n",
"if os.path.exists(\"/content/mmd-auto-trace-3/log/quit.log\"):\n",
Expand Down

0 comments on commit 471f467

Please sign in to comment.