首页 > 解决方案 > 在 google colab 上的 google drive 中的视频上使用 openpose

问题描述

我正在使用 openpose 来提取一些视频的骨架结构并在其上运行代码

google colab 以获得更好的硬件条件。

当我将视频从本地上传到 google colab 并使用 openpose 时,它​​运行良好。

我想使用谷歌驱动器观看更多视频,所以我将谷歌驱动器连接到 colab。

但是,当我为我的谷歌驱动器中的视频运行 openpose 时,即使我

除了视频的路径外,使用了完全相同的代码。

import subprocess

VideoPath = '/content/videos/'    #works perfectly as I expected
#VideoPath = '/content/gdrive/My Drive/videos/'   #does not work

if not os.path.exists("/content/output/"):
  os.mkdir("/content/output/")

for video in os.listdir(VideoPath):
  VideoName = video[:-4]

  InputVideo = VideoPath + video
  OutputDir = "/content/output2/output_" + VideoName + "/"

  if not os.path.exists("/content/output/output_" + VideoName):
    os.mkdir("/content/output/output_" + VideoName)

  pipe = subprocess.call("cd /content/openpose && /content/openpose/build/examples/openpose/openpose.bin --video " + InputVideo + " --write_json " + OutputDir + " --display 0 --render_pose 0 --face --hand", shell=True)

如何在我的谷歌驱动器中的视频上使用 openpose?

标签: pythongoogle-colaboratoryopenpose

解决方案


问题是路径名“/content/gdrive/My Drive/videos/”中的空格

更改为“/content/gdrive/My\ Drive/videos/”将起作用。


推荐阅读