Dataset Viewer
Auto-converted to Parquet Duplicate
id
string
image
image
v1
int32
v2
int32
v3
int32
v4
int32
v5
int32
v6
int32
v7
int32
03
1
1
1
1
0
0
0
04
2
1
1
1
1
0
0
06
3
0
2
1
1
0
0
07
4
2
0
0
1
1
1
08
5
1
4
4
1
0
1
09
6
0
3
2
2
0
0
10
7
0
1
1
0
0
0
11
8
0
2
1
1
1
1
12
9
2
0
0
2
0
2
14
10
4
3
4
0
1
1
18
11
1
3
1
0
1
0
20
12
3
4
4
0
0
2
22
13
1
4
3
2
0
1
23
14
3
3
4
3
1
1
24
15
0
2
1
1
0
0
25
16
1
1
0
1
0
1
27
17
0
6
4
1
1
2
29
18
1
2
1
3
1
0
32
19
0
2
2
2
0
0
39
20
0
6
2
0
0
0
40
21
1
3
2
1
1
1
000096
1
1
1
1
0
0
0
000104
1
1
1
1
0
0
0
000112
1
1
1
1
0
0
0
000120
1
1
1
1
0
0
0
000216
2
1
1
1
1
0
0
000224
2
1
1
1
1
0
0
000232
2
1
1
1
1
0
0
000240
2
1
1
1
1
0
0
000343
3
0
2
1
1
0
0
000351
3
0
2
1
1
0
0
000632
4
2
0
0
1
1
1
000640
4
2
0
0
1
1
1
000648
4
2
0
0
1
1
1
000664
5
1
4
4
1
0
1
000665
5
1
4
4
1
0
1
000672
5
1
4
4
1
0
1
000698
5
1
4
4
1
0
1
001040
6
0
3
2
2
0
0
001048
6
0
3
2
2
0
0
001056
6
0
3
2
2
0
0
001064
6
0
3
2
2
0
0
001725
7
0
1
1
0
0
0
001729
7
0
1
1
0
0
0
001740
7
0
1
1
0
0
0
001765
8
0
2
1
1
1
1
001773
8
0
2
1
1
1
1
001781
8
0
2
1
1
1
1
002054
9
2
0
0
2
0
2
002062
9
2
0
0
2
0
2
002230
10
4
3
4
0
1
1
002238
10
4
3
4
0
1
1
002246
10
4
3
4
0
1
1
002254
10
4
3
4
0
1
1
002615
0
3
2
1
0
0
0
002616
0
3
2
1
0
0
0
002657
22
0
3
1
1
0
0
002665
22
0
3
1
1
0
0
002673
22
0
3
1
1
0
0
002696
22
0
3
1
1
0
0
002810
11
1
3
1
0
1
0
002818
11
1
3
1
0
1
0
002826
11
1
3
1
0
1
0
002834
11
1
3
1
0
1
0
002963
0
1
1
0
1
0
1
002964
0
1
1
0
1
0
1
002965
0
1
1
0
1
0
1
002966
0
1
1
0
1
0
1
002967
0
1
1
0
1
0
1
002968
0
1
1
0
1
0
1
002969
0
1
1
0
1
0
1
002974
12
3
4
4
0
0
2
002982
12
3
4
4
0
0
2
002990
12
3
4
4
0
0
2
002998
12
3
4
4
0
0
2
003476
0
1
3
3
2
0
0
003481
0
1
3
3
2
0
0
003484
0
1
3
3
2
0
0
003508
13
1
4
3
2
0
1
003516
13
1
4
3
2
0
1
003524
13
1
4
3
2
0
1
003532
13
1
4
3
2
0
1
003540
13
1
4
3
2
0
1
004038
14
3
3
4
3
1
1
004054
14
3
3
4
3
1
1
004070
14
3
3
4
3
1
1
004340
16
1
1
0
1
0
1
004348
16
1
1
0
1
0
1
004356
16
1
1
0
1
0
1
004567
0
0
2
1
0
0
1
004579
17
0
6
4
1
1
2
004587
17
0
6
4
1
1
2
004603
17
0
6
4
1
1
2
004644
17
0
6
4
1
1
2
005082
0
2
4
3
0
0
2
005291
18
1
2
1
3
1
0
005299
18
1
2
1
3
1
0
005307
18
1
2
1
3
1
0
005315
18
1
2
1
3
1
0
006343
0
2
2
3
1
1
1
End of preview. Expand in Data Studio

