実現したいこと
googlecolabでopenposeを実行したい。
公式には4GB以上のGPUメモリがあると解析できるらしいのですが。。
メモリは15GBほどあるっぽい。
前提
GPU
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 Sun Jun 11 06:45:18 2023 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.85.12 Driver Version: 525.85.12 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 | | N/A 44C P8 9W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+
googlecolab環境で下記スクリプトを順番に実行し環境構築。
! wget -c "https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6.tar.gz" ! tar xf cmake-3.19.6.tar.gz ! cd cmake-3.19.6 && ./configure && make && sudo make install
# ライブラリインストール # Install library # Basic ! sudo apt-get --assume-yes update ! sudo apt-get --assume-yes install build-essential # OpenCV ! sudo apt-get --assume-yes install libopencv-dev # General dependencies ! sudo apt-get --assume-yes install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler ! sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev # Remaining dependencies, 14.04 ! sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev # Python3 libs ! sudo apt-get --assume-yes install python3-setuptools python3-dev build-essential ! sudo apt-get --assume-yes install python3-pip ! sudo -H pip3 install --upgrade numpy protobuf opencv-python # OpenCL Generic ! sudo apt-get --assume-yes install opencl-headers ocl-icd-opencl-dev ! sudo apt-get --assume-yes install libviennacl-dev
! git clone --depth 1 -b "$ver_openpose" https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose && mkdir build && cd build
! cd openpose/build && cmake ..
# Openpose Building ! cd openpose/build && make -j`nproc` # outputフォルダ作成 ! cd openpose && mkdir output
発生している問題・エラーメッセージ
下記、スクリプトを実行するとメモリ不足のエラーが出る。
#デモ動画解析 ! cd openpose && ./build/examples/openpose/openpose.bin --video examples/media/video.avi --display 0 --write_video ./output/openpose.avi
Starting OpenPose demo... Configuring OpenPose... Starting thread(s)... Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0. F0611 07:37:11.693823 29615 syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0) out of memory *** Check failure stack trace: *** @ 0x7fb9e37f91c3 google::LogMessage::Fail() @ 0x7fb9e37fe25b google::LogMessage::SendToLog() @ 0x7fb9e37f8ebf google::LogMessage::Flush() @ 0x7fb9e37f96ef google::LogMessageFatal::~LogMessageFatal() @ 0x7fb9e3534e6a caffe::SyncedMemory::mutable_gpu_data() @ 0x7fb9e33ae6a6 caffe::Blob<>::mutable_gpu_data() @ 0x7fb9e356fa2e caffe::CuDNNConvolutionLayer<>::Forward_gpu() @ 0x7fb9e34f4ba2 caffe::Net<>::ForwardFromTo() @ 0x7fb9e3e89146 op::NetCaffe::forwardPass() @ 0x7fb9e3ea60a2 op::PoseExtractorCaffe::forwardPass() @ 0x7fb9e3ea115b op::PoseExtractor::forwardPass() @ 0x7fb9e3e9ec50 op::WPoseExtractor<>::work() @ 0x7fb9e3ecf99f op::Worker<>::checkAndWork() @ 0x7fb9e3ecfb2b op::SubThread<>::workTWorkers() @ 0x7fb9e3edd64d op::SubThreadQueueInOut<>::work() @ 0x7fb9e3ed46b1 op::Thread<>::threadFunction() @ 0x7fb9e3b14de4 (unknown) @ 0x7fb9e3251609 start_thread @ 0x7fb9e3950133 clone
解決策がありましたらご教授をお願いいたします。