Views
No views yet
google/mobilenet_v2_1.0_224
pip install torch torchvision opencv-python1from action_model import load_action_model, preprocess_frames, predict_action
2import cv2
3
4# Load model
5model = load_action_model(model_path="best_model.pt", device="cpu", num_classes=5)
6
7# Read frames from video
8cap = cv2.VideoCapture("path_to_video.mp4")
9frames = []
10while True:
11 ret, frame = cap.read()
12 if not ret:
13 break
14 frames.append(frame)
15cap.release()
16
17# Preprocess frames for model input
18clip_tensor = preprocess_frames(frames[:16], seq_len=16, resize=(112,112))
19
20# Predict action
21result = predict_action(model, clip_tensor, device="cpu")
22print(result)action · cnn-gru · video-classification · ucf101 · mobilenetv2 · deep-learning · torch