File size: 1,873 Bytes
b100a52
a6a3fe0
b100a52
a6a3fe0
 
b100a52
a6a3fe0
 
 
 
b100a52
a6a3fe0
abb7638
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f560a91
abb7638
 
 
 
 
 
 
 
 
 
f560a91
 
 
 
 
abb7638
 
 
 
 
 
 
 
ff2143a
 
 
 
 
 
abb7638
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
license: cc-by-nc-4.0
tags:
- computer-vision
- human-head
- humans
- landmarks
- pytorch
pipeline_tag: image-feature-extraction
library_name: pytorch
---

# DenseMarks

A PyTorch implementation for dense UVW coordinate prediction from human head images using DINOv3 backbone with DPT head architecture.

## Overview

DenseMarks predicts per-pixel positions in canonical space (cube [0, 1]³) from human head images.

**Input**: RGB images of size 512×512 pixels

**Output**: UVW coordinates tensor (B, 3, 512, 512) with values in [0, 1]

## Prerequisites

- Python 3.8+
- PyTorch 1.12+
- CUDA (optional, for GPU acceleration)

## Installation

1. **Clone the repository:**
   ```bash
   git clone https://github.com/diddone/densemarks.git
   cd densemarks
   ```

2. **Install DINOv3 submodule:**
   ```bash
   git clone https://github.com/facebookresearch/dinov3 third_party_dinov3
   ```

3. **Modify DINOv3 for compatibility:**
   ```bash
   # For Linux (GNU sed):
   sed -i '/dinov3\.hub\.segmentors/s/^/#/; /dinov3\.hub\.classifiers/s/^/#/; /dinov3\.hub\.detectors/s/^/#/; /dinov3\.hub\.dinotxt/s/^/#/; /dinov3\.hub\.depthers/s/^/#/' third_party_dinov3/hubconf.py

   # For macOS (BSD sed):
   sed -i '' '/dinov3\.hub\.segmentors/s/^/#/; /dinov3\.hub\.classifiers/s/^/#/; /dinov3\.hub\.detectors/s/^/#/; /dinov3\.hub\.dinotxt/s/^/#/; /dinov3\.hub\.depthers/s/^/#/' third_party_dinov3/hubconf.py
   ```

4. **Install dependencies:**
   ```bash
   pip install torch transformers numpy
   ```

5. **Download model weights from Hugging Face:**
   ```python3
   from dense_marks_model import DenseMarksModel, read_image
   from huggingface_hub import hf_hub_download
   model = DenseMarksModel(hf_hub_download("diddone/densemarks", "model.safetensors"))
   images = read_image("assets/00000.png") # rgb, 512x512
   uvw = model(images) # Predict UVW coordinates
   ```