# mantasu/glasses-detector architecture

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

- Interactive diagram: https://gitdiagram.com/mantasu/glasses-detector
- Repository: https://github.com/mantasu/glasses-detector

## Overview

Glasses Detector is a Python library for classifying, detecting, and segmenting glasses in images. The principal workflow is to construct a task-specific model, pass image inputs for prediction, and optionally process files or directories into saved or displayed results. The package also includes categorized datasets and augmentation support for model training. Shared model, prediction-type, and prediction-interface components underpin the task APIs. Relationships for unsampled wrapper and dataset implementations are limited to references shown in the source index; the README excerpt provides no further capability details.

Main entry points: [`src/glasses_detector/components/base_model.py`](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/base_model.py) (Model lifecycle), [`src/glasses_detector/components/pred_type.py`](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/pred_type.py) (Prediction types), [`src/glasses_detector/__init__.py`](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/__init__.py) (Public API), [`src/glasses_detector/classifier.py`](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/classifier.py) (Classification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_task_models["Task models"]
  node_package_api["Public API<br/>[__init__.py]"]
  node_classifier["Classification<br/>[classifier.py]"]
  node_detector["Object detection<br/>[detector.py]"]
  node_segmenter["Segmentation<br/>[segmenter.py]"]
end

subgraph group_architectures["Model architectures"]
  node_classifier_arch["Tiny classifier"]
  node_detector_arch["Tiny detector"]
  node_segmenter_arch["Tiny segmenter"]
end

subgraph group_data["Dataset support"]
  node_augmenter["Image augmentation<br/>[augmenter_mixin.py]"]
  node_dataset_base["Categorized dataset"]
  node_classification_data["Classification data"]
  node_detection_data["Detection data"]
  node_segmentation_data["Segmentation data"]
end

subgraph group_shared["Shared runtime"]
  node_pred_io["Prediction I/O<br/>[pred_interface.py]"]
  node_base_model["Model lifecycle<br/>[base_model.py]"]
  node_pred_type["Prediction types<br/>[pred_type.py]"]
  node_utils["Runtime utilities<br/>[utils.py]"]
end

node_user(("Library user"))

node_user -->|"uses"| node_package_api
node_package_api -->|"exports"| node_classifier
node_package_api -->|"exports"| node_detector
node_package_api -->|"exports"| node_segmenter
node_classifier -->|"uses lifecycle"| node_base_model
node_detector -->|"uses lifecycle"| node_base_model
node_segmenter -->|"uses lifecycle"| node_base_model
node_classifier -->|"selects architecture"| node_classifier_arch
node_detector -->|"selects architecture"| node_detector_arch
node_segmenter -->|"selects architecture"| node_segmenter_arch
node_base_model -->|"implements interface"| node_pred_io
node_base_model -->|"uses types"| node_pred_type
node_pred_io -->|"standardizes"| node_pred_type
node_classifier -->|"uses types"| node_pred_type
node_detector -->|"uses types"| node_pred_type
node_segmenter -->|"uses types"| node_pred_type
node_base_model -->|"uses helpers"| node_utils
node_pred_io -->|"uses helpers"| node_utils
node_dataset_base -->|"uses transforms"| node_augmenter
node_classification_data -->|"extends dataset"| node_dataset_base
node_detection_data -->|"extends dataset"| node_dataset_base
node_segmentation_data -->|"extends dataset"| node_dataset_base

click node_package_api "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/__init__.py"
click node_classifier "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/classifier.py"
click node_detector "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/detector.py"
click node_segmenter "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/segmenter.py"
click node_pred_io "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/pred_interface.py"
click node_base_model "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/base_model.py"
click node_pred_type "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/pred_type.py"
click node_utils "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/utils.py"
click node_classifier_arch "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_classifier.py"
click node_detector_arch "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_detector.py"
click node_segmenter_arch "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_segmenter.py"
click node_augmenter "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/augmenter_mixin.py"
click node_dataset_base "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/base_categorized_dataset.py"
click node_classification_data "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_classification_dataset.py"
click node_detection_data "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_detection_dataset.py"
click node_segmentation_data "https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_segmentation_dataset.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_package_api,node_classifier,node_detector,node_segmenter,node_user toneBlue
class node_classifier_arch,node_detector_arch,node_segmenter_arch toneAmber
class node_augmenter,node_dataset_base,node_classification_data,node_detection_data,node_segmentation_data toneMint
class node_pred_io,node_base_model,node_pred_type,node_utils toneRose
```

## Components

### Task models

- [Public API](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/__init__.py): `src/glasses_detector/__init__.py`
- [Classification](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/classifier.py): `src/glasses_detector/classifier.py`
- [Object detection](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/detector.py): `src/glasses_detector/detector.py`
- [Segmentation](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/segmenter.py): `src/glasses_detector/segmenter.py`

### Model architectures

- [Tiny classifier](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_classifier.py): `src/glasses_detector/architectures/tiny_binary_classifier.py`
- [Tiny detector](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_detector.py): `src/glasses_detector/architectures/tiny_binary_detector.py`
- [Tiny segmenter](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/architectures/tiny_binary_segmenter.py): `src/glasses_detector/architectures/tiny_binary_segmenter.py`

### Dataset support

- [Image augmentation](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/augmenter_mixin.py): `src/glasses_detector/_data/augmenter_mixin.py`
- [Categorized dataset](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/base_categorized_dataset.py): `src/glasses_detector/_data/base_categorized_dataset.py`
- [Classification data](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_classification_dataset.py): `src/glasses_detector/_data/binary_classification_dataset.py`
- [Detection data](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_detection_dataset.py): `src/glasses_detector/_data/binary_detection_dataset.py`
- [Segmentation data](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/_data/binary_segmentation_dataset.py): `src/glasses_detector/_data/binary_segmentation_dataset.py`

### Shared runtime

- [Prediction I/O](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/pred_interface.py): `src/glasses_detector/components/pred_interface.py`
- [Model lifecycle](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/base_model.py): `src/glasses_detector/components/base_model.py`
- [Prediction types](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/components/pred_type.py): `src/glasses_detector/components/pred_type.py`
- [Runtime utilities](https://github.com/mantasu/glasses-detector/blob/main/src/glasses_detector/utils.py): `src/glasses_detector/utils.py`

### Other components

- **Library user**

## Connections

- Library user → Public API: uses (evidence: `src/glasses_detector/__init__.py`)
- Public API → Classification: exports (evidence: `src/glasses_detector/__init__.py`)
- Public API → Object detection: exports (evidence: `src/glasses_detector/__init__.py`)
- Public API → Segmentation: exports (evidence: `src/glasses_detector/__init__.py`)
- Classification → Model lifecycle: uses lifecycle (evidence: `src/glasses_detector/classifier.py`)
- Object detection → Model lifecycle: uses lifecycle (evidence: `src/glasses_detector/detector.py`)
- Segmentation → Model lifecycle: uses lifecycle (evidence: `src/glasses_detector/segmenter.py`)
- Classification → Tiny classifier: selects architecture (evidence: `src/glasses_detector/classifier.py`)
- Object detection → Tiny detector: selects architecture (evidence: `src/glasses_detector/detector.py`)
- Segmentation → Tiny segmenter: selects architecture (evidence: `src/glasses_detector/segmenter.py`)
- Model lifecycle → Prediction I/O: implements interface (evidence: `src/glasses_detector/components/base_model.py`)
- Model lifecycle → Prediction types: uses types (evidence: `src/glasses_detector/components/base_model.py`)
- Prediction I/O → Prediction types: standardizes (evidence: `src/glasses_detector/components/pred_interface.py`)
- Classification → Prediction types: uses types (evidence: `src/glasses_detector/classifier.py`)
- Object detection → Prediction types: uses types (evidence: `src/glasses_detector/detector.py`)
- Segmentation → Prediction types: uses types (evidence: `src/glasses_detector/segmenter.py`)
- Model lifecycle → Runtime utilities: uses helpers (evidence: `src/glasses_detector/components/base_model.py`)
- Prediction I/O → Runtime utilities: uses helpers (evidence: `src/glasses_detector/components/pred_interface.py`)
- Categorized dataset → Image augmentation: uses transforms (evidence: `src/glasses_detector/_data/base_categorized_dataset.py`)
- Classification data → Categorized dataset: extends dataset (evidence: `src/glasses_detector/_data/binary_classification_dataset.py`)
- Detection data → Categorized dataset: extends dataset (evidence: `src/glasses_detector/_data/binary_detection_dataset.py`)
- Segmentation data → Categorized dataset: extends dataset (evidence: `src/glasses_detector/_data/binary_segmentation_dataset.py`)
