Views
No views yet
pip install torch transformers einops pycocoevalcap opencv-python numpy1from models.matchvoice_model import matchvoice_model
2from matchvoice_dataset import MatchVoice_Dataset
3import torch
4
5# Load model
6model = matchvoice_model(
7 llm_ckpt="meta-llama/Meta-Llama-3-8B-Instruct",
8 tokenizer_ckpt="meta-llama/Meta-Llama-3-8B-Instruct",
9 num_video_query_token=32,
10 num_features=512,
11 device="cuda:0",
12 inference=True
13)
14
15# Load checkpoint
16checkpoint = torch.load("model_save_best_val_CIDEr.pth", map_location="cpu")
17model.load_state_dict(checkpoint)
18model.eval()
19
20# Perform inference (requires prepared video features)
21with torch.no_grad():
22 predictions = model(samples)inference1.py script:1python inference1.py \
2 --feature_root ./features \
3 --ann_root ./dataset/MatchTime/train \
4 --model_ckpt model_save_best_val_CIDEr.pth \
5 --window 15 \
6 --batch_size 4 \
7 --num_video_query_token 32 \
8 --num_features 512 \
9 --csv_output_path ./inference_result/predictions.csv[batch_size, time_length, feature_dim]league: League and season informationgame: Game namehalf: First/second halftimestamp: Event timestamptype: Soccer event typeanonymized: Ground truth annotationpredicted_res_{i}: Model prediction results