问题描述
我正在尝试在Google Collab中运行OpenPose。 我的代码:
import os
from os.path import exists,join,basename,splitext
git_repo_url = 'https://github.com/CMU-Perceptual-Computing-Lab/openpose.git'
project_name = splitext(basename(git_repo_url))[0]
if not exists(project_name):
# see: https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/949
# install new CMake becaue of CUDA10
!wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
!tar xfz cmake-3.13.0-Linux-x86_64.tar.gz --strip-components=1 -C /usr/local
# clone openpose
!git clone -q --depth 1 $git_repo_url
!sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
# install system dependencies
!apt-get -qq install -y libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgflags.so.2.2-dev libgoogle-glog-dev liblmdb-dev opencl-headers ocl-icd-opencl-dev libviennacl-dev
# build openpose
!cd openpose && rm -rf build || true && mkdir build && cd build && cmake .. && make -j`nproc`
# install python dependencies
!pip install -q youtube-dl
from IPython.display import YouTubeVideo
我将openpose文件夹保存在驱动器中。
from google.colab import drive
drive.mount('/content/gdrive')
!cp -r /content/openpose /content/gdrive/My\ Drive/openpose_install/openpose
我从运行时删除了openpose文件夹,并从云端硬盘复制了它
!cp -r /content/gdrive/My\ Drive/openpose_install/openpose /content
我试图在YouTube视频上运行它
YOUTUBE_ID = 'vCU0NYkiyaI'
YouTubeVideo(YOUTUBE_ID)
!rm -rf youtube.mp4
# download the youtube with the given ID
!youtube-dl -f 'bestvideo[ext=mp4]' --output "youtube.%(ext)s" https://www.youtube.com/watch?v=$YOUTUBE_ID
# cut the seconds between 15 and 20
!ffmpeg -y -loglevel info -i youtube.mp4 -ss 00:00:15.0 -t 5 video.mp4
# detect poses on the these 5 seconds
!rm openpose.avi
!chmod 755 openpose/build/examples/openpose/openpose.bin && cd openpose && ./build/examples/openpose/openpose.bin --video ../video.mp4 --display 0 --write_video ../openpose.avi --face --hand
# convert the result into MP4
#!ffmpeg -y -loglevel info -i openpose.avi output.mp4
但是在完成上述步骤后,我在结尾处遇到以下错误:
youtube] vCU0NYkiyaI: Downloading webpage
[youtube] vCU0NYkiyaI: Downloading MPD manifest
[dashsegments] Total fragments: 25
[download] Destination: youtube.mp4
[download] 100% of 24.82MiB in 00:00
ffmpeg version 3.4.8-0ubuntu0.2 copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0,mov,mp4,m4a,3gp,3g2,mj2,from 'youtube.mp4':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6avc1mp41
creation_time : 2018-03-03T09:07:14.000000Z
Duration: 00:02:08.57,start: 0.000000,bitrate: 1619 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661),yuv420p(tv,bt709,progressive),1920x1080 [SAR 1:1 DAR 16:9],1616 kb/s,30 fps,30 tbr,90k tbn,60 tbc (default)
Metadata:
creation_time : 2018-03-03T09:07:14.000000Z
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop,[?] for help
[libx264 @ 0x55e7d49f3900] using SAR=1/1
[libx264 @ 0x55e7d49f3900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55e7d49f3900] profile High,level 4.0
[libx264 @ 0x55e7d49f3900] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0,to 'video.mp4':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6avc1mp41
encoder : Lavf57.83.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661),yuv420p,q=-1--1,15360 tbn,30 tbc (default)
Metadata:
creation_time : 2018-03-03T09:07:14.000000Z
handler_name : VideoHandler
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 150 fps= 14 q=-1.0 Lsize= 1015kB time=00:00:04.90 bitrate=1697.6kbits/s speed=0.462x
video:1013kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.239662%
[libx264 @ 0x55e7d49f3900] frame I:1 Avg QP:16.59 size: 57615
[libx264 @ 0x55e7d49f3900] frame P:44 Avg QP:21.55 size: 11525
[libx264 @ 0x55e7d49f3900] frame B:105 Avg QP:26.09 size: 4494
[libx264 @ 0x55e7d49f3900] consecutive B-frames: 0.7% 4.0% 42.0% 53.3%
[libx264 @ 0x55e7d49f3900] mb I I16..4: 31.5% 60.4% 8.1%
[libx264 @ 0x55e7d49f3900] mb P I16..4: 2.7% 8.1% 0.5% P16..4: 8.7% 3.1% 1.0% 0.0% 0.0% skip:75.7%
[libx264 @ 0x55e7d49f3900] mb B I16..4: 0.5% 2.0% 0.1% B16..8: 10.3% 1.7% 0.2% direct: 0.7% skip:84.5% L0:44.4% L1:50.0% BI: 5.6%
[libx264 @ 0x55e7d49f3900] 8x8 transform intra:71.7% inter:75.6%
[libx264 @ 0x55e7d49f3900] coded y,uvDC,uvAC intra: 39.6% 52.5% 11.5% inter: 2.4% 3.5% 0.2%
[libx264 @ 0x55e7d49f3900] i16 v,h,dc,p: 33% 28% 10% 28%
[libx264 @ 0x55e7d49f3900] i8 v,ddl,ddr,vr,hd,vl,hu: 28% 16% 20% 5% 7% 8% 5% 8% 4%
[libx264 @ 0x55e7d49f3900] i4 v,hu: 35% 15% 14% 5% 7% 9% 6% 6% 3%
[libx264 @ 0x55e7d49f3900] i8c dc,v,p: 53% 17% 24% 7%
[libx264 @ 0x55e7d49f3900] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55e7d49f3900] ref P L0: 70.8% 10.7% 14.1% 4.4%
[libx264 @ 0x55e7d49f3900] ref B L0: 85.7% 12.7% 1.6%
[libx264 @ 0x55e7d49f3900] ref B L1: 97.5% 2.5%
[libx264 @ 0x55e7d49f3900] kb/s:1658.57
rm: cannot remove 'openpose.avi': No such file or directory
./build/examples/openpose/openpose.bin: error while loading shared libraries: libgflags.so.2.2: cannot open shared object file: No such file or directory
请帮助我解决此问题
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)