python - 在 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?
解决方案
问题是路径名“/content/gdrive/My Drive/videos/”中的空格
更改为“/content/gdrive/My\ Drive/videos/”将起作用。
推荐阅读
- php - AWS弹性beantalk Nginx PHP会话丢失
- android - TFlite Android bytebuffer 创建用于推理
- python - While 循环只运行一次,即使它之前运行良好
- swift - SwiftUI 将 var 从 View 传递给类
- c# - ModelState 验证使用 Ajax 调用和 JQuery 不显眼
- terraform - Terraform:检查机密是否存在于 azure Vault 中
- javascript - 使用 CSS 和 JS 使通知向右淡出/消失
- sql-server - Seek 运算符中使用包含的列
- excel - 如何加快 excel VBA 用户表单中的搜索结果?
- javascript - Javascript - 创建对象以推入数组