# living-technologies/orgasegment architecture

> Architecture diagram of the GitHub repository living-technologies/orgasegment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/living-technologies/orgasegment
- Repository: https://github.com/living-technologies/orgasegment

## Overview

##### Main Components

a) Input Layer:
- Image Input Processing (support for JPEG/JPG)
- Configuration Management (from ./conf/)
- Model Loading System

b) Core Processing Components:
- Mask R-CNN Implementation
- Tracking System (based on trackpy)
- Inference Pipeline
- Training Pipeline

c) Interface Layer:
- Streamlit Web Application
- SLURM Batch Processing Interface

##### Specific Implementation Details

- Configuration Management (OrganoidBasicConfig, app.conf, logging.conf)
- Model Architecture (Mask R-CNN)
- Data Pipeline (train/val/eval splits)
- Tracking System (trackpy integration)

##### Key Elements to Highlight

a) Two Main Operation Modes:
- Interactive Mode (Streamlit App)
- Batch Processing Mode (SLURM)

b) Data Processing Pipeline:
- Image Input → Preprocessing → Model Inference → Tracking → Results

c) Training Pipeline:
- Dataset → Training → Validation → Evaluation

##### External Dependencies
- Connections to external systems:
- SLURM Cluster
- GPU Resources
- File System
- Conda/Mamba Environment

##### Technical Details to Note

Annotations for:
- GPU requirements (>15GB RAM for training)
- Supported platforms (Linux/Windows)
- File format support (JPEG/JPG)
- Python version constraints

##### Optional Components

Future integration points:
- TensorFlow 2 support (planned)
- Neptune model monitoring (planned)
- Python >3.6 support (planned)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        UI[Streamlit Web Interface]
        BP[Batch Processing Scripts]
        CI[Configuration Interface]
    end

    subgraph "Processing Layer"
        subgraph "Image Processing Pipeline"
            IP[Image Processing]
            TP[Training Pipeline]
            EP[Evaluation Pipeline]
            TS[Tracking System]
        end
        
        subgraph "Model Components"
            MM[Mask R-CNN Model]
            INF[Inference System]
        end
    end

    subgraph "Data Layer"
        FS[File System Storage]
        MS[Model Storage]
        CS[Configuration Storage]
    end

    subgraph "External Dependencies"
        SLURM[SLURM Cluster]
        GPU[GPU Resources]
        CONDA[Conda/Mamba Environment]
    end

    %% Component Relationships
    UI --> IP
    BP --> IP
    CI --> IP
    IP --> MM
    MM --> INF
    INF --> TS
    TS --> FS
    CS --> IP
    MS --> MM
    BP --> SLURM
    MM --> GPU

    %% Click Events
    click UI "https://github.com/Living-Technologies/OrgaSegment/blob/master/app.py"
    click TS "https://github.com/Living-Technologies/OrgaSegment/blob/master/track.py"
    click BP "https://github.com/Living-Technologies/OrgaSegment/blob/master/train.sh"
    click CI "https://github.com/Living-Technologies/OrgaSegment/tree/master/conf/"
    click MM "https://github.com/Living-Technologies/OrgaSegment/blob/master/models/OrganoidBasic20211215.h5"
    click INF "https://github.com/Living-Technologies/OrgaSegment/blob/master/predict_mrcnn.py"
    click TP "https://github.com/Living-Technologies/OrgaSegment/blob/master/train_mrcnn.py"
    click EP "https://github.com/Living-Technologies/OrgaSegment/blob/master/eval_mrcnn.py"
    click FS "https://github.com/Living-Technologies/OrgaSegment/tree/master/data/"
    click CS "https://github.com/Living-Technologies/OrgaSegment/tree/master/conf/"
    click CONDA "https://github.com/Living-Technologies/OrgaSegment/blob/master/conf/environment.yml"

    %% Styling
    classDef frontend fill:#3498db
    classDef processing fill:#2ecc71
    classDef storage fill:#f1c40f
    classDef model fill:#e74c3c
    classDef external fill:#95a5a6

    class UI,BP,CI frontend
    class IP,TP,EP,TS processing
    class MM,INF model
    class FS,MS,CS storage
    class SLURM,GPU,CONDA external

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Processing Components]:::processing
        L3[Storage Components]:::storage
        L4[Model Components]:::model
        L5[External Dependencies]:::external
    end
```
