# annotation-manager **Repository Path**: ShiruiTian/annotation-manager ## Basic Information - **Project Name**: annotation-manager - **Description**: 标注系统开源代码仓库 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 44 - **Created**: 2026-05-28 - **Last Updated**: 2026-05-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AnnotationManager A desktop tool for managing annotated medical ultrasound datasets. Built with **PySide6** and **SQLite** for local storage, filtered browsing, overlay preview, statistics, and export to JSON/CSV plus COCO/VOC/YOLO training formats. ![Python](https://img.shields.io/badge/Python-3.8%2B-3776AB?logo=python&logoColor=white) ![License](https://img.shields.io/badge/License-MIT-green) ![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-555) [简体中文](README.md) ## UI Preview ![AnnotationManager Main UI](docs/images/main-ui.png) ## Documentation Asset Plan - `docs/images/`: central place for screenshots/illustrations used in README and docs. - `docs/images/main-ui.png`: main UI preview (migrated from `主界面图片.png`). - Use semantic English filenames for future assets, such as `filter-panel.png` or `export-dialog.png`. ## Features | Feature | Description | |---------|-------------| | Dataset root | Local folder with `annotations.db` | | Batch import | Images and annotations (`annotations.json` / `annotations.csv`) | | Update / merge | Update or merge existing records from annotation files (`.json` / `.cjson` / `.csv`) | | Filter panel | Filter by image ID, filename, create/update time, and more | | List view | Paginated table of the current filter result | | Image preview | Box/polygon overlay; previous/next image | | Properties | View and edit plane type, standard, and related fields | | Statistics | Cross-table of plane type × quality standard for the current filter | | Export | Export filtered results to JSON/CSV or to COCO/VOC/YOLO | | Reorganize | Move image files into subfolders by plane type | | Encrypted annotations | Read `.cjson` files (requires local AES library) | ## Layout | Area | Contents | |------|----------| | Left dock | Filter panel (image ID, filename, create/update time range) | | Center | **Image list** (paginated) / **Image view** (preview) | | Right dock | **Properties** panel / **Statistics** tab | Use **View → Left dock / Right dock** to show or hide the side panels. ## Project layout ``` AnnotationManager/ ├── ImageManager.py # Entry point ├── requirements.txt # Python dependencies ├── README.md / README.en.md # Chinese / English docs ├── LICENSE # MIT License ├── docs/ │ └── images/ │ └── main-ui.png # Main UI screenshot for README ├── help/ # User documentation (PDF / DOCX) ├── AnnotationIO/ # Annotation I/O, encryption, converters │ ├── annotation_io.py # Parsing (JSON / CSV / CJSON) │ ├── aes_cipher.py # AES cipher (native library required) │ ├── AesCipherUI.py # Standalone encrypt/decrypt utility (PyQt5) │ └── converter/ # COCO / VOC / YOLO converters ├── db/ │ ├── db.py # SQLite access and queries │ └── config.py # Plane types and quality standards ├── iomodule/ │ ├── annotation_io.py # Lightweight parser for import │ ├── dataset_importer.py # Import / update / merge │ ├── dataset_exporter.py # Export │ ├── dataset_sync.py # Dataset directory synchronization │ └── imageio.py # Image file I/O ├── ui/ # Qt UI │ ├── ImageFilterPage.* # Left filter panel │ ├── ImagePropertyPage.* # Right property panel │ ├── StatisticPage.* # Right statistics tab │ ├── PagedTableWidget.* # Paginated table │ └── ExportDialog.* # Advanced export dialog ├── render/ │ └── baserenderwidget.py # Annotation overlay rendering └── resources/ ├── resource.qrc ├── resource_rc.py └── icon/ # Menu and toolbar icons ``` ## Requirements - Python 3.8+ - Windows, macOS, or Linux with a working Qt GUI backend - For `.cjson` files: local AES shared library (`AesCipher.dll` / `AesCipher.so`, usually under `AnnotationIO/`) ## Install and run From the project root: ```bash pip install -r requirements.txt python ImageManager.py ``` On first launch: **Settings → Dataset directory**. The path is saved in `config.json` at the project root. ## Workflow 1. **Set directory**: Settings → Dataset directory 2. **Import**: File → Import, choose a folder with images and annotation files 3. **Filter & browse**: Set filters in the left panel; use the central Image list tab 4. **Preview**: Double-click a row to open the Image view tab 5. **Statistics**: Switch to the statistics tab in the right panel 6. **Export**: Choose an export action from the Tools menu (see table below) > Most export actions apply to the **current filter result**, not the entire database. Clear all filters to export everything. ### Menus | Menu | Item | Action | |------|------|--------| | File | Import | Batch-import a folder | | File | Update | Update existing records from an annotation file | | File | Merge | Merge annotations into existing records | | Tools | Generate json | Write `annotations.json` under the dataset root | | Tools | Generate csv | Write `annotations.csv` under the dataset root | | Tools | Generate json for each type | Write JSON per plane-type subfolder | | Tools | Generate csv for each type | Write CSV per plane-type subfolder | | Tools | Export to json | Export to a chosen directory (advanced dialog) | | Tools | Export to coco | Export in COCO format | | Tools | Export to voc | Export in VOC format (train/val/test split) | | Tools | Export to yolo | Export in YOLO format (class mapping, etc.) | | Tools | Generate json for videos | Decrypt video `.cjson` files to `.json` | | Tools | Reorganize | Reorganize image files by plane type | | Settings | Dataset directory | Set or change the dataset root | | View | Left dock | Toggle the filter panel | | View | Right dock | Toggle the property/statistics panel | ### Advanced export dialog **Export to json / coco / voc / yolo** opens a dialog where you can configure: - Export path - Annotation type: box / polygon / both - Train / val / test split ratios (VOC, YOLO) - Class mapping file, per-type sampling limits, ignored structures, etc. (YOLO) ## Data model ### Dataset folder After configuration you will see: - `annotations.db` — SQLite database for metadata and annotations - Image files organized into subfolders by plane type (on import) ### Annotation files | Format | Notes | |--------|--------| | `annotations.json` | Standard JSON annotations | | `annotations.csv` | CSV annotations (box-oriented) | | `annotations.cjson` | AES-encrypted JSON annotations | | `gt_annotations.json` | Preferred over `annotations.json` when present | | `gt_annotations.cjson` | Preferred over `annotations.cjson` when present | Folder import reads `annotations.json` / `annotations.csv` (and `gt_annotations.json`). **Update / Merge** also accepts `.cjson` files directly. Import issues may produce `error_annotations.json` or `inconsistent.csv` in the source folder. ### Import modes | Mode | Menu | Behavior | |------|------|----------| | Add | File → Import | Import new images; skip duplicates | | Update | File → Update | Match by MD5 and overwrite existing records | | Merge | File → Merge | Match by MD5 and merge old and new annotations | ### Plane types Defined in `db/config.py`. **Append new types at the end of each group** to avoid shifting existing `image_type` IDs. ## Dependencies ``` PySide6 opencv-python numpy loguru orjson ``` See [requirements.txt](requirements.txt). ## FAQ **Q: What is `config.json`?** Stores the last dataset path for local use only. Delete it to reset and pick the directory again in the UI. **Q: What does export include?** The **current filter result** by default. Clear all filters in the left panel to export the full database. **Q: How do I read `.cjson` encrypted annotations?** Place `AesCipher.dll` (Windows) or `AesCipher.so` (Linux/macOS) in the `AnnotationIO/` directory. Update, Merge, and video JSON generation depend on this library. **Q: What is the difference between Update and Merge?** Update overwrites matched records with new annotations. Merge combines existing and new annotation data. ## Open source license This project is released under the [MIT License](LICENSE). You may use, modify, and distribute this software freely (including for commercial purposes), subject to: - Including the copyright notice and license text in copies or derivative works; - The software is provided “as is”, without warranty of any kind. ## Author Hongyang Zhao — [hyzhao@hnu.edu.cn](mailto:hyzhao@hnu.edu.cn)