Datasets:
Vishva R commited on
Update README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263---language:- enlicense: othertask_categories:- visual-question-answering- image-text-to-texttags:- signature-detection- visual-grounding- document-ai- vqa- sft- qwen3.5pretty_name: Signature Detection SFTsize_categories:- 10K<n<100K---# Signature Detection SFT (`Vishva007/signature-detection-sft`)Supervised fine-tuning (SFT) multimodal dataset derived from [`Vishva007/signature-detection-annotated`](https://huggingface.co/datasets/Vishva007/signature-detection-annotated) (which itself extends [`tech4humans/signature-detection`](https://huggingface.co/datasets/tech4humans/signature-detection)). Each row pairs a document image and `image_id` with a structured prompt (`question`), a `task_type` label, a JSON-formatted `answer`, and a chat-formatted `messages` list ready for vision-language model (VLM) fine-tuning.## Dataset Structure- **Splits**: `train` (12,000 rows).- **Columns**:- `image` (`dict` / `Image`): Document image (JPEG bytes in the viewer/Parquet representation).- `messages` (`list` / `string`): Chat-style conversation list containing a `user` turn (`image` + `text` question) and an `assistant` turn (`text` JSON string).- `question` (`string`): Natural-language prompt asking about signature presence, location/bounding boxes, discovery, count, signed status, or signing roles.- `answer` (`string`): Serialized JSON object with `answer` (string), `is_present` (bool), `count` (int), and `signatures` (list of objects containing `role` and `bbox_2d` in `[ymin, xmin, ymax, xmax]` scaled to `0–1000`).- `task_type` (`string`): Task category expanded from the source annotations, such as:- `positive_grounding`: Signature-presence questions for roles present on the document.- `hard_negative_grounding`: Signature-presence questions for plausible roles absent from the document (`is_present: false`, `count: 0`, `signatures: []`).- `open_discovery`: Prompts asking to identify and locate all signatures present on the document.- `pure_vqa`: Questions about signature count, signed status, or signing roles.- `image_id` (`int64`): Identifier linking back to the source document in `Vishva007/signature-detection-annotated`.## Data Generation & Provenance1. **Upstream Source**: Built on top of [`Vishva007/signature-detection-annotated`](https://huggingface.co/datasets/Vishva007/signature-detection-annotated) (teacher annotations generated via `Vishva007/Qwen3.5-9B-W4A16-AutoRound-GPTQ` over orientation-corrected, enhanced document images from `tech4humans/signature-detection`).2. **SFT Formatting**: Unpacks annotation entries across task types into individual VLM training examples with standardized JSON assistant responses and `messages` payloads.## Usage```pythonfrom datasets import load_datasetds = load_dataset("Vishva007/signature-detection-sft", split="train")sample = ds[0]print("image_id:", sample["image_id"])print("task_type:", sample["task_type"])print("question:", sample["question"])print("answer:", sample["answer"])```## Limitations & Considerations* **Weak / Synthetic Supervision**: Upstream role labels, bounding boxes, and negative prompts are teacher-generated and not manually verified; treat role titles and hard negatives as noisy/weak supervision.* **Coordinate Space**: `bbox_2d` values are normalized to `0–1000` on the orientation-corrected, enhanced image space used during teacher annotation.* **License**: Marked as `other`; inherit and verify compliance with the upstream [`tech4humans/signature-detection`](https://huggingface.co/datasets/tech4humans/signature-detection) dataset terms before commercial or restricted use.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135---license: othertask_categories:- image-text-to-text- visual-question-answering- object-detectionlanguage:- entags:- signature-detection- visual-grounding- document-ai- vqa- sft- pydantic- structured-outputpretty_name: Signature Detection SFTsize_categories:- 10K<n<100K---# Signature Detection SFTFlattened, conversation-formatted Supervised Fine-Tuning (SFT) dataset derived from [Vishva007/signature-detection-annotated](https://huggingface.co/datasets/Vishva007/signature-detection-annotated) (originally sourced from [tech4humans/signature-detection](https://huggingface.co/datasets/tech4humans/signature-detection)).Every document QA pair across the `train`, `validation`, and `test` splits is expanded into an individual multimodal turn (`messages`), pairing an orientation-corrected document image with a strict Pydantic-compatible JSON ground-truth response containing normalized `[0, 1000]` bounding boxes.## Dataset Structure### Data Fields| Column | Type | Description || :--- | :--- | :--- || `image` | `Image` | Orientation-corrected RGB document image (JPEG-encoded). || `messages` | `string` (JSON) | Two-turn chat list (`user` with `image` + `text` prompt; `assistant` with structured JSON `text`). || `question` | `string` | Raw user prompt extracted from the source QA annotation. || `answer` | `string` (JSON) | Strict JSON string matching the target Pydantic schema. || `task_type` | `string` | Task category: `positive_grounding`, `hard_negative_grounding`, `open_discovery`, or `pure_vqa`. || `image_id` | `int64` | Source document identifier from `Vishva007/signature-detection-annotated`. |### Assistant JSON SchemaAll assistant targets in `messages` and `answer` adhere to the following structured schema:```json{"answer": "Yes, the Director signature is present on this document.","is_present": true,"count": 2,"signatures": [{"role": "Director","bbox_2d": [730, 309, 914, 377]},{"role": "Director","bbox_2d": [788, 809, 942, 882]}]}```* **`answer`** (`str`): Natural-language answer to the user's query.* **`is_present`** (`bool`): `true` when one or more matching signatures exist on the document; `false` otherwise.* **`count`** (`int`): Number of signature entries returned in `signatures`.* **`signatures`** (`list[dict]`): List of detected signatures, each containing:* **`role`** (`str`): Signer role or title (e.g., `Director`, `Secretary`, `Sender`).* **`bbox_2d`** (`list[int]`): `[x1, y1, x2, y2]` coordinates normalized to `[0, 1000]` relative to the orientation-corrected image dimensions.### Task BreakdownEach source document expands into multiple training examples spanning four task types:1. **`positive_grounding`**: Role-specific signature verification queries where the queried role is present (`is_present: true`, `signatures` contains matching `bbox_2d` entries).2. **`hard_negative_grounding`**: Role-specific signature verification queries for plausible roles absent from the document (`is_present: false`, `count: 0`, `signatures: []`).3. **`open_discovery`**: Full-document extraction prompts (`"Identify and locate all signatures present on this document."`) returning every signature role and bounding box.4. **`pure_vqa`**: Document-level counting, presence, and signer-role questions paired with structured JSON responses.## Data Preparation Pipeline1. **EXIF & Orientation Correction**: Images are transposed via `ImageOps.exif_transpose` and evaluated with PaddleOCR's `PP-LCNet_x1_0_doc_ori` classifier to detect clockwise rotation (`0°`, `90°`, `180°`, `270°`) and rotate pages upright.2. **Coordinate Transformation**: Source COCO `[x, y, width, height]` bounding boxes are rotated alongside the image into `[x1, y1, x2, y2]` corners and normalized to `[0, 1000]` integers.3. **SFT Flattening & Validation**: Each QA entry across `positive_grounding`, `hard_negative_grounding`, `open_discovery`, and `pure_vqa` is mapped to its corresponding `marks` role labels and normalized boxes, serialized into validated JSON, and written to Snappy-compressed Parquet shards (`data/{split}-00000.parquet`).## Usage```pythonimport jsonfrom datasets import load_datasetds = load_dataset("Vishva007/signature-detection-sft")sample = ds["train"][0]image = sample["image"]messages = json.loads(sample["messages"])structured_target = json.loads(sample["answer"])print("Task:", sample["task_type"])print("Question:", sample["question"])print("Structured Target:", structured_target)```### Pydantic Validation Example```pythonfrom pydantic import BaseModel, ConfigDictclass SignatureItem(BaseModel):model_config = ConfigDict(extra="forbid")role: strbbox_2d: list[int]class SignatureResponse(BaseModel):model_config = ConfigDict(extra="forbid")answer: stris_present: boolcount: intsignatures: list[SignatureItem]parsed = SignatureResponse.model_validate_json(sample["answer"])```## Provenance & Limitations* **Upstream Data**: Derived from [Vishva007/signature-detection-annotated](https://huggingface.co/datasets/Vishva007/signature-detection-annotated) and [tech4humans/signature-detection](https://huggingface.co/datasets/tech4humans/signature-detection). Refer to those repositories for upstream licensing and citation details.* **Weak Supervision**: Signer role labels and hard-negative questions were generated via teacher VLM annotations (`Vishva007/Qwen3.5-9B-W4A16-AutoRound-GPTQ`) and are not human-verified.* **Image Duplication Across Rows**: Because multiple QA turns are generated per document, the same `image_id` appears across multiple rows in a given split. When creating custom validation folds, group by `image_id` to prevent data leakage.
README.md+103-31