页面简介
A deep learning library for video understanding research
正文摘录
A deep learning library for video understanding researchGet StartedTutorialsGitHubBased on PyTorch Built using PyTorch. Makes it easy to use all the PyTorch-ecosystem components. Reproducible Model Zoo Variety of state of the art pretrained video models and their associated benchmarks that are ready to use. Efficient Video Components Video-focused fast and efficient components that are easy to use. Supports accelerated inference on hardware. Get StartedInstall pytorchvideo (Confirm requirements following the instructions here)pip install pytorchvideo Try Video classification with Model Zoo (For detailed instructions, refer to the PyTorchVideo Model Zoo Inference Tutorial# Import all the required components ... # Load pre-trained model model = torch.hub.load('facebookresearch/pytorchvideo', 'slow_r50', pretrained=True) # Load video video = EncodedVideo.from_path('some_video.avi') # Compose video data transforms transform = ApplyTransformToKey( key="video", transform=Compose( [ UniformTemporalSubsample(num_frames), Lambda(lambda x: x/255.0), NormalizeVideo(mean, std), ShortSideScale( size=side_size ), CenterCropVideo(crop_size=(crop_size, crop_size)) ] ), ) # Get clip clip_start_sec = 0.0 # secs clip_duration = 2.0 # secs video_data = video.get_clip(start_sec=clip_start_sec, end_sec=clip_start_sec + clip_duration) video_data = transform(video_data) # Generate top 5 predictions preds = torch.nn.functional.softmax(preds) pred_class_ids = preds.topk(k=5).indices