Skip to content

PartInventory: Instance-Level Annotations for Object Decompositions

License

Notifications You must be signed in to change notification settings

Andy-LZH/PartInventory

Repository files navigation

PartInventory: Navigating Semantic and Instance Segmentation

Status License Python React FastAPI Hugging Face Datasets

PartInventory is a full-stack annotation and dataset creation system designed to navigate the transition from semantic masks to high-quality, instance-level part annotations. Specifically, this dataset provides refined instance-level annotations for PartImageNet, building upon the semantic segmentation masks from SPIN.

The resulting dataset is available on Hugging Face: πŸ€— PartInventory Dataset.

Disclaimer: This project is a technical demonstration and portfolio piece. It is not intended for academic publication as original research. All credit for the underlying datasets and methodologies belongs to the respective authors of PartImageNet and SPIN.

The platform integrates CVAT-based task management with a custom crowdsourcing pipeline on MTurk, enabling efficient identification of single vs. multiple part instances and high-fidelity instance splits.

The system supports all stages of benchmark creationβ€”from preparing COCO-style data, distributing tasks to workers, collecting classifications, exporting CVAT instance masks, and generating analyticsβ€”ensuring scalable, consistent, and reproducible part-level datasets.


πŸš€ Key Features

1. Crowdsourcing Annotation Interface

  • Interactive UI: A modern, responsive web application built with React, Vite, and Chakra UI.
  • Visual Feedback: Real-time visualization of segmentation masks overlaid on original images.
  • Quality Control: Integrated "Gold Standard" qualification tests and agreement checks to ensure high-quality worker data.
  • MTurk Integration: Seamless submission logic compatible with Amazon Mechanical Turk's external question API.

2. Robust Backend API

  • FastAPI Powered: High-performance Python backend handling task distribution, image serving, and data validation.
  • Cloud Native: Fully integrated with AWS S3 for scalable storage of images, masks, and task metadata.
  • Dynamic Mask Generation: On-the-fly generation of visualization masks from RLE (Run-Length Encoding) data using pycocotools.

3. Data Processing Pipeline

  • CVAT Integration: Tools to synchronize data with Computer Vision Annotation Tool (CVAT), including automated task creation and annotation export.
  • COCO Format Support: Full support for the COCO dataset format, including conversion, merging, and splitting utilities.
  • Analytics Engine: Comprehensive statistical analysis scripts (dataset_statistics.py) to generate distribution metrics, confusion matrices, and instance counts similar to academic dataset papers (CVPR/ECCV).

πŸ› οΈ Tech Stack

Frontend

  • Framework: React 18 (TypeScript)
  • Build Tool: Vite
  • UI Library: Chakra UI
  • State Management: React Hooks

Backend

  • Framework: FastAPI (Python 3.9+)
  • Data Processing: NumPy, Pandas, PyCOCOTools, Matplotlib
  • Cloud Services: AWS Boto3 (S3, MTurk)
  • Server: Uvicorn

Data & DevOps

  • Annotation Format: COCO JSON
  • Version Control: Git (with Pre-commit hooks for quality & security)
  • Deployment: Heroku / Docker ready (Procfile included)

πŸ“‚ Project Structure

PartInventory/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Classification/
β”‚   β”‚   β”œβ”€β”€ backend/          # FastAPI server & data processing
β”‚   β”‚   β”‚   β”œβ”€β”€ main.py       # API Entry point
β”‚   β”‚   β”‚   β”œβ”€β”€ data/         # Analytics scripts & local data
β”‚   β”‚   β”‚   └── MturkUtility.ipynb # MTurk management notebooks
β”‚   β”‚   └── frontend/         # React annotation interface
β”‚   β”‚       β”œβ”€β”€ src/          # UI Components & Logic
β”‚   β”‚       └── vite.config.ts
β”‚   └── CVAT/                 # CVAT integration tools
β”‚       β”œβ”€β”€ create_archive_dataset.py # COCO export utilities
β”‚       └── merged/           # Dataset merging logic
β”œβ”€β”€ dataset_statistics.py     # Statistical analysis generator
β”œβ”€β”€ generate_cvpr_figures.py  # Visualization for papers
└── utils/                    # Helper scripts

πŸš€ Getting Started

Prerequisites

  • Node.js (v16+)
  • Python (v3.9+)
  • AWS Credentials (if accessing S3/MTurk features)

1. Backend Setup

Navigate to the backend directory and install dependencies:

cd src/Classification/backend
pip install -r requirements.txt

Run the development server:

uvicorn main:app --reload

The API will be available at http://localhost:8000.

2. Frontend Setup

Navigate to the frontend directory and install dependencies:

cd src/Classification/frontend
npm install

Start the development server:

npm run dev

The UI will be available at http://localhost:5173.


πŸ“Š Data Pipeline Workflow

  1. Ingestion: Images and initial segmentations are managed in CVAT.
  2. Export: Use src/CVAT/create_archive_dataset.py to export annotations in COCO format.
    python src/CVAT/create_archive_dataset.py --annotations-only coco_exports/MyCategory.json
  3. Crowdsourcing: The backend serves these parts to the Frontend UI for instance counting (One vs. Many).
  4. Analysis: Run dataset_statistics.py to generate a comprehensive report on the dataset distribution.
    python dataset_statistics.py

πŸ“ˆ Analytics & Visualization

The project includes sophisticated tools for analyzing dataset health:

  • dataset_statistics.py: Generates LaTeX-ready tables of dataset statistics (Images, Annotations, Categories).
  • generate_cvpr_figures.py: Creates publication-quality charts showing category distributions and instance counts.

πŸ›‘οΈ Quality Assurance

This repository uses pre-commit hooks to ensure code quality and security:

  • Gitleaks: Scans for accidental commit of AWS keys or secrets.
  • Trailing Whitespace / End-of-file: Ensures consistent formatting.
  • Large File Check: Prevents committing massive binary files.

To install hooks locally:

pre-commit install

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“š Citation

If you use this dataset, please cite the original PartImageNet paper and the SPIN paper:

@article{he2021partimagenet,
  title={PartImageNet: A Large, High-Quality Dataset of Parts},
  author={He, Ju and Yang, Shuo and Yang, Shaokang and Kortylewski, Adam and Yuan, Xiaoding and Chen, Jie-Neng and Liu, Shuai and Yang, Cheng and Yuille, Alan},
  journal={arXiv preprint arXiv:2112.00933},
  year={2021}
}

% Please add the SPIN paper citation here

About

PartInventory: Instance-Level Annotations for Object Decompositions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors