--- license: mit task_categories: - object-detection - image-segmentation language: - en tags: - chemistry - reaction - ocr - molecular-structure --- # RxnLabelData Annotated chemical reaction diagram dataset for the paper: *RobustRDP: Advancing Reaction Diagram Parsing via Synthetic-to-Real Data Scaling and Robustness-Oriented Training*. ## Description This dataset contains 3,500 annotated chemical reaction diagram images with bounding box and reaction relationship annotations. The annotations were created using the [RxnLabel](https://github.com/jaydetang/RxnLabel) annotation platform. ### Annotation Workflow 1. **Object Detection**: A YOLO model automatically detects molecules (Mol) and text (Txt) regions in reaction images. 2. **Relationship Annotation**: An interactive web-based tool is used to label relationships between detected objects, grouping them into reactants, conditions, and products. ## Data Structure ``` dataset/ ├── images.zip # ZIP archive containing all PNG images (3,500) ├── labels.zip # ZIP archive containing all JSON annotation files (3,500) └── README.md ``` ## Quick Start Download and extract the archives: ```bash # Download from Hugging Face # Option 1: Using git git clone https://huggingface.co/datasets/Jingcz/RxnLabelData cd RxnLabelData unzip images.zip unzip labels.zip # Option 2: Using Python from huggingface_hub import snapshot_download snapshot_download(repo_id="Jingcz/RxnLabelData", local_dir="./RxnLabelData") ``` After extraction, you will have: ``` RxnLabelData/ ├── images/ # 3,500 PNG images (000000.png ~ 003499.png) ├── labels/ # 3,500 JSON annotation files (000000.json ~ 003499.json) ├── images.zip ├── labels.zip └── README.md ``` ## Label Format Each JSON file contains: ```json { "id": 0, "width": 1496, "height": 1370, "file_name": "000000.png", "bboxes": [ { "id": 0, "bbox": [66.88, 183.59, 37.72, 51.03], "category_id": 3 } ], "reactions": [ { "reactants": [0], "conditions": [1, 2], "products": [3] } ] } ``` ### Category IDs | ID | Label | Description | |----|-------|-------------| | 1 | Mol | Molecule structure | | 2 | Txt | Text / condition label | | 3 | Idt | Identifier / arrow label | ## Usage Example ```python import json from PIL import Image # Load image img = Image.open("images/000000.png") # Load annotations with open("labels/000000.json") as f: data = json.load(f) # Access bounding boxes for box in data["bboxes"]: print(f"ID: {box['id']}, Category: {box['category_id']}, Box: {box['bbox']}") # Access reactions for rxn in data["reactions"]: print(f"Reactants: {rxn['reactants']}") print(f"Conditions: {rxn['conditions']}") print(f"Products: {rxn['products']}") ``` ## Citation If you use this dataset, please cite: ```bibtex @article{robustrdp, title={RobustRDP: Advancing Reaction Diagram Parsing via Synthetic-to-Real Data Scaling and Robustness-Oriented Training}, author={...}, year={2025} } ``` ## Related Resources - **Annotation Platform**: [RxnLabel](https://github.com/jaydetang/RxnLabel) - Web-based tool for annotating chemical reaction diagrams