Downloads · 30 days
11
1% of all-time downloads
KhoiBui/tiktok-video-safety-classifier
tiktok-video-safety-classifier is a video classification model from KhoiBui. Use it for the video classification task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This model classifies TikTok video frames as safe or harmful.
Downloads · 30 days
11
1% of all-time downloads
All-time downloads
1.3K
Public
Parameters
86.2M
345 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors345 MB · 100%
From the Hugging Face model README
This model classifies TikTok video frames as safe or harmful.
from transformers import AutoImageProcessor, VideoMAEForVideoClassification
from decord import VideoReader, cpu
import numpy as np
processor = AutoImageProcessor.from_pretrained("KhoiBui/tiktok-video-safety-classifier")
model = VideoMAEForVideoClassification.from_pretrained("KhoiBui/tiktok-video-safety-classifier")
# Load video and sample 16 frames
vr = VideoReader("video.mp4", ctx=cpu(0))
indices = np.linspace(0, len(vr) - 1, 16).astype(int)
frames = list(vr.get_batch(indices).asnumpy())
inputs = processor(frames, return_tensors="pt")
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item() # 0=safe, 1=harmful