You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Access to the weights in thinking-friends/store-behavior-mvitv2-s is gated.

These weights are released by Thinking Friends under the thinkingfriends-nc
license for non-commercial and educational use only. Commercial use requires
a separate license from Thinking Friends (help@thinkingfriends.co.kr).

This repository distributes model weights only. It does not include the
original training videos, frames, or annotations. Training used the AI Hub
datasets 「실내(편의점, 매장) 구매행동 데이터」(dataSetSn=71549) and
「실내(편의점, 매장) 사람 이상행동 데이터」(dataSetSn=71550)
(https://www.aihub.or.kr). Redistribution of the original AI Hub data is
not allowed.

By requesting access you confirm that you have read LICENSE, that you will
use the weights only for non-commercial or educational purposes unless you
obtain a commercial license, and that you will not redistribute the original
training data.

Log in or Sign Up to review the conditions and access this model content.

TFVision Store Behaviour Classifier (MViTv2-S, 13 classes)

A convenience-store video action classifier from Thinking Friends (띵킹프렌즈). It assigns a short clip to one of 13 action classes. Return events are folded into purchase at inference time, because returns are rare in convenience stores.

Repository: thinking-friends/store-behavior-mvitv2-s

Access is gated. Request access with the form on the model page (name, affiliation, intended use, and a non-commercial agreement). A Korean model card is in README_ko.md.

The training datasets are not released and are not included in this repository.

License

thinkingfriends-nc (license: other). Use is limited to non-commercial and educational purposes. Commercial use requires a license from Thinking Friends.

Commercial licensing contact: help@thinkingfriends.co.kr

Company websites: thinkingfriends.co.kr, tftas.com

This license does not override upstream terms of the training data or the base model. AI Hub’s official FAQ states that AI models, services, and other derivative works trained on the data may be used, sold, or distributed for commercial or non-commercial purposes, with attribution (the official dataset name and aihub.or.kr). The official 71549 and 71550 dataset pages themselves do not spell out a commercial-use clause (71549 states that only Korean nationals may apply for the data). Limiting this repository to non-commercial use is a choice by Thinking Friends, and also reflects that those dataset-page terms were not independently reconfirmed for this release. Redistribution of the original data is not allowed. Official texts do not say whether placing weights on an overseas server counts as “export abroad” under the AI Hub usage policy. See LICENSE.

The backbone code is BSD-3-Clause and the Kinetics-400 starting weights are Apache-2.0 (via torchvision / PySlowFast). Kinetics-400 is compiled from YouTube videos; a legal review of that provenance is recommended before commercial use, even after a license from Thinking Friends.

Model summary

Item Detail
Architecture torchvision MViTv2-S (mvit_v2_s)
Base weights MViT_V2_S_Weights.KINETICS400_V1 (Kinetics-400). Code is BSD-3-Clause; the published starting weights originated from PySlowFast and are Apache-2.0.
Task Clip-level action classification. The head has 14 logits. Released behaviour is 13 classes (method a).
Input RGB video. 16 frames are sampled uniformly from the whole pre-trimmed clip (frame jump). Official training and test scores used a person-bounding-box crop when a box was available (train coverage 0.933), otherwise motion or letterbox, then 224×224. The example script uses short-side 224 + centre crop when no box is provided.
Normalisation Kinetics mean/std 0.45 / 0.225 (not ImageNet)
Released file best.pt from run mvit2s_k400_loso_syb_f16_v1, epoch 4. The file is a training checkpoint dict (model state_dict plus optimizer and run metadata). Parameter count 34,240,910.
MERL Not used. Training used AI Hub 71549 and 71550 only.

What is (and is not) in this repository

System logic: 13-class merge and frame-jump

The input is a pre-segmented short clip. There is no entrance model that splits close-up and mid-range views.

  1. Sixteen frames are taken from the first frame to the last, inclusive, at evenly spaced indices: np.linspace(0, n_frames - 1, 16), rounded to integers. E4_WINDOW_SEC was 0, so the window is the whole clip. The frame jump (stride) is (n_frames - 1) / 15.
  2. Official evaluation used a person-bounding-box crop when a box covered the clip, otherwise a motion box or a letterbox. For clips without boxes, inference.py resizes the short side to 224 px and takes a 224×224 centre crop.
  3. Each crop is normalised with mean 0.45 and standard deviation 0.225, then passed through MViTv2-S.
  4. Softmax is taken over the 14 training logits. Then p_purchase ← p_purchase + p_return, the return slot is dropped, and the predicted class is the argmax over the remaining 13 probabilities (method a).

Use the same sampling at inference as was used in training to match the figures in this card. Horizontal flipping is not used at inference.

The 13 classes

English identifiers follow the training label_map. Korean names follow the internal class map used in the training reports. The head is still 14-way; return_product (training index 4) is merged into purchase at inference and is not a released class.

Display id Training index English Korean Source
0 0 store_move 매장 이동 AI Hub 71549
1 1 select_product 상품 선택 AI Hub 71549
2 2 try_product 상품 체험 AI Hub 71549
3 3 purchase 구매 (includes former 반품) AI Hub 71549
4 5 compare_products 상품 비교 AI Hub 71549
5 6 fall_down 쓰러짐 AI Hub 71550
6 7 vandalism 기물 파손 AI Hub 71550
7 8 arson 방화 AI Hub 71550
8 9 smoking 흡연 AI Hub 71550
9 10 abandonment 물건 유기 AI Hub 71550
10 11 theft 절도 AI Hub 71550
11 12 assault 폭행 AI Hub 71550
12 13 mobility_impaired 이동 약자 AI Hub 71550

Training data size

The dataset files will not be released. Counts below are the clips used to train this run (LOSO, store SYB held out; MERL excluded). Source: e2_split_distribution.csv of mvit2s_k400_loso_syb_f16_v1.

Split Clips Composition
Train 52,053 AI Hub 71549 36,731 + AI Hub 71550 15,322
Validation 6,648 71549 4,678 + 71550 1,970
Test (in-distribution stores) 6,584 71549 4,660 + 71550 1,924
Held-out store SYB 5,685 71549 3,636 + 71550 2,049

Those counts are not the same as the official raw size of each public source dataset. The model was trained as 14 classes (train purchase 2,656 + return_product 2,327). The 13-class figures below are a re-score of the same epoch-4 checkpoint, with no extra training.

Fine-tuning scale

The development process is omitted; only the scale of the published run is given.

  • Base: torchvision MViTv2-S pre-trained on Kinetics-400, with a new 14-class head
  • Input: 16 frames per clip, 224×224, uniform temporal sampling over the whole clip
  • Run mvit2s_k400_loso_syb_f16_v1: 5 epochs, 20,000 clips per epoch, batch 16, seed 42, bf16, NVIDIA L4
  • Class-balanced sampling with square-root frequency weights (BALANCE=sqrt); purchase and return_product were up-weighted during training
  • The published weights are epoch 4 (best validation macro-F1; SYB was not used to select the epoch)

Training compute

Figures are taken from logs and from a metered Colab usage reading. Estimates and calculated values are labelled as such. The local A5000 was not used.

Item Value Basis
GPU NVIDIA L4 training log
Precision bf16 training log
Session wall clock (Asia/Seoul) 2026-12-02 18:45:36–22:05:39, 3.334 h [calculated] headless_prep.log (prep start to notebook exit)
Colab runtime (Asia/Seoul) 18:44:15–22:33:44, 3.8248 h launcher log (runtime_hours)
L4 rate 2.33 CU/h requester measurement (colab usage)
Compute units used 8.74 CU [measured] requester measurement, balance 97.66 → 88.92
Session CU 3.334 × 2.33 ≈ 7.77 CU [calculated] session hours × rate
Runtime CU 3.8248 × 2.33 ≈ 8.91 CU [calculated] runtime hours × rate

The 0.97 CU gap between the measured 8.74 and the session 7.77 is the remainder of the runtime (prep, evaluation, Drive sync), as described in the training report. A few early GPU memory-allocation warnings were logged at the start of training; the run finished all 6,250 steps.

Results (13-class merge a)

Recommended inference is method (a). Numbers are from a CPU re-score of the already dumped logits (CUDA_VISIBLE_DEVICES="", no retraining). Present-class macro-F1 averages only the classes that appear in that split. On SYB, store_move and mobility_impaired are absent (11 of 13 classes present).

Split n Accuracy Macro-F1 (13 / present) Purchase P / R / F1
Validation 6,648 0.9952 0.9928 / 0.9928 (13/13) 1.000 / 1.000 / 1.000 (support 629)
In-distribution test 6,584 0.9909 0.9852 / 0.9852 (13/13) 0.998 / 0.998 / 0.998 (support 540)
Held-out store SYB 5,685 0.9961 0.8410 / 0.9939 (11/13) 0.997 / 1.000 / 0.999 (support 1,783)

SYB has 22 errors in 5,685 clips. Purchase recall on SYB is 1,783 / 1,783. Remaining mistakes are mainly among abandonment, vandalism, theft, and 5 fall_down clips predicted as purchase.

Quantitative charts from the official SYB held-out store are below. They contain no training images.

13-class confusion matrix on the SYB held-out store

Per-class F1 on the SYB held-out store

For reference, the same checkpoint scored as a 14-class model (return kept separate) was: ID test accuracy 0.9900 / macro-F1 0.9845, SYB accuracy 0.8278 / present-class macro-F1 0.8932, with return F1 0.1865 on SYB. Those 14-class SYB figures are dominated by returns predicted as purchases, which is the distinction this 13-class release no longer makes. Do not compare the 13-class and 14-class scores as if they were the same task.

Examples

The stills and GIF below are real outputs of the multi-person pipeline (inference_multiperson.py) on public-domain clips. Coloured boxes are per-person tracks (#id label prob). White / magenta / cyan thick outlines are group boxes (G<id> label prob). A (G) after a person's label would mean the group rule overrode the individual label (it does not fire in these stills). They are not from the training data, which cannot be shown. No AI Hub or MERL frames are included.

Three multi-person stills: two people walking in a micro-market, a checkout pair with a group box, and an out-of-domain grappling pair

Animated checkout clip with per-person boxes and a group box

# File Clip What to look at Reviewer's reading
1 mp_ex1_souda_two_people.jpg Navy Exchange micro-market, two people walking Separate IDs, both store_move matches
2 mp_ex2_kadena_checkout_group.jpg and the GIF Kadena Commissary checkout White group box G1 around the cashier and shopper; each also has a person box group of two at the till is right; both labelled select_product (plausible). #4 mobility_impaired is a partial person at the frame edge — a known limit
3 mp_ex3_combatives_group.jpg U.S. Air Force combatives training, not store footage Magenta group box G2 and per-person assault scores labels match a close grapple, but this domain is far from the training cameras. Not a validation result

A whole-clip (no detector) baseline on the same Souda source, from inference.py, is still in ex1_souda_store_move.jpg (store_move 79.6%, matches). Identifiable faces in the example stills and GIF have been blurred.

These are selected examples, not a random sample, and they have no ground-truth multi-person labels. Average single-clip performance is in the tables and charts above. The classes were trained on fixed store-camera data (AI Hub CCTV-style footage). These clips are edited broadcast footage, so the domain differs from the official splits.

Sources of the frames (public domain, 17 U.S.C. §105; downloaded from Wikimedia Commons; attribution is not required but is given). Overlays are by Thinking Friends. The images do not imply endorsement by the U.S. Department of Defense or any service. Broadcast location graphics (for example “OKINAWA”) are in the source videos.

Individual frames, the GIF, and the whole-clip baseline panels are in thinking-friends/store-behavior-mvitv2-s-examples.

How to use

After you are granted access, download best.pt and the files in this repository. Do not point the script at original AI Hub clips for redistribution; use your own video.

import json, numpy as np, torch, torch.nn as nn
from pathlib import Path
from torchvision.models.video import mvit_v2_s
import decord

cfg = json.loads(Path("config.json").read_text())
id2label = {int(k): v for k, v in cfg["id2label"].items()}

class MViTForClips(nn.Module):
    def __init__(self):
        super().__init__()
        self.backbone = mvit_v2_s(weights=None)
        self.backbone.head[-1] = nn.Linear(self.backbone.head[-1].in_features, 14)
    def forward(self, x):                # x: (B, T, C, H, W)
        return self.backbone(x.permute(0, 2, 1, 3, 4))

ckpt = torch.load("best.pt", map_location="cpu", weights_only=True)
model = MViTForClips()
model.load_state_dict(ckpt["model"] if "model" in ckpt else ckpt)
model.eval()

vr = decord.VideoReader("clip.mp4")      # a short, pre-trimmed clip
idx = np.linspace(0, len(vr) - 1, 16).round().astype(int)
frames = vr.get_batch(idx).asnumpy()     # then short-side 224, centre crop, mean/std 0.45/0.225
# See inference.py for the exact crop and the 13-class merge (a).

python inference.py clip.mp4 --weights ./best.pt does the full preprocess, the 14-class softmax, and merge (a). A CPU is enough for a single clip. Do not use method (b) (argmax over the 13 non-return logits while discarding the return logit): purchase recall on the in-distribution val/test sets falls to 0.73 / 0.64.

Multi-person inference

inference.py scores one pre-trimmed clip as a single 13-class vector. inference_multiperson.py is for a longer video with several people. It does not change the released weights. It uses no AGPL components (no Ultralytics YOLO). After you are granted access:

python inference_multiperson.py clip.mp4 --weights best.pt --out outdir

Dependencies are listed in requirements-multiperson.txt. Official scores in the tables above were not produced by this pipeline; they used a person-box crop when a box was already in the evaluation set.

Detector, tracks, and per-person clips

  1. The video is decoded at 8 fps (configurable), max width 1,280. Shot cuts (HSV-histogram correlation below 0.55) reset the tracker; windows never span a cut.
  2. Detector: torchvision Faster R-CNN MobileNetV3-Large FPN, COCO person, score ≥ 0.2, box height ≥ 64 px (all configurable). --detector resnet50v2 is more accurate and about 5× slower. --det-every N runs the detector every N analysis frames and lets the tracker coast in between. Code and released weights are BSD-3-Clause (COCO annotations are CC BY 4.0; Flickr image licenses in COCO are mixed — have counsel confirm if you need a strict reading).
  3. Tracker: a ByteTrack-style implementation (Kalman filter, two-stage high/low-score IoU association, Hungarian matching, 3-hit confirmation, 2 s max lost). Own code, numpy + scipy only. The reference ByteTrack repository is MIT; the paper is arXiv:2110.06864. No appearance re-identification.
  4. Per-person clips: for each confirmed track, a 3 s window with 16 frames sampled uniformly (the same frame jump as inference.py), stride 1 s. Boxes are interpolated over short gaps, Gaussian-smoothed in time, padded 35 % per side, squared, and resized to 224×224. A track must be observed in at least 60 % of the window. The released model (13-class merge a, Kinetics mean/std 0.45 / 0.225) scores each window; probabilities are EMA-smoothed per ID (α = 0.5).

Close-people group view

People who stay close are also scored as a group. --no-groups turns this off and leaves per-person labels only.

  • Closeness: centre distance / mean box width, or 0 if the boxes overlap. Pairs whose heights differ by more than 2× are not treated as together (different depth).
  • Hysteresis (defaults): a pair links after staying closer than 1.25× mean width for 0.5 s, and unlinks only after going beyond 1.75× or a member missing for 1.0 s.
  • Groups are connected components of at least two linked people. IDs are stable across merge and split: the better-overlapping or older ID survives a merge; on a split the largest part keeps the ID.
  • Group clip: the union of member boxes, padded 15 %, same 3 s / 1 s windows and the same model.
  • Decision rule: the group label replaces a person's label only if it is one of theft, assault, vandalism, the group probability is at least 0.30, it beats the individual top probability by at least 0.10, and the labels differ. Members with no window of their own can receive a group_only label under the same checks. On the public-domain clips used to develop the rule, no individual label was changed (one short track received a group_only assault label). The group box is still drawn for explanation.

All of those thresholds are CLI flags (--g-k-enter, --g-k-exit, --g-min-on, --g-release, --g-size-ratio, --g-pad, --g-classes, --g-min-prob, --g-margin, and others listed in the script).

CPU throughput

Measured on an 8-thread CPU (shared, busy box; times are pessimistic):

Stage Cost
Detector MobileNetV3 FPN, 1280×720 230–300 ms/frame (up to 400 ms under load); ResNet-50 FPN v2 about 1,210 ms/frame
Tracker about 0.5 ms/frame
MViTv2-S, one window about 0.33 s (8 threads)
Group formation under 10 ms per clip (negligible)
Extra group windows about +18 % model time on the clips tested

Rough real-time budget at 8 fps analysis, stride 1 s, --det-every 4: one CPU can keep up with about 1–2 people; about 0.3× real time with 4 people. Offline use is fine (a 10 s clip with 2 people took about a minute). --det-every 2 already missed a person on one test clip, so the detector rate needs care on real CCTV. Once more than about 3 people are present, the classifier — not the detector — dominates. A GPU, a lighter Apache-2.0 detector (for example RT-DETR or YOLOX; not AGPL YOLO), or a 2 s stride would be needed for crowded real-time scenes.

Limits (multi-person)

These limits are in addition to the single-clip limitations below.

  • No ground-truth multi-person accuracy. Labels on the examples were judged by eye. Nothing here is a test-set number.
  • ID switches happen under occlusion, dissolves, zooms, and a lower detector rate. There is no appearance re-id.
  • Crowded scenes merge: five to eleven people at a table can become one large group box. A group-size cap is not implemented.
  • Queues and checkout pairs often form a group even when nothing interactive is happening. Because the override is limited to theft / assault / vandalism, this is mostly extra compute and clutter, not a swapped alert.
  • Small or far people (height still ≥ 64 px) can yield blurry crops and confident wrong labels (for example mobility_impaired on a background or cut-off person).
  • Interaction classes (theft, assault) need more than one person; a single-person crop sees only one party. The group crop is meant to help, but it has not been shown to correct a wrong individual label on a labelled set.
  • Military combatives / self-defence footage is far from the store-camera training domain. A high assault score on a grappling pair is encouraging as a demo, not a validation.

Limitations

  • Reported scores are on public / lab splits (including one held-out store), not a guarantee on a customer’s cameras or layout.
  • Training used fixed store-camera footage with person crops. Broadcast or handheld footage is a different domain.
  • store_move and mobility_impaired do not appear in the SYB hold-out, so SYB present-class macro-F1 does not cover them.
  • Residual errors concentrate on visually similar anomaly classes (abandonment, vandalism, theft) and a small number of fall_down → purchase cases.
  • The head was not retrained as a native 13-class model. A short head fine-tune is optional later; it was not required for the scores above.
  • The example clips are selected illustrations, not a random sample, and have no ground-truth multi-person labels.
  • Multi-person inference is a deployment pipeline around the same weights, not a retrained model. See the limits in Multi-person inference (ID switches, crowded-scene merges, no published multi-person accuracy).
  • Licensing: most training clips come from AI Hub 71549 and 71550. The FAQ allows commercial use, sale, and distribution of models trained on the data, and requires credit (the official dataset name and aihub.or.kr). The original data must not be redistributed. The dataset pages themselves do not spell out a commercial-use clause. Official texts do not say whether placing weights on an overseas server counts as “export abroad.” This repository is gated and limited to non-commercial use by Thinking Friends. Kinetics-400 starting weights are Apache-2.0, but the source videos are YouTube clips; a legal review of that provenance is recommended.

Attribution

Training used:

  • The AI Hub dataset 「실내(편의점, 매장) 구매행동 데이터」 (dataSetSn=71549; the design line on the same page is “(2-097-238-1) 실내(편의점, 매장) 사람 구매행동 데이터”), a project of the Ministry of Science and ICT and the National Information Society Agency (NIA). Rights in the dataset remain with the performing institutions and NIA. The original data is not redistributed with this model. Dataset page · AI Hub
  • The AI Hub dataset 「실내(편의점, 매장) 사람 이상행동 데이터」 (dataSetSn=71550; design line “(2-097-238-2) 실내(편의점, 매장) 사람 이상행동 데이터”). Dataset page
  • torchvision MViTv2-S (BSD-3-Clause), initialized from Kinetics-400 pre-trained weights (Apache-2.0 via PySlowFast / torchvision).

Disclaimer

This card and the accompanying LICENSE are not legal advice. The model is provided “as is.” See LICENSE for the full warranty disclaimer.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for thinking-friends/store-behavior-mvitv2-s