File size: 5,256 Bytes
f66a12f | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | ---
language:
- en
task_categories:
- keypoint-detection
size_categories:
- 100K<n<1M
tags:
- coco
- ap-10k
- pose-estimation
- tsv
---
# COCO-Keypoints and AP-10K training TSVs
COCO 2017 person-keypoint training annotations with **no COCO image bytes**,
plus AP-10K split-1 training data with embedded original images.
This derived export contains training splits only.
| Directory | Image / TSV rows | Positive-view images | Instances | Image delivery |
| --- | ---: | ---: | ---: | --- |
| `coco` | 118,287 | 56,599 | 262,465 | Download on demand |
| `ap10k` | 7,023 | 7,023 | 9,122 | Embedded in TSV |
## COCO: annotations and on-demand images
`coco/train.annotations.tsv` contains `image_id<TAB>annotation_JSON`.
Both `.lineidx` files contain annotation byte offsets, not row numbers.
This is the `coco-keypoints-external-images-v1` schema, distinct from the
embedded-image Rex envelope used by AP-10K.
Each row contains `image` (ID, filename, dimensions, license ID and original-byte
SHA-256) and `annotations` (instance/image/category IDs, original pixel-**xywh**
box, area, crowd flag, labeled-joint count and all 17 `[x,y,v]` keypoint triples).
Segmentation and unrelated image provenance fields are omitted. `metadata.json`
retains source information, license tables, joint names and skeletons.
Coordinates and visibility are unchanged: v=0 unlabeled, v=1 labeled/occluded,
v=2 visible. No image bytes or full segmentation annotation archive are included.
Install Pillow from `requirements.txt` and `huggingface_hub` for downloading.
```python
from huggingface_hub import snapshot_download
import sys
root = snapshot_download(
repo_id="huuthientran/KeypointEstimation", repo_type="dataset",
allow_patterns=["coco/*", "coco_download.py", "requirements.txt"],
)
sys.path.insert(0, root)
from coco_download import CocoKeypointsDataset
train = CocoKeypointsDataset(f"{root}/coco", images="./coco-images", positive_only=True)
annotation = train.annotation(0) # no network access
sample = train[0] # fetches missing image; returns PIL RGB + annotation
```
Missing images are fetched from `https://s3.amazonaws.com/images.cocodataset.org/train2017/` and
stored as `coco-images/train2017/000000000000.jpg`. The loader checks SHA-256 and
raster dimensions, writes downloads atomically, and reuses valid existing files.
It preserves the stored orientation without EXIF transpose. Network errors or
invalid cached files raise an error rather than silently dropping a sample.
An existing COCO installation can be used by setting `images` to the directory
containing `train2017`. For bulk preparation:
```bash
python coco_download.py --images ./coco-images --positive-only --workers 8
```
Omit `--positive-only` to fetch all train images. `--limit 3` provides a smoke run.
The positive view selects images with a non-crowd, labeled, positive-size pose
box. All original instances within selected images remain; apply instance
eligibility in the training adapter. Empty-pose rows remain in the complete
annotation index but incur no image download unless requested.
## AP-10K: embedded original images
```python
# Download ap10k/* and loader.py from the same repository first.
from loader import RawTSVDataset
animals = RawTSVDataset(f"{root}/ap10k")
sample = animals.decode(animals[0])
```
AP-10K uses `rex-tsv-keypoints-v1`: image rows contain
`image_byte_offset<TAB>base64_original_image_bytes`; annotation rows contain
`image_byte_offset<TAB>annotation_JSON`. Indexes are byte positions. Derived
`boxes[].bbox` is pixel-**xyxy**; complete original pixel-xywh annotations,
keypoints, visibility, crowd and area fields remain in `source_annotations`.
Original image metadata, categories, joint names, skeletons and complete original
annotations are included. Image bytes are unchanged.
These pose schemas require a model-specific pose adapter. They are not generic
box-grounding training targets. No clipping, normalization, quantization,
deduplication, or evaluation-overlap cleanup is applied. Humans and animals have
different joint definitions. AP-10K's `ready_for_training: false` indicates that
model formatting and selection policy are separate work.
## Validation and provenance
Every COCO TSV row, index, selected field and positive-view entry was compared
with original training annotations. Image hashes come from the original-byte
inventory validated with full local raster decoding; COCO images are excluded
from this release. AP-10K passed all-image raster decoding, checksums, offsets,
source annotation mapping, instance coverage and positive-index validation.
Per-dataset manifests and validation reports are included. To check the release:
```bash
sha256sum --check SHA256SUMS
```
`SHA256SUMS` covers all release files except itself. Source checksums remain in
manifests. AP-10K's original local build paths are provenance, not loader
requirements. Pin a Hub revision when downloading for reproducibility.
Original datasets: [COCO](https://cocodataset.org/) and
[AP-10K](https://github.com/AlexTheBad/AP-10K). This packaging adds no new license
to original images or annotations. Follow the original dataset terms and image
licenses. COCO license tables and per-image identifiers are retained.
|