# youngskkim/crn architecture

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

- Interactive diagram: https://gitdiagram.com/youngskkim/crn
- Repository: https://github.com/youngskkim/crn

## Overview

Based on our analysis of the file tree and README, the CRN project is a specialized multi-modal 3D perception system. It integrates camera images and radar data to generate a bird’s-eye-view (BEV) feature map for tasks like 3D object detection. The project builds on components from mmdetection3d, BEVDepth, and BEVFormer, and uses a series of pre-processing scripts for data (e.g., generating depth ground truth, radar projections, and annotations) as well as a complex deep learning architecture that spans backbones, feature transformation, multi-modal fusion, and detection heads.

##### And Label Main System Components
- Data Sources & Pre-processing:
– External Data: NuScenes dataset (camera images, radar blobs, LiDAR keyframes).
– Pre-processing Scripts: gen_info.py to create dataset information; gen_depth_gt.py to produce ground truth depth; gen_radar_bev.py and gen_radar_pv.py to process radar point clouds.
- Model Architecture:
– Camera Branch: A backbone network (e.g., ResNet variants) extracting image features.
– Radar Branch: Modules for processing sparse, accurate radar points.
– BEV Transformation: Components (possibly in “layers/backbones” and “models”) that transform perspective image features into a BEV space.
– Multi-modal Fusion: Fusion layers that use deformable attention (found in modules like “multimodal_deformable_cross_attention” and “multimodal_feature_aggregation”) to merge the camera and radar information.
– Detection/Prediction Head: Final heads that output 3D detections; examples include detectors defined in “exps/det/CRN_r18_256x704_128x128_4key.py” and “exps/det/CRN_r50_256x704_128x128_4key.py”.
- Training and Evaluation:
– Training Pipelines: Scripts and configuration files (under “exps”, “configs”) orchestrate training.
– Evaluation Modules: Evaluators in “evaluators/” and test scripts in “tests” for performance and inference measurements.

##### Data and Control Flows
– Start with data ingestion (show external source, e.g., nuScenes, with a note about symlinking or dataset download).
– Flow from pre-processed data into the training pipeline, which then feeds into two parallel extraction branches (camera and radar) that later merge in the BEV space.

##### Architectural Components and Design Patterns
– Mark clearly the separation of concerns between data pre-processing, feature extraction, transformation, fusion, and detection. This separation is a core architectural principle here.
– Indicate use of modular design: for instance, the “layers” for backbones, fuser, heads, and modules show MVC-like separation (feature extraction → transformation → prediction).
– Emphasize reusability: the project builds on mmdetection3d, so you may label a “Core 3D Detection Framework” module that encompasses many common operations (e.g., anchors, ROI heads, voxel encoders) reused for CRN’s purpose.

##### Incorporate Relevant Technologies and Dependencies
– Label key frameworks such as PyTorch, PyTorch Lightning, MMCV, and components from MMDetection3D.
– Optionally highlight the use of GPU acceleration and FP16 precision in both training and evaluation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["NuScenes Data"]:::dataSource
    subgraph "Data Pre-processing"
        B1["gen_info.py"]:::proc
        B2["gen_depth_gt.py"]:::proc
        B3["gen_radar_bev.py"]:::proc
        B4["gen_radar_pv.py"]:::proc
    end
    P["Pre-processed Data"]:::dataFlow
    TP["Training Pipeline & Configurations"]:::training
    subgraph "Feature Extraction Branches"
        C1["Camera Branch: Image Backbone"]:::branch
        C2["Radar Branch: Radar Processing"]:::branch
    end
    M0["Combined Features"]:::dataFlow
    F["BEV Transformation"]:::fusion
    MFA["Multi-modal Feature Aggregation"]:::fusion
    MDCA["Multi-modal Deformable Cross-Attention"]:::fusion
    D["Detection Head"]:::detection
    O["3D Detection Output"]:::output
    E["Evaluation Modules"]:::evaluation
    R["Core 3D Detection Framework (mmdetection3d, PyTorch, MMCV)"]:::external

    A -->|"raw_data"| P
    B1 --> P
    B2 --> P
    B3 --> P
    B4 --> P
    P --> TP
    TP --> C1
    TP --> C2
    C1 --> M0
    C2 --> M0
    M0 --> F
    F --> MFA
    MFA --> MDCA
    MDCA --> D
    D --> O
    D --> E
    TP --> R

    click B1 "https://github.com/youngskkim/crn/blob/main/scripts/gen_info.py"
    click B2 "https://github.com/youngskkim/crn/blob/main/scripts/gen_depth_gt.py"
    click B3 "https://github.com/youngskkim/crn/blob/main/scripts/gen_radar_bev.py"
    click B4 "https://github.com/youngskkim/crn/blob/main/scripts/gen_radar_pv.py"
    click C1 "https://github.com/youngskkim/crn/tree/main/layers/backbones"
    click C1 "https://github.com/youngskkim/crn/blob/main/models/base_bev_depth.py"
    click C2 "https://github.com/youngskkim/crn/blob/main/models/camera_radar_net_det.py"
    click F "https://github.com/youngskkim/crn/blob/main/models/base_bev_depth.py"
    click MFA "https://github.com/youngskkim/crn/blob/main/layers/fuser/multimodal_feature_aggregation.py"
    click MDCA "https://github.com/youngskkim/crn/blob/main/layers/modules/multimodal_deformable_cross_attention.py"
    click D "https://github.com/youngskkim/crn/blob/main/layers/heads/bev_depth_head_det.py"
    click D "https://github.com/youngskkim/crn/blob/main/exps/det/CRN_r18_256x704_128x128_4key.py"
    click D "https://github.com/youngskkim/crn/blob/main/exps/det/CRN_r50_256x704_128x128_4key.py"
    click TP "https://github.com/youngskkim/crn/tree/main/exps"
    click E "https://github.com/youngskkim/crn/blob/main/evaluators/det_evaluators.py"
    click E "https://github.com/youngskkim/crn/tree/main/tests"

    classDef dataSource fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef proc fill:#aqua,stroke:#333,stroke-width:2px;
    classDef dataFlow fill:#ddd,stroke:#333,stroke-width:2px;
    classDef training fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef branch fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef fusion fill:#ffb6c1,stroke:#333,stroke-width:2px;
    classDef detection fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef evaluation fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef external fill:#ffa07a,stroke:#333,stroke-width:2px;
    classDef output fill:#e0ffff,stroke:#333,stroke-width:2px;
```
