0

我正在使用 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?

4

1 回答 1

0

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

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

于 2020-05-07T07:24:50.030 回答