import cv2
from transformers import AutoModel
from modeling_internvideo2 import (retrieve_text, vid2tensor, _frame_from_video,)
if __name__ == '__main__':
model = AutoModel.from_pretrained("OpenGVLab/InternVideo2-Stage2_6B", trust_remote_code=True).eval()
video = cv2.VideoCapture('example1.mp4')
frames = [x for x in _frame_from_video(video)]
text_candidates = ["A playful dog and its owner wrestle in the snowy yard, chasing each other with joyous abandon.",
"A man in a gray coat walks through the snowy landscape, pulling a sleigh loaded with toys.",
"A person dressed in a blue jacket shovels the snow-covered pavement outside their house.",
"A cat excitedly runs through the yard, chasing a rabbit.",
"A person bundled up in a blanket walks through the snowy landscape, enjoying the serene winter scenery."]
texts, probs = retrieve_text(frames, text_candidates, model=model, topk=5)
for t, p inzip(texts, probs):
print(f'text: {t} ~ prob: {p:.4f}')
vidtensor = vid2tensor('example1.mp4', fnum=4)
feat = model.get_vid_feat(vidtensor)
Runs of OpenGVLab InternVideo2-Stage2_6B on huggingface.co
744
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
6
30-day runs
More Information About InternVideo2-Stage2_6B huggingface.co Model
InternVideo2-Stage2_6B huggingface.co is an AI model on huggingface.co that provides InternVideo2-Stage2_6B's model effect (), which can be used instantly with this OpenGVLab InternVideo2-Stage2_6B model. huggingface.co supports a free trial of the InternVideo2-Stage2_6B model, and also provides paid use of the InternVideo2-Stage2_6B. Support call InternVideo2-Stage2_6B model through api, including Node.js, Python, http.
InternVideo2-Stage2_6B huggingface.co is an online trial and call api platform, which integrates InternVideo2-Stage2_6B's modeling effects, including api services, and provides a free online trial of InternVideo2-Stage2_6B, you can try InternVideo2-Stage2_6B online for free by clicking the link below.
OpenGVLab InternVideo2-Stage2_6B online free url in huggingface.co:
InternVideo2-Stage2_6B is an open source model from GitHub that offers a free installation service, and any user can find InternVideo2-Stage2_6B on GitHub to install. At the same time, huggingface.co provides the effect of InternVideo2-Stage2_6B install, users can directly use InternVideo2-Stage2_6B installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
InternVideo2-Stage2_6B install url in huggingface.co: