# uoguelph-mlrg/massid45 architecture

> Architecture diagram of the GitHub repository uoguelph-mlrg/massid45, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uoguelph-mlrg/massid45
- Repository: https://github.com/uoguelph-mlrg/massid45

## Overview

MassID45 combines insect imagery and DNA data with annotation, image preprocessing, and model training/inference. The principal image workflow downloads bulk images and annotation tiles, assembles annotations into full-image COCO data, crops excess areas, slices images for training, and postprocesses sliced annotations. The README documents this stage order; source excerpts show processing details for the core scripts. Model and annotation submodules are represented at their tree paths because their internals were not sampled.

Main entry points: [`image_preprocessing/postprocess_dataset.py`](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/postprocess_dataset.py) (Annotation postprocessing), [`image_preprocessing/pipeline.sh`](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/pipeline.sh) (Preprocessing runner), [`image_preprocessing/download_data.py`](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/download_data.py) (Image download), [`image_preprocessing/assemble_annotations.py`](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/assemble_annotations.py) (Annotation assembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data acquisition"]
  node_download["Image download<br/>[download_data.py]"]
  node_ena_dl["ENA download scripts"]
end

subgraph group_prep["Image preparation"]
  node_annotation_tiles["Annotation tiles"]
  node_assemble["Annotation assembly"]
  node_crop["Bulk image cropping<br/>[crop_bulk_imgs.py]"]
  node_tile["Image tiling<br/>[tile_imgs.py]"]
  node_postprocess["Annotation postprocessing"]
  node_polygon_check["Polygon analysis"]
  node_pipeline["Preprocessing runner<br/>[pipeline.sh]"]
end

subgraph group_annotation["Annotation utilities"]
  node_arth["Annotation utilities"]
end

subgraph group_models["Model workflows"]
  node_cutler["CutLER"]
  node_maskrcnn["Mask R-CNN"]
  node_mask2former["Mask2Former"]
  node_maskdino["MaskDINO"]
  node_grounded["Grounded-SAM-2"]
end

node_researchers(("Dataset users"))
node_bulk[("Bulk imagery")]
node_ena[("ENA sequences")]
node_annotators(("Annotators"))

node_researchers -->|"request data"| node_download
node_bulk -->|"download imagery"| node_download
node_download -->|"provide images"| node_assemble
node_annotation_tiles -->|"supply annotations"| node_assemble
node_assemble -->|"prepare COCO data"| node_crop
node_crop -->|"provide cropped data"| node_tile
node_tile -->|"provide sliced annotations"| node_postprocess
node_postprocess -.->|"validate polygons"| node_polygon_check
node_pipeline -.->|"run pipeline"| node_download
node_pipeline -.->|"run pipeline"| node_assemble
node_pipeline -.->|"run pipeline"| node_crop
node_pipeline -.->|"run pipeline"| node_tile
node_pipeline -.->|"run pipeline"| node_postprocess
node_ena -->|"provide sequences"| node_ena_dl
node_annotators -->|"use annotation tools"| node_arth
node_postprocess -.->|"supply dataset"| node_cutler
node_postprocess -.->|"supply dataset"| node_maskrcnn
node_postprocess -.->|"supply dataset"| node_mask2former
node_postprocess -.->|"supply dataset"| node_maskdino
node_postprocess -.->|"supply dataset"| node_grounded

click node_download "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/download_data.py"
click node_ena_dl "https://github.com/uoguelph-mlrg/massid45/tree/master/image_preprocessing/ENA_sequence_scripts"
click node_annotation_tiles "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/assets/annots_20250307_coco.json"
click node_assemble "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/assemble_annotations.py"
click node_crop "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/crop_bulk_imgs.py"
click node_tile "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/tile_imgs.py"
click node_postprocess "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/postprocess_dataset.py"
click node_polygon_check "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/analyze_invalid_polygons.py"
click node_pipeline "https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/pipeline.sh"
click node_arth "https://github.com/uoguelph-mlrg/massid45/tree/master/arth-imrec"
click node_cutler "https://github.com/uoguelph-mlrg/massid45/tree/master/CutLER"
click node_maskrcnn "https://github.com/uoguelph-mlrg/massid45/tree/master/Mask-RCNN"
click node_mask2former "https://github.com/uoguelph-mlrg/massid45/tree/master/Mask2Former"
click node_maskdino "https://github.com/uoguelph-mlrg/massid45/tree/master/MaskDINO"
click node_grounded "https://github.com/uoguelph-mlrg/massid45/tree/master/Grounded-SAM-2"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_download,node_ena_dl,node_researchers toneBlue
class node_annotation_tiles,node_assemble,node_crop,node_tile,node_postprocess,node_polygon_check,node_pipeline,node_bulk,node_ena toneAmber
class node_arth toneMint
class node_cutler,node_maskrcnn,node_mask2former,node_maskdino,node_grounded toneRose
class node_annotators toneIndigo
```

## Components

### Data acquisition

- [Image download](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/download_data.py): `image_preprocessing/download_data.py`
- [ENA download scripts](https://github.com/uoguelph-mlrg/massid45/tree/master/image_preprocessing/ENA_sequence_scripts): `image_preprocessing/ENA_sequence_scripts`

### Image preparation

- [Annotation tiles](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/assets/annots_20250307_coco.json): `image_preprocessing/assets/annots_20250307_coco.json`
- [Annotation assembly](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/assemble_annotations.py): `image_preprocessing/assemble_annotations.py`
- [Bulk image cropping](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/crop_bulk_imgs.py): `image_preprocessing/crop_bulk_imgs.py`
- [Image tiling](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/tile_imgs.py): `image_preprocessing/tile_imgs.py`
- [Annotation postprocessing](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/postprocess_dataset.py): `image_preprocessing/postprocess_dataset.py`
- [Polygon analysis](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/analyze_invalid_polygons.py): `image_preprocessing/analyze_invalid_polygons.py`
- [Preprocessing runner](https://github.com/uoguelph-mlrg/massid45/blob/master/image_preprocessing/pipeline.sh): `image_preprocessing/pipeline.sh`

### Annotation utilities

- [Annotation utilities](https://github.com/uoguelph-mlrg/massid45/tree/master/arth-imrec): `arth-imrec`

### Model workflows

- [CutLER](https://github.com/uoguelph-mlrg/massid45/tree/master/CutLER): `CutLER`
- [Mask R-CNN](https://github.com/uoguelph-mlrg/massid45/tree/master/Mask-RCNN): `Mask-RCNN`
- [Mask2Former](https://github.com/uoguelph-mlrg/massid45/tree/master/Mask2Former): `Mask2Former`
- [MaskDINO](https://github.com/uoguelph-mlrg/massid45/tree/master/MaskDINO): `MaskDINO`
- [Grounded-SAM-2](https://github.com/uoguelph-mlrg/massid45/tree/master/Grounded-SAM-2): `Grounded-SAM-2`

### Other components

- **Dataset users**
- **Bulk imagery**
- **ENA sequences**
- **Annotators**

## Connections

- Dataset users → Image download: request data (evidence: `README.md`)
- Bulk imagery → Image download: download imagery (evidence: `image_preprocessing/download_data.py`)
- Image download → Annotation assembly: provide images (evidence: `README.md`)
- Annotation tiles → Annotation assembly: supply annotations (evidence: `README.md`)
- Annotation assembly → Bulk image cropping: prepare COCO data (evidence: `README.md`)
- Bulk image cropping → Image tiling: provide cropped data (evidence: `README.md`)
- Image tiling → Annotation postprocessing: provide sliced annotations (evidence: `README.md`)
- Annotation postprocessing → Polygon analysis: validate polygons
- Preprocessing runner → Image download: run pipeline
- Preprocessing runner → Annotation assembly: run pipeline
- Preprocessing runner → Bulk image cropping: run pipeline
- Preprocessing runner → Image tiling: run pipeline
- Preprocessing runner → Annotation postprocessing: run pipeline
- ENA sequences → ENA download scripts: provide sequences (evidence: `README.md`)
- Annotators → Annotation utilities: use annotation tools (evidence: `README.md`)
- Annotation postprocessing → CutLER: supply dataset
- Annotation postprocessing → Mask R-CNN: supply dataset
- Annotation postprocessing → Mask2Former: supply dataset
- Annotation postprocessing → MaskDINO: supply dataset
- Annotation postprocessing → Grounded-SAM-2: supply dataset
