Полный код моего блокнота Colab:
Код: Выделить всё
import torch
import torchvision
import os
from google.colab import drive
driveLoc = '/content/drive'
if os.path.exists(driveLoc):
print ("Drive already mounted")
else:
print ("Mounting drive")
drive.mount(driveLoc)
vpath = driveLoc + "/MyDrive/videos"
datafiles = os.listdir(vpath)
for f in datafiles:
if not os.path.isfile(vpath+"/"+f):
continue
print (f)
video = torchvision.io.VideoReader(vpath+"/"+f, "video")
print (video.get_metadata())
Код: Выделить всё
AttributeError Traceback (most recent call last)
in ()
19 print (f)
20
---> 21 video = torchvision.io.VideoReader(vpath+"/"+f, "video")
22 print (video.get_metadata())
23
/usr/local/lib/python3.10/dist-packages/torchvision/io/video_reader.py in __init__(self, src, stream, num_threads)
157
158 elif self.backend == "pyav":
--> 159 self.container = av.open(src, metadata_errors="ignore")
160 # TODO: load metadata
161 stream_type = stream.split(":")[0]
AttributeError: 'ImportError' object has no attribute 'open'
Подробнее здесь: https://stackoverflow.com/questions/786 ... ogle-colab