aintropy-ai/video-mme-sample10
Viewer • Updated • 270 • 2.38k • 2
How to use Charansaiponnada/video-query-router with Scikit-learn:
from huggingface_hub import hf_hub_download
import joblib
model = joblib.load(
hf_hub_download("Charansaiponnada/video-query-router", "sklearn_model.joblib")
)
# only load pickle files from sources you trust
# read more about it here https://skops.readthedocs.io/en/stable/persistence.htmlReads a question about a video library and says where to search: the whole video, a clip, or a single frame. Small (0.43 MB), fast (about 2 ms per query on a CPU), no GPU.
| Type | Needs | Example |
|---|---|---|
| video | the full video: topic, summary, "which is NOT shown", order of many events | What is the main idea of the video? |
| clip | a few seconds to minutes: an action, an event, something said | What does the man do after swimming? |
| frame | one picture: colour, clothes, on-screen text, a score | What colour is the news presenter's coat? |
Model: logistic regression (scikit-learn) on words and word pairs, letter chunks, and 7 hand-made cue flags. If confidence is below 0.8, the router also searches the second most likely index.
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("Charansaiponnada/video-query-router", local_dir="video-query-router")
sys.path.insert(0, path) # the pickle needs the small intent_router package stored next to it
from intent_router.router import Router
router = Router(f"{path}/model.joblib")
print(router.route(["what colour is the car at 2:15?"]))
# [{'query': ..., 'type': 'frame', 'confidence': ..., 'search': ['frame_index']}]
Needs scikit-learn and joblib; trained with scikit-learn 1.7. model.joblib is a pickle: only load it from a source you trust.
| Model | Accuracy [95% range] | Right index searched | p50 ms | Size |
|---|---|---|---|---|
| Keyword rules only | 66.7% [61.1, 71.9] | 66.7% | 0.06 | ~0 |
| This model | 70.0% [64.8, 75.6] | 83.0% | 1.9 | 0.43 MB |
| MiniLM sentence encoder + cue flags | 72.6% [67.8, 77.8] | 84.1% | 13.7 | 91 MB |
Training data: the 270 Video-MME questions (labeled by hand with one written rule) and 120 hand-written search-style queries. Limits: one labeler, small data, English only.