# pedropro/taco architecture

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

- Interactive diagram: https://gitdiagram.com/pedropro/taco
- Repository: https://github.com/pedropro/taco

## Overview

TACO provides a labeled litter-image dataset and a Mask R-CNN detector workflow: users obtain images from annotation URLs, prepare train/validation/test splits, configure class mappings, then train or evaluate detection and segmentation models. The graph also shows the dataset adapter, model utilities, and visualization layer. The README documents dataset metadata, unofficial annotations, unlabeled-image URL lists, and class-map options; source excerpts support the downloader, splitting, dataset, and detector relationships. Some detector internals and notebook behavior were not sampled, so those links are omitted.

Main entry points: [`detector/detector.py`](https://github.com/pedropro/taco/blob/master/detector/detector.py) (Train and inference CLI), [`download.py`](https://github.com/pedropro/taco/blob/master/download.py) (Image downloader), [`detector/split_dataset.py`](https://github.com/pedropro/taco/blob/master/detector/split_dataset.py) (Dataset splitter), [`detector/dataset.py`](https://github.com/pedropro/taco/blob/master/detector/dataset.py) (TACO dataset adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dataset["Dataset assets"]
  node_annotations["COCO annotations<br/>[annotations.json]"]
  node_unofficial["Unofficial annotations"]
  node_url_list["Image URL list<br/>[all_image_urls.csv]"]
  node_image_files[("Image files")]
end

subgraph group_preparation["Data preparation"]
  node_downloader["Image downloader<br/>[download.py]"]
  node_splitter["Dataset splitter<br/>[split_dataset.py]"]
  node_split_files["Train val test splits"]
end

subgraph group_detection["Detection workflow"]
  node_dataset_adapter["TACO dataset adapter<br/>[dataset.py]"]
  node_class_maps["Class maps"]
  node_detector_cli["Train and inference CLI<br/>[detector.py]"]
  node_detector_config["Detector configuration<br/>[config.py]"]
end

subgraph group_internals["Model internals"]
  node_mask_rcnn["Mask R-CNN model<br/>[model.py]"]
  node_model_utils["Detection utilities<br/>[utils.py]"]
  node_visualization["Detection visualization<br/>[visualize.py]"]
end

node_user(("Dataset user"))
node_image_host(("Image host"))

node_user -->|"runs download"| node_downloader
node_downloader -->|"reads annotations"| node_annotations
node_downloader -->|"fetches images"| node_image_host
node_downloader -->|"saves images"| node_image_files
node_user -->|"generates splits"| node_splitter
node_splitter -->|"reads source"| node_annotations
node_splitter -->|"writes splits"| node_split_files
node_user -->|"trains or evaluates"| node_detector_cli
node_detector_cli -->|"loads dataset"| node_dataset_adapter
node_detector_cli -->|"configures model"| node_detector_config
node_detector_cli -->|"trains or detects"| node_mask_rcnn
node_detector_cli -->|"uses visualizers"| node_visualization
node_dataset_adapter -->|"converts masks"| node_model_utils
node_mask_rcnn -->|"uses utilities"| node_model_utils
node_detector_cli -->|"selects class map"| node_class_maps

click node_annotations "https://github.com/pedropro/taco/blob/master/data/annotations.json"
click node_unofficial "https://github.com/pedropro/taco/blob/master/data/annotations_unofficial.json"
click node_url_list "https://github.com/pedropro/taco/blob/master/data/all_image_urls.csv"
click node_image_files "https://github.com/pedropro/taco/tree/master/data"
click node_downloader "https://github.com/pedropro/taco/blob/master/download.py"
click node_splitter "https://github.com/pedropro/taco/blob/master/detector/split_dataset.py"
click node_split_files "https://github.com/pedropro/taco/tree/master/data"
click node_dataset_adapter "https://github.com/pedropro/taco/blob/master/detector/dataset.py"
click node_class_maps "https://github.com/pedropro/taco/tree/master/detector/taco_config"
click node_detector_cli "https://github.com/pedropro/taco/blob/master/detector/detector.py"
click node_detector_config "https://github.com/pedropro/taco/blob/master/detector/config.py"
click node_mask_rcnn "https://github.com/pedropro/taco/blob/master/detector/model.py"
click node_model_utils "https://github.com/pedropro/taco/blob/master/detector/utils.py"
click node_visualization "https://github.com/pedropro/taco/blob/master/detector/visualize.py"

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_annotations,node_unofficial,node_url_list,node_image_files,node_user toneBlue
class node_downloader,node_splitter,node_split_files toneAmber
class node_dataset_adapter,node_class_maps,node_detector_cli,node_detector_config toneMint
class node_mask_rcnn,node_model_utils,node_visualization toneRose
class node_image_host toneIndigo
```

## Components

### Dataset assets

- [COCO annotations](https://github.com/pedropro/taco/blob/master/data/annotations.json): `data/annotations.json`
- [Unofficial annotations](https://github.com/pedropro/taco/blob/master/data/annotations_unofficial.json): `data/annotations_unofficial.json`
- [Image URL list](https://github.com/pedropro/taco/blob/master/data/all_image_urls.csv): `data/all_image_urls.csv`
- [Image files](https://github.com/pedropro/taco/tree/master/data): `data`

### Data preparation

- [Image downloader](https://github.com/pedropro/taco/blob/master/download.py): `download.py`
- [Dataset splitter](https://github.com/pedropro/taco/blob/master/detector/split_dataset.py): `detector/split_dataset.py`
- [Train val test splits](https://github.com/pedropro/taco/tree/master/data): `data`

### Detection workflow

- [TACO dataset adapter](https://github.com/pedropro/taco/blob/master/detector/dataset.py): `detector/dataset.py`
- [Class maps](https://github.com/pedropro/taco/tree/master/detector/taco_config): `detector/taco_config`
- [Train and inference CLI](https://github.com/pedropro/taco/blob/master/detector/detector.py): `detector/detector.py`
- [Detector configuration](https://github.com/pedropro/taco/blob/master/detector/config.py): `detector/config.py`

### Model internals

- [Mask R-CNN model](https://github.com/pedropro/taco/blob/master/detector/model.py): `detector/model.py`
- [Detection utilities](https://github.com/pedropro/taco/blob/master/detector/utils.py): `detector/utils.py`
- [Detection visualization](https://github.com/pedropro/taco/blob/master/detector/visualize.py): `detector/visualize.py`

### Other components

- **Dataset user**
- **Image host**

## Connections

- Dataset user → Image downloader: runs download (evidence: `README.md`)
- Image downloader → COCO annotations: reads annotations (evidence: `download.py`)
- Image downloader → Image host: fetches images (evidence: `download.py`)
- Image downloader → Image files: saves images (evidence: `download.py`)
- Dataset user → Dataset splitter: generates splits (evidence: `README.md`)
- Dataset splitter → COCO annotations: reads source (evidence: `detector/split_dataset.py`)
- Dataset splitter → Train val test splits: writes splits (evidence: `detector/split_dataset.py`)
- Dataset user → Train and inference CLI: trains or evaluates (evidence: `README.md`)
- Train and inference CLI → TACO dataset adapter: loads dataset (evidence: `detector/detector.py`)
- Train and inference CLI → Detector configuration: configures model (evidence: `detector/detector.py`)
- Train and inference CLI → Mask R-CNN model: trains or detects (evidence: `detector/detector.py`)
- Train and inference CLI → Detection visualization: uses visualizers (evidence: `detector/detector.py`)
- TACO dataset adapter → Detection utilities: converts masks (evidence: `detector/dataset.py`)
- Mask R-CNN model → Detection utilities: uses utilities (evidence: `detector/model.py`)
- Train and inference CLI → Class maps: selects class map (evidence: `README.md`)
