qinxunhui's picture
Update README.md
acebeda verified
|
Raw History Blame Contribute Delete
7.89 kB
---
license: cc-by-nc-4.0
pipeline_tag: image-classification
tags:
- ICDAR-2026-CircleID
- writer-identification
- open-set-recognition
- hand-drawn-circles
---
# DeepEllipse + AY — CircleID Open-Set Writer Identification
Official reproduction package for the paper:
> **DeepEllipse: Geometric–Time-Frequency Representation with Batch-Affinity Reasoning for Open-Set Writer Identification of Hand-Drawn Circles** (IEEE TIFS under review, ICDAR 2026 CircleID)
This package contains the released checkpoints of the paper's best system
(**DeepEllipse + AY**, Private ACC **67.9%**), the inference code
(`code/` + `reproduce_best_ay.py`) that regenerates the submission CSVs from the
released intermediates, and the submission CSVs themselves. No training code and
no third-party baseline implementations are included.
## Expected scores (Private / Public)
| Setting | Private ACC | Public ACC | Source |
|---------|------------:|-----------:|--------|
| **DeepEllipse + AY** (k=2, h=5, λ=0.5, r=65%) | **67.9%** | 62.15% | Main Table IV / Fig. 6–9 |
| DeepEllipse (Y-only, r=65%) | **54.1%** | — | Main Table IV |
| ResNet-18 RGB (k45, r=65%) | **48.7%** | — | Suppl. Table VIII |
All numbers are single-run readings on the Kaggle CircleID **Private** leaderboard.
## Two routes to `A` (`--ay-from`)
`reproduce_best_ay.py` offers two ways of obtaining the style-affinity adjacency
`A`, selectable with `--ay-from`:
| `--ay-from` | What it does | Requires | Label agreement with `reference_submission.csv` |
|---|---|---|---|
| `f_ellipse` *(default)* | runs the released affinity head over the released `f_ellipse` features | CPU only, no images | **100.0000%** (5,905 / 5,905) |
| `model` | re-derives `f_ellipse` from the raw test images using the frozen DeepEllipse backbone | CUDA GPU + test feature cache | **100.0000%** (5,905 / 5,905) |
## Files
| File | Size | Description |
|------|-----:|-------------|
| `deepellipse.pth` | 274 MB | DeepEllipse backbone.
| `resnet_rgb.pth` | 135 MB | ResNet-18 point-feature extractor used inside DeepEllipse, plus the standalone RGB baseline head (k45). |
| `bce_head.pth` | 7.9 MB | Style-affinity BCE head (pkmix, ep20) producing the adjacency `A`. |
| `deep_ellipse_logits.json` | 6.0 MB | Released `Y` logits for all 5,905 test images. |
| `resnet_test_logits.json` | 5.6 MB | Released ResNet-18 RGB test logits (k45) for the baseline CSV. |
| `f_ellipse_test_k45.npz` | 22.9 MB | Released `f_ellipse` features (input to the affinity head); enables the exact CPU-only route. |
| `class_names_45.json` | 406 B | The 45 LabelEncoder slots: `['-1', 'W01', ..., 'W51']`. |
| `reference_submission.csv` | 228 KB | Official submission used as the reproduction reference. |
| `deepellipse_y_only_r65_submit.csv` | 228 KB | Released submission: DeepEllipse Y-only (Private **54.1%**). |
| `sample_submission.csv` | 156 KB | Kaggle submission format template. |
| `test_with_pen.csv` | 508 KB | Test split manifest (image id → path / pen id), a copy of `data_split/test_with_pen.csv`. |
| `reproduce_best_ay.py` | 13 KB | Self-contained inference script (see below). |
| `code/` | — | Inference modules: model definition , feature pipeline, `ay_infer.py` (graph refinement + Top-K/r rejection), `ay_bce_head.py`, and `infer_helpers.py` (checkpoint-architecture resolution, loading and feature extraction). |
| `precompute_val_test.sh` | 1 KB | Rebuilds the test-side feature cache from raw images (only needed for `--ay-from model`). |
| `requirements.txt` | 300 B | Python dependencies. |
## Data
The **CircleID** competition data (scanned hand-drawn circle images) must be
downloaded from Kaggle:
```bash
kaggle competitions download -c icdar-2026-circleid-writer-identification
```
The default `--ay-from f_ellipse` route needs **no images and no cache** — every
input it consumes is in this folder. Only `--ay-from model` additionally needs:
- the test images (extracted into a dataset directory), and
- the **test-side feature cache** (no augmentation, one variant per image):
```bash
export CIRCLE_IMAGE_ROOT=/path/to/original_data/
FEA_CACHE_ROOT=/path/to/circle_id_fea_cache bash precompute_val_test.sh
```
## Reproduce the official submission
CPU-only, exact route (default):
```bash
python reproduce_best_ay.py --out ./outputs
```
Full pipeline from raw images (`--ay-from model` needs a CUDA GPU):
```bash
export CIRCLE_FEA_CACHE=/path/to/circle_id_fea_cache
export CIRCLE_IMAGE_ROOT=/path/to/original_data/
python reproduce_best_ay.py --ay-from model --test-csv test_with_pen.csv --out ./outputs
```
Recompute class logits `Y` with the frozen CE head (instead of the released JSON):
```bash
python reproduce_best_ay.py --ay-from model --y-from model --device cuda:0 --out ./outputs
```
CE-recomputed `Y` matches the released JSON to floating-point noise (argmax identical; Y-only
submit 100%).
### Advanced path (`--paper-679`)
This is an optional legacy reproduction route: the mainline result above already
reproduces the released labels, and the section below documents the
alternate forward used in an earlier version of the pipeline.
```bash
python reproduce_best_ay.py --paper-679 --device cuda:0 --out ./outputs_paper679
```
Result on the test split: `best_ay_k2_h5_a05_r65_submit.csv` reproduces the
released reference labels exactly (0 differing labels), and `Y` recomputed by
the CE head is within ~25 labels of the released JSON on the Y-only submit —
the graph diffusion in AY absorbs those into the same AY labels.
All defaults point at files in this folder, so no other flags are required.
The script:
1. Loads the released checkpoints and the released `Y` logits.
2. Builds the adjacency `A = sigmoid(eta * a~)` with
`a~ = 2*((u+1)/2)^3 - 1` from the L2-normalized embeddings `u`, then applies
`A' = max(0, A - 0.5)` (diagonal kept), `A_norm = row-normalize (A')^2`, and
`Y* = A_norm^5 · Y` (k = 2, h = 5, λ = 0.5).
At λ = 0.5 this shift is exactly a cosine threshold: `A > 0.5 ⇔ u > 2^(2/3) - 1
= 0.587401`, which the script re-checks against the released `eta` on every run.
3. Applies Top-K/r rejection (`r = 65%`, logit score) and writes three CSVs:
| Output | Description | Expected Private |
|--------|-------------|-----------------:|
| `best_ay_k2_h5_a05_r65_submit.csv` | DeepEllipse + AY (main result) | **67.9%** |
| `deepellipse_y_only_r65_submit.csv` | DeepEllipse Y-only | **54.1%** |
| `resnet_rgb_k45_r65_submit.csv` | ResNet-18 RGB k45 baseline | **48.7%** |
4. Verifies `best_ay_k2_h5_a05_r65_submit.csv` against `reference_submission.csv`
(hard gate, ≥ 99.8% agreement; both routes match exactly in this release).
## Submit to Kaggle
https://www.kaggle.com/competitions/icdar-2026-circleid-writer-identification/overview
## Package layout
The package is self-contained:
* The top-level artifacts: the three checkpoints, the released `Y` logits, the released
`f_ellipse` features, the class-name list, the test manifest, the reference and sample
submissions, `reproduce_best_ay.py`, `precompute_val_test.sh`, `requirements.txt`,
the `LICENSE` and this README.
* `code/` -- 23 Python modules plus `test_color_sta.json`; every module is a transitive
dependency of `reproduce_best_ay.py` (checked by import-graph reachability).
* `outputs/` -- the default `--out` target; its AY submit matches
`reference_submission.csv` exactly (0 / 5905 differing labels).
## Citation
```bibtex
@article{deepellipse,
author = {Qin, Xunhui and others},
title = {DeepEllipse: Geometric--Time-Frequency Representation with Batch-Affinity
Reasoning for Open-Set Writer Identification of Hand-Drawn Circles},
journal = {IEEE Transactions on Information Forensics and Security},
year = {2026},
note = {under review}
}
```
## License
This package is released under **CC BY-NC 4.0** for research use.