Brush Calligraphy Stroke Segmentation Dataset (BCSS) πŸ–ŒοΈ

GitHub Paper License: MIT

This dataset card mirrors and is cross-linked with the project's GitHub repository: github.com/Rvosuke/BCSS.

Introduction

The Brush Calligraphy Stroke Segmentation Dataset (BCSS) is a resource for the task of Chinese brush-calligraphy stroke segmentation. It is derived from the Evaluated Chinese Calligraphy Copies (E3C) dataset β€” an aesthetic-evaluation dataset for Chinese brush calligraphy β€” and augmented with additional images from diverse sources to enhance diversity and support the evaluation of model generalization.

Each character image is paired with a set of per-stroke binary masks, enabling multi-label stroke segmentation where intersecting strokes can overlap. A per-character prior-knowledge vector (stroke-count metadata) is also provided.

What's in this HuggingFace copy

The full BCSS dataset described in the paper contains 1,322 images and 10,653 annotated strokes. This HuggingFace release packages the segmentation-ready split that ships with the reference implementation:

Subset Images Notes
Training + Validation 1,082 Each image has 6 per-stroke masks + a prior-knowledge vector row
External Testing 130 Held-out generalization images (input images only)
Total 1,212 Segmentation-ready subset

Note on counts: The paper reports 1,322 images (1,022 train/val + 300 external test) and 10,653 strokes over the complete collection. This packaged, segmentation-ready subset contains 1,082 train/val images and 130 external-test images. Some raw/reference material (raw instances and label source files) is hosted on the GitHub repository under instances/ and labels/.

All images are 400 Γ— 400 PNGs.

Repository Layout

To keep the repo efficient (thousands of small PNGs are packed into a few archives), the image/mask files are shipped as ZIP archives, while metadata is left as plain browsable files:

.
β”œβ”€β”€ README.md                     # This dataset card
β”œβ”€β”€ LICENSE                       # MIT License
β”œβ”€β”€ train_val_images.zip          # images/<id>.png            (1,082 files, 400x400)
β”œβ”€β”€ train_val_masks.zip           # masks/<id>/{1..6}.png       (1,082 folders x 6 masks)
β”œβ”€β”€ train_val_info.csv            # prior-knowledge vector, 1 row per train/val image
β”œβ”€β”€ external_test_images.zip      # images/<id>.png            (130 files)
β”œβ”€β”€ external_test_info.csv        # prior-knowledge vector for external test
└── splits/
    β”œβ”€β”€ train.txt                 # 944 ids
    β”œβ”€β”€ val.txt                   # 98 ids
    β”œβ”€β”€ test.txt                  # 40 ids (internal held-out)
    └── train_test.txt            # 10 ids (small smoke-test subset)

After extraction, each archive expands to an images/ or masks/ directory:

train_val_images.zip   ->  images/<id>.png
train_val_masks.zip    ->  masks/<id>/1.png ... 6.png
external_test_images.zip -> images/<id>.png

Image ↔ mask correspondence

  • An image images/<id>.png (from train_val_images.zip) corresponds to the mask folder masks/<id>/ (from train_val_masks.zip).
  • Each mask folder holds 6 binary PNGs (1.png … 6.png), one per stroke class. During training these are thresholded (> 150 β†’ 1) and stacked into a multi-channel label tensor, so overlapping/intersecting strokes are preserved as independent channels rather than a single argmax label map.
  • IDs, images, and masks are 1:1 aligned β€” every one of the 1,082 images has both an image file and a 6-mask folder (verified: 0 orphans on either side).

*_info.csv β€” prior-knowledge vector

Each info.csv has one row per image, comma-separated, no header:

<id>,v1,v2,v3,v4,v5,v6,v7
  • id β€” image identifier (matches images/<id>.png and masks/<id>/).
  • v1…v7 β€” integer prior-knowledge / stroke-statistic values used by the model as a Prior Knowledge Vector to guide segmentation. Observed value ranges in this release: v1 ∈ [0,26], v2 ∈ [0,4], v3 ∈ [0,10], v4 ∈ [0,6], v5 ∈ [0,5], v6 ∈ [0,1], v7 ∈ [0,3]. external_test_info.csv follows the same format.

Splits

The splits/*.txt files list image IDs (one per line) for reproducing the reference train/val/test partition used in the Stroke-Seg paper:

  • train.txt β€” 944 ids
  • val.txt β€” 98 ids
  • test.txt β€” 40 ids (internal held-out)
  • train_test.txt β€” 10 ids (small smoke-test subset)

The external-test subset is a separate generalization benchmark (different character styles / handwriting) and is not covered by these split files.

Usage

Download and extract the archives, then load images + multi-label masks with Pillow/NumPy:

import os, csv, zipfile, numpy as np
from PIL import Image
from huggingface_hub import hf_hub_download

REPO = "Rvosuke/BCSS"

def fetch_and_extract(filename, dest="."):
    path = hf_hub_download(REPO, filename, repo_type="dataset")
    with zipfile.ZipFile(path) as z:
        z.extractall(dest)

# download archives once
fetch_and_extract("train_val_images.zip")   # -> ./images/<id>.png
fetch_and_extract("train_val_masks.zip")    # -> ./masks/<id>/{1..6}.png
info_path = hf_hub_download(REPO, "train_val_info.csv", repo_type="dataset")
split_path = hf_hub_download(REPO, "splits/train.txt", repo_type="dataset")

# read prior-knowledge vectors
info = {}
with open(info_path, errors="ignore") as f:
    for row in csv.reader(f):
        info[row[0]] = list(map(int, row[1:]))

def load_sample(img_id, size=(400, 400)):
    img = np.array(Image.open(f"images/{img_id}.png").convert("RGB").resize(size))
    mask_dir = f"masks/{img_id}"
    channels = []
    for fn in sorted(os.listdir(mask_dir)):                 # 1.png .. 6.png
        m = Image.open(os.path.join(mask_dir, fn)).convert("L").resize(size)
        channels.append((np.array(m) > 150).astype(np.uint8))
    label = np.stack(channels, axis=0)                      # (6, H, W) multi-label
    return img, label, info[img_id]

ids = [l.strip() for l in open(split_path) if l.strip()]
img, label, prior = load_sample(ids[0])
print(img.shape, label.shape, prior)   # (400,400,3) (6,400,400) [...]

Applications

BCSS can be used to train and evaluate models for brush-calligraphy stroke segmentation. It offers a rich variety of Chinese character styles and a dedicated external test set for measuring generalization across writing styles. The reference framework, Stroke-Seg, is built on DeepLab v3 and introduces a Prior Knowledge Vector, a multi-label output strategy for intersecting strokes, and a boundary-aware loss (BDLoss).

Data Sources & Composition (per paper)

  • Training/Validation (1,022 in paper): images from the E3C dataset.
  • External Testing (300 in paper):
    • 90 E3C images with character types unseen in train/val;
    • 113 handwritten images from the CCSE-W dataset;
    • 97 images of various Chinese character styles (regular printed and brush calligraphy forms, e.g. Clerical Script).

License

Released under the MIT License for research purposes. See LICENSE.

Citation

If you use this dataset, code, or methods, please cite:

@article{gong2024stroke,
  title={Stroke-Seg: A Deep Learning-Based Framework for Chinese Stroke Segmentation},
  author={Gong, Xinyu and Bai, Zeyang and Nie, Haitao and Xie, Bin},
  journal={IET Image Processing},
  volume={18},
  number={13},
  pages={4341--4355},
  year={2024},
  publisher={Wiley Online Library},
  doi={10.1049/ipr2.13255}
}

References

  1. Sun, M., et al. (2023). SRAFE: Siamese Regression Aesthetic Fusion Evaluation for Chinese Calligraphic Copy. CAAI Transactions on Intelligent Technology, 8(3), 1077–1086.
  2. Liu, L., Lin, K., Huang, S., Li, Z., Li, C., Cao, Y., & Zhou, Q. (2022). Instance Segmentation for Chinese Character Stroke Extraction: Datasets and Benchmarks. arXiv:2210.13826.
  3. Long, J., Shelhamer, E., & Darrell, T. (2015). Fully Convolutional Networks for Semantic Segmentation. CVPR, 3431–3440.
  4. Chen, L. C., Papandreou, G., Schroff, F., & Adam, H. (2017). Rethinking Atrous Convolution for Semantic Image Segmentation. arXiv:1706.05587.

Contact

For inquiries about the dataset, please contact:


Related resources β€” Dataset: github.com/Rvosuke/BCSS Β· Paper: IET Image Processing

Downloads last month
27

Papers for Rvosuke/BCSS