# selinakhan/cigar architecture

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

- Interactive diagram: https://gitdiagram.com/selinakhan/cigar
- Repository: https://github.com/selinakhan/cigar

## Overview

##### Main Components

a) Data Processing Layer:
- Datasets module with its various components (COCO, ODVG, transforms)
- Data preparation pipelines
- Config management system

b) Model Architecture Layer:
- GroundingDINO core components
- Backbone (Swin Transformer)
- BERT text encoder integration
- Custom fusion modules for context integration

c) Training and Inference Pipeline:
- Training workflow
- Inference pathway
- Evaluation mechanisms

**[Data Layer]**

**[Model Layer]**

**[Training/Inference Layer]**

##### Important Details to Emphasize

- Clear labels for:
- Input/output formats
- Model component dimensions
- Configuration parameters
- Training options

##### Implementation Notes

- Version/compatibility information
- Dependencies and external requirements

##### Key Relationships to Highlight

- Data flow between datasets and model
- Context integration points
- Training configuration options
- Evaluation metrics flow

Remember to include a notes section explaining:
- The two combination stages
- The training configuration options
- The wandb integration points
- The custom BERT encoder integration

This will provide a comprehensive view of the system while highlighting the novel contributions of the CIGAr implementation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph DL[Data Layer]
        DS[Datasets]
        CD["COCO Dataset"]
        OD["ODVG Dataset"]
        DT["Data Transforms"]
        CM["Config Management"]
    end

    subgraph ML[Model Layer]
        subgraph GD[GroundingDINO Core]
            ST["Swin Transformer\nBackbone"]
            BE["BERT Encoder"]
            FM["Fusion Modules"]
            MA["MS-Deform-Attention"]
        end
    end

    subgraph TI[Training/Inference Layer]
        TE["Training Engine"]
        II["Inference Implementation"]
        ES["Evaluation System"]
        VT["Visualization Tools"]
        LG["Logger"]
    end

    subgraph UT[Utility Components]
        BO["Box Operations"]
        TK["Tokenizer"]
        CU["Config Utils"]
        VU["Visualization Utils"]
    end

    DS --> CD & OD
    CD & OD --> DT
    DT --> GD
    CM --> GD
    ST --> FM
    BE --> FM
    FM --> MA
    GD --> TE
    GD --> II
    TE --> ES
    II --> VT
    TE & II --> LG
    BO & TK & CU --> GD
    VU --> VT

    %% Component Mappings
    click DS "https://github.com/selinakhan/CIGAr/tree/main/datasets/"
    click CD "https://github.com/selinakhan/CIGAr/blob/main/datasets/coco.py"
    click OD "https://github.com/selinakhan/CIGAr/blob/main/datasets/odvg.py"
    click DT "https://github.com/selinakhan/CIGAr/blob/main/datasets/transforms.py"
    click CM "https://github.com/selinakhan/CIGAr/tree/main/config/"
    click GD "https://github.com/selinakhan/CIGAr/blob/main/models/GroundingDINO/groundingdino.py"
    click ST "https://github.com/selinakhan/CIGAr/blob/main/models/GroundingDINO/backbone/swin_transformer.py"
    click BE "https://github.com/selinakhan/CIGAr/blob/main/models/GroundingDINO/bertwarper.py"
    click FM "https://github.com/selinakhan/CIGAr/blob/main/models/GroundingDINO/fuse_modules.py"
    click MA "https://github.com/selinakhan/CIGAr/tree/main/models/GroundingDINO/csrc/MsDeformAttn/"
    click TE "https://github.com/selinakhan/CIGAr/blob/main/engine.py"
    click II "https://github.com/selinakhan/CIGAr/blob/main/groundingdino/util/inference.py"
    click ES "https://github.com/selinakhan/CIGAr/blob/main/datasets/cocogrounding_eval.py"
    click VT "https://github.com/selinakhan/CIGAr/blob/main/groundingdino/util/visualizer.py"
    click LG "https://github.com/selinakhan/CIGAr/blob/main/groundingdino/util/logger.py"
    click BO "https://github.com/selinakhan/CIGAr/blob/main/util/box_ops.py"
    click TK "https://github.com/selinakhan/CIGAr/blob/main/util/get_tokenlizer.py"
    click CU "https://github.com/selinakhan/CIGAr/blob/main/util/slconfig.py"
    click VU "https://github.com/selinakhan/CIGAr/blob/main/util/vis_utils.py"

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef data fill:#dae8fc,stroke:#6c8ebf
    classDef model fill:#d5e8d4,stroke:#82b366
    classDef training fill:#ffe6cc,stroke:#d79b00
    classDef util fill:#fff2cc,stroke:#d6b656

    class DS,CD,OD,DT,CM data
    class GD,ST,BE,FM,MA model
    class TE,II,ES,VT,LG training
    class BO,TK,CU,VU util
```
