# Display or save frame if needed # ...

# Process features as needed print(features.shape)

# Load a pre-trained model model = torchvision.models.resnet50(pretrained=True) model.eval() # Set to evaluation mode

# Move to GPU if available device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') tensor_frame = tensor_frame.to(device) model.to(device)

while True: ret, frame = video_capture.read() if not ret: break # Convert to RGB and apply transform rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) tensor_frame = transform(rgb_frame)