# ahmadhassan011/lizarddetection architecture

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

- Interactive diagram: https://gitdiagram.com/ahmadhassan011/lizarddetection
- Repository: https://github.com/ahmadhassan011/lizarddetection

## Overview

LizardLens is an offline Android app for detecting lizards in camera frames, photos, and videos. The main workflow runs from the app’s camera screen through camera analysis and inference, then displays detections and persists them for history. Image and video modes provide separate analysis flows; settings and thermal management support configuration and sustained camera use. The README documents these capabilities, while some implementation details were not sampled, so uncertain connections are omitted or marked unverified.

Main entry points: [`android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt) (Detection repository), [`android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt) (App navigation), [`android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt`](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt) (Camera screen), [`android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt`](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt) (TFLite inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App navigation<br/>[LizardLensApp.kt]"]
  node_camera_screen["Camera screen<br/>[CameraScreen.kt]"]
  node_camera_vm["Camera view model<br/>[CameraViewModel.kt]"]
  node_image_screen["Image screen<br/>[ImageScreen.kt]"]
  node_image_vm["Image detection"]
  node_video_screen["Video screen<br/>[VideoScreen.kt]"]
  node_video_vm["Video detection"]
  node_history_screen["History screen<br/>[HistoryScreen.kt]"]
  node_history_vm["History view model"]
  node_settings_screen["Settings screen<br/>[SettingsScreen.kt]"]
  node_settings_vm["Settings view model"]
end

subgraph group_detection["Detection pipeline"]
  node_analyzer["Camera analyzer"]
  node_thermal["Thermal manager<br/>[ThermalManager.kt]"]
  node_yuv["YUV converter<br/>[YuvConverter.kt]"]
  node_inference["TFLite inference"]
  node_preprocessor["Image preprocessing<br/>[Preprocessor.kt]"]
  node_nms["NMS processing<br/>[NmsProcessor.kt]"]
  node_config["Inference configuration<br/>[InferenceConfig.kt]"]
end

subgraph group_storage["Persistence"]
  node_repository["Detection repository"]
  node_config_store["Detection settings store"]
  node_database[("Room database<br/>[AppDatabase.kt]")]
  node_dao["Detection DAO<br/>[DetectionDao.kt]"]
  node_entity["Detection records<br/>[DetectionEntity.kt]"]
  node_converter["Room converters<br/>[Converters.kt]"]
end

subgraph group_shared["Shared components"]
  node_model["Detection model<br/>[Detection.kt]"]
  node_overlay["Detection overlays"]
end

node_researcher(("Field researcher"))

node_researcher -->|"uses"| node_app
node_app -->|"shows"| node_camera_screen
node_app -->|"routes to"| node_image_screen
node_app -->|"routes to"| node_video_screen
node_app -->|"routes to"| node_history_screen
node_app -->|"routes to"| node_settings_screen
node_camera_screen -->|"uses"| node_camera_vm
node_camera_screen -->|"uses"| node_analyzer
node_camera_screen -->|"uses"| node_thermal
node_camera_vm -->|"requests detection"| node_repository
node_camera_vm -->|"checks heat"| node_thermal
node_image_screen -.->|"uses"| node_image_vm
node_image_vm -->|"requests detection"| node_repository
node_video_screen -->|"uses"| node_video_vm
node_video_vm -->|"requests detection"| node_repository
node_video_vm -->|"converts frames"| node_yuv
node_history_screen -->|"uses"| node_history_vm
node_history_vm -.->|"loads history"| node_repository
node_settings_screen -.->|"uses"| node_settings_vm
node_repository -->|"reads settings"| node_config_store
node_repository -->|"runs inference"| node_inference
node_repository -->|"writes records"| node_dao
node_database -->|"provides"| node_dao
node_database -->|"stores"| node_entity
node_database -->|"uses"| node_converter
node_dao -->|"queries"| node_entity
node_inference -->|"preprocesses"| node_preprocessor
node_inference -->|"postprocesses"| node_nms
node_inference -->|"uses"| node_config
node_repository -->|"returns detections"| node_model
node_overlay -->|"renders"| node_model

click node_app "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt"
click node_camera_screen "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt"
click node_camera_vm "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/CameraViewModel.kt"
click node_image_screen "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/ImageScreen.kt"
click node_image_vm "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/ImageDetectionViewModel.kt"
click node_video_screen "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/VideoScreen.kt"
click node_video_vm "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/VideoDetectionViewModel.kt"
click node_history_screen "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/HistoryScreen.kt"
click node_history_vm "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/HistoryViewModel.kt"
click node_settings_screen "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/SettingsScreen.kt"
click node_settings_vm "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/SettingsViewModel.kt"
click node_analyzer "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/CameraXImageAnalyzer.kt"
click node_thermal "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/ThermalManager.kt"
click node_yuv "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/YuvConverter.kt"
click node_inference "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt"
click node_preprocessor "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/Preprocessor.kt"
click node_nms "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/NmsProcessor.kt"
click node_config "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/InferenceConfig.kt"
click node_repository "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt"
click node_config_store "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionConfigStore.kt"
click node_database "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt"
click node_dao "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionDao.kt"
click node_entity "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionEntity.kt"
click node_model "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/model/src/main/java/com/lizardlens/core/model/Detection.kt"
click node_overlay "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/ui/src/main/java/com/lizardlens/ui/composables/DetectionOverlays.kt"
click node_converter "https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/Converters.kt"

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_app,node_camera_screen,node_camera_vm,node_image_screen,node_image_vm,node_video_screen,node_video_vm,node_history_screen,node_history_vm,node_settings_screen,node_settings_vm toneBlue
class node_analyzer,node_thermal,node_yuv,node_inference,node_preprocessor,node_nms,node_config toneAmber
class node_repository,node_config_store,node_database,node_dao,node_entity,node_converter toneMint
class node_model,node_overlay toneRose
class node_researcher toneIndigo
```

## Components

### App experience

- [App navigation](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt): `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`
- [Camera screen](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt): `android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt`
- [Camera view model](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/CameraViewModel.kt): `android/app/src/main/java/com/lizardlens/ui/viewmodel/CameraViewModel.kt`
- [Image screen](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/ImageScreen.kt): `android/app/src/main/java/com/lizardlens/ui/screens/ImageScreen.kt`
- [Image detection](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/ImageDetectionViewModel.kt): `android/app/src/main/java/com/lizardlens/ui/viewmodel/ImageDetectionViewModel.kt`
- [Video screen](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/VideoScreen.kt): `android/app/src/main/java/com/lizardlens/ui/screens/VideoScreen.kt`
- [Video detection](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/VideoDetectionViewModel.kt): `android/app/src/main/java/com/lizardlens/ui/viewmodel/VideoDetectionViewModel.kt`
- [History screen](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/HistoryScreen.kt): `android/app/src/main/java/com/lizardlens/ui/screens/HistoryScreen.kt`
- [History view model](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/HistoryViewModel.kt): `android/app/src/main/java/com/lizardlens/ui/viewmodel/HistoryViewModel.kt`
- [Settings screen](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/screens/SettingsScreen.kt): `android/app/src/main/java/com/lizardlens/ui/screens/SettingsScreen.kt`
- [Settings view model](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/app/src/main/java/com/lizardlens/ui/viewmodel/SettingsViewModel.kt): `android/app/src/main/java/com/lizardlens/ui/viewmodel/SettingsViewModel.kt`

### Detection pipeline

- [Camera analyzer](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/CameraXImageAnalyzer.kt): `android/core/camera/src/main/java/com/lizardlens/core/camera/CameraXImageAnalyzer.kt`
- [Thermal manager](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/ThermalManager.kt): `android/core/camera/src/main/java/com/lizardlens/core/camera/ThermalManager.kt`
- [YUV converter](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/camera/src/main/java/com/lizardlens/core/camera/YuvConverter.kt): `android/core/camera/src/main/java/com/lizardlens/core/camera/YuvConverter.kt`
- [TFLite inference](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt): `android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt`
- [Image preprocessing](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/Preprocessor.kt): `android/core/inference/src/main/java/com/lizardlens/core/inference/Preprocessor.kt`
- [NMS processing](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/NmsProcessor.kt): `android/core/inference/src/main/java/com/lizardlens/core/inference/NmsProcessor.kt`
- [Inference configuration](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/inference/src/main/java/com/lizardlens/core/inference/InferenceConfig.kt): `android/core/inference/src/main/java/com/lizardlens/core/inference/InferenceConfig.kt`

### Persistence

- [Detection repository](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt): `android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`
- [Detection settings store](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionConfigStore.kt): `android/core/data/src/main/java/com/lizardlens/core/data/DetectionConfigStore.kt`
- [Room database](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt): `android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt`
- [Detection DAO](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionDao.kt): `android/core/data/src/main/java/com/lizardlens/core/data/DetectionDao.kt`
- [Detection records](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/DetectionEntity.kt): `android/core/data/src/main/java/com/lizardlens/core/data/DetectionEntity.kt`
- [Room converters](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/data/src/main/java/com/lizardlens/core/data/Converters.kt): `android/core/data/src/main/java/com/lizardlens/core/data/Converters.kt`

### Shared components

- [Detection model](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/model/src/main/java/com/lizardlens/core/model/Detection.kt): `android/core/model/src/main/java/com/lizardlens/core/model/Detection.kt`
- [Detection overlays](https://github.com/ahmadhassan011/lizarddetection/blob/main/android/core/ui/src/main/java/com/lizardlens/ui/composables/DetectionOverlays.kt): `android/core/ui/src/main/java/com/lizardlens/ui/composables/DetectionOverlays.kt`

### Other components

- **Field researcher**

## Connections

- Field researcher → App navigation: uses (evidence: `README.md`)
- App navigation → Camera screen: shows (evidence: `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`)
- App navigation → Image screen: routes to (evidence: `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`)
- App navigation → Video screen: routes to (evidence: `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`)
- App navigation → History screen: routes to (evidence: `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`)
- App navigation → Settings screen: routes to (evidence: `android/app/src/main/java/com/lizardlens/ui/LizardLensApp.kt`)
- Camera screen → Camera view model: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt`)
- Camera screen → Camera analyzer: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt`)
- Camera screen → Thermal manager: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/CameraScreen.kt`)
- Camera view model → Detection repository: requests detection (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/CameraViewModel.kt`)
- Camera view model → Thermal manager: checks heat (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/CameraViewModel.kt`)
- Image screen → Image detection: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/ImageScreen.kt`)
- Image detection → Detection repository: requests detection (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/ImageDetectionViewModel.kt`)
- Video screen → Video detection: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/VideoScreen.kt`)
- Video detection → Detection repository: requests detection (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/VideoDetectionViewModel.kt`)
- Video detection → YUV converter: converts frames (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/VideoDetectionViewModel.kt`)
- History screen → History view model: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/HistoryScreen.kt`)
- History view model → Detection repository: loads history (evidence: `android/app/src/main/java/com/lizardlens/ui/viewmodel/HistoryViewModel.kt`)
- Settings screen → Settings view model: uses (evidence: `android/app/src/main/java/com/lizardlens/ui/screens/SettingsScreen.kt`)
- Detection repository → Detection settings store: reads settings (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`)
- Detection repository → TFLite inference: runs inference (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`)
- Detection repository → Detection DAO: writes records (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`)
- Room database → Detection DAO: provides (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt`)
- Room database → Detection records: stores (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt`)
- Room database → Room converters: uses (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/AppDatabase.kt`)
- Detection DAO → Detection records: queries (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/DetectionDao.kt`)
- TFLite inference → Image preprocessing: preprocesses (evidence: `android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt`)
- TFLite inference → NMS processing: postprocesses (evidence: `android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt`)
- TFLite inference → Inference configuration: uses (evidence: `android/core/inference/src/main/java/com/lizardlens/core/inference/TfliteInferenceEngine.kt`)
- Detection repository → Detection model: returns detections (evidence: `android/core/data/src/main/java/com/lizardlens/core/data/DetectionRepository.kt`)
- Detection overlays → Detection model: renders (evidence: `android/core/ui/src/main/java/com/lizardlens/ui/composables/DetectionOverlays.kt`)
