CAUTION
This article was translated from Chinese by an AI model and may contain inaccuracies. If you find issues, please refer to the original or suggest corrections.
Determining "Portrait Shooting Style"
I used DINOv3 ViT (Visual Transformer) for image classification. One part of it — the test entry for "Portrait Shooting Style" — is available at the Photo Blog.
The first run takes a while, about 20–30s.


Concepts
DINOv3 is a family of versatile vision foundation models that outperform specialized state-of-the-art techniques across a wide range of settings without fine-tuning. DINOv3 produces high-quality dense features and excels at a variety of vision tasks, significantly outperforming previous self-supervised and weakly supervised foundation models.
| Model family | Typical specs | Parameter count reference |
|---|---|---|
| ViT series | ViT-S/16, ViT-B/16, ViT-L/16, ViT-7B/16, etc. | 21M ~ 6,716M |
| ConvNeXt series | Tiny, Small, Base, Large | 29M ~ 198M |
Some common usages listed officially:
The final approach for this project is to freeze all Backbone weights so they don't participate in updates, and train only a linear classifier. This is an analytical method for evaluating whether the model's internal representations can be linearly decoded — i.e., a linear probe (Linear Probe).
Backbone: the network that extracts features from images.
Workflow
Flowchart
Defining the problem
Portrait shooting styles include: selfie, taken by others.
The selected images all have a portrait as the main subject and an unambiguous shooting style. For the actual application side: 1. a conditional branch for the portrait subject needs to be added to the pipeline; 2. low-confidence results are abstained via a threshold.
Preparing data
Prerequisite for images: the subject is a portrait.
Images taken by others are mainly filtered from COCO 2017 person_keypoints.json; selfies mainly come from the Selfie Data Set.
Preparing data:
- Use DINOv3 to encode all images (CLS token); DINOv3 output contains three types of tokens, and their uses:
Token Meaning Used in this project CLS token Global semantic aggregation position (the "whole-image representation" for classification/retrieval) ✅ Used patch token Representation of each image patch (dense tasks: segmentation, depth, detection) ❌ Not used for the classification probe register token The "registers" newly added in DINOv3, which absorb global information and improve dense features; not involved in classification ❌ Not used as features - Use YOLO26 Pose to analyze the visible body parts in each image;
- Use YOLO26 Detect to detect the device used for taking the photo: phone, camera;
- Images finally selected into the training pipeline still need a round of manual label correction. Testing with large models to re-label showed that different prompt versions produce different error patterns, so in the end only manual correction works. Common error example: the following is a portrait of someone taking a selfie, but taken by others, and should be labeled "taken by others".

Example image
Image selection and allocation

- Method 1 (failed): Group by image source. This causes strong coupling between image source × shooting style, so the model learns the source style rather than the shooting style.
- All COCO images are hard-assigned "taken by others", all UCF images are hard-assigned "selfie".
- Method 2 (failed): Seed clustering + neighborhood retrieval. The manually defined cluster boundaries are extremely unstable.
- Label portrait images found via Pexels search, run K-Center clustering within each shooting style → style clusters. Stratified sampling by cluster to
val/test. - For each cluster, retrieve nearest neighbors from COCO/UCF candidate sources, assign in descending similarity order
val/test/train, inherit the cluster label, and correct manually.
- Label portrait images found via Pexels search, run K-Center clustering within each shooting style → style clusters. Stratified sampling by cluster to
- Method 3 (failed): Group by analytical features. Too fine-grained, insufficient samples, uneven groups.
- Grouping: shooting style × number of people × body parts × face orientation × device.
- Within each group, select images with K-Center-Greedy, assign
val/test/train.
Method 4: Portrait area ratio (mean) bucketing.
Bucket Range Meaning b0_40< 40% Long shot b40_7040–70% Medium shot b70_100≥ 70% Close-up Analysis approach
Perform diversity analysis on each image source to see how many images can represent the source's style.
The selected images go through a round of label correction.
After label correction, the image counts for the two shooting styles become imbalanced, so more images need to be added.
OOF internal evaluation
Data allocation: shooting style × bucket × allocation amount per image source
Avoid over-concentration; there is a cap on the proportion from each image source.
Hyperparameter C configuration. The sample size used for OOF is much larger than in the training pipeline, so differences in C can be distinguished.
C balanced macro 1.0 92.88 92.70 0.1 93.03 92.85 0.03 93.24 93.06 0.01 93.55 93.33 0.003 94.15 93.91 0.001 94.34 94.07 0.0003 93.40 93.18 Quota evaluation. The conf value is used on the application side, leaving low-confidence results blank.
Quota other/selfie acc balanced selfie macro Mean conf of error images Coverage acc@10% / 15% 400/400 95.37 94.34 93.19 94.22 0.590 98.16 / 98.68 max_all (2000/624) 96.37 94.49 92.37 94.30 0.631 99.01 / 99.27 max_1to1 (624/624) 96.35 94.26 91.90 94.20 0.605 98.91 / 99.18
Fix the training image set.
Training, evaluation, and deployment
Training: embeddings are read from the pre-encoding cache, then training starts (StandardScaler data standardization + LogisticRegression logistic regression + Cs hyperparameters).
Evaluation: evaluate on the fixed test image set. Multi-dimensional analysis is possible: error rate by shooting style / bucket / image source / confidence interval.
Deployment: deploy the .npz and .json (recording training config and base parameters, etc.) files to the application side; the application-side classification pipeline filters out low-confidence results.
"head": {
"type": "logistic_regression",
"C": 0.001,
"class_weight": "balanced",
"penalty": "l2",
"solver": "lbfgs",
"max_iter": 2000,
"l1_ratio": null,
"scaler": "standard",
"select_by": "val",
"select_scores": {
"0.001": 0.9166
},
Extended usage
- Similar image identification. In practice, all images are encoded first and cached, then merged for global retrieval on the frontend.

- Label video files using (burst) screenshots.
