# ain0633/libar architecture

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

- Interactive diagram: https://gitdiagram.com/ain0633/libar
- Repository: https://github.com/ain0633/libar

## Overview

LibAR is an on-device shelf-reading and book-finding application: a phone camera scan is processed into recognized call numbers, matched against a library catalog, and shown as shelf overlays. Patrons can also search for, locate, and discover recommended or popular books; librarians receive misplaced-book indications and can create inspection reports. The README documents the browser application and its major capabilities, but its app shell and catalog assets are absent from the supplied tree. Python pipeline nodes represent substantial research/runtime implementations; connections between those variants are shown only where excerpts or the source index support them.

Main entry points: [`libar-sample/webdemo`](https://github.com/ain0633/libar/tree/main/libar-sample/webdemo) (Browser app), [`libar-sample/libar_ondevice.py`](https://github.com/ain0633/libar/blob/main/libar-sample/libar_ondevice.py) (On-device logic), [`libar-sample/daelim_pipeline.py`](https://github.com/ain0633/libar/blob/main/libar-sample/daelim_pipeline.py) (Daelim pipeline), [`libar-sample/webdemo/libar_rec.js`](https://github.com/ain0633/libar/blob/main/libar-sample/webdemo/libar_rec.js) (Catalog matching)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["On-device experience"]
  node_webapp["Browser app"]
  node_overlay["AR overlays"]
  node_report["Inspection report"]
end

subgraph group_recognition["Shelf recognition"]
  node_detect["YOLO detection"]
  node_ocr["Call-number OCR<br/>[daelim_closeup.py]"]
  node_matching["Catalog matching<br/>[libar_rec.js]"]
  node_ordering["LIS ordering<br/>[libar_rec.js]"]
end

subgraph group_catalog["Catalog and discovery"]
  node_catalogdata[("Static catalog")]
  node_search["Book search"]
  node_recommend["Recommendations"]
  node_popular["Popular books"]
end

subgraph group_research["Python pipeline implementations"]
  node_detectmodule["Color label detector<br/>[daelim_detect.py]"]
  node_prototype["Photo pipeline<br/>[pipeline.py]"]
  node_daelimpipeline["Daelim pipeline<br/>[daelim_pipeline.py]"]
  node_ondevice["On-device logic<br/>[libar_ondevice.py]"]
  node_tester["Integrated tester<br/>[libar_tester.py]"]
  node_globaldecode["Global decoding<br/>[libar_global.py]"]
  node_columnassign["Column assignment"]
end

node_camera(("Phone camera"))
node_librarian(("Librarian"))
node_patron(("Library patron"))

node_camera -->|"provides frames"| node_webapp
node_webapp -->|"scans image"| node_detect
node_detect -->|"crops labels"| node_ocr
node_ocr -->|"reads call numbers"| node_matching
node_catalogdata -.->|"supplies records"| node_matching
node_matching -->|"checks shelf order"| node_ordering
node_ordering -->|"marks shelf"| node_overlay
node_webapp -->|"renders results"| node_overlay
node_patron -->|"searches books"| node_search
node_patron -->|"browses"| node_recommend
node_patron -->|"browses"| node_popular
node_search -->|"pins found book"| node_overlay
node_recommend -->|"pins selection"| node_overlay
node_popular -->|"pins selection"| node_overlay
node_librarian -->|"starts inspection"| node_webapp
node_webapp -->|"creates report"| node_report
node_report -->|"shows findings"| node_librarian
node_detectmodule -.->|"detects labels"| node_daelimpipeline
node_daelimpipeline -->|"uses LIS logic"| node_ondevice
node_tester -->|"uses pipeline"| node_prototype
node_globaldecode -->|"uses matching logic"| node_ondevice
node_columnassign -->|"uses catalog logic"| node_ondevice
node_daelimpipeline -->|"imports logic"| node_ondevice

click node_webapp "https://github.com/ain0633/libar/tree/main/libar-sample/webdemo"
click node_overlay "https://github.com/ain0633/libar/tree/main/libar-sample/webdemo"
click node_report "https://github.com/ain0633/libar/tree/main/libar-sample/webdemo"
click node_detect "https://github.com/ain0633/libar/blob/main/libar-sample/daelim_yolo_pipeline.py"
click node_ocr "https://github.com/ain0633/libar/blob/main/libar-sample/daelim_closeup.py"
click node_matching "https://github.com/ain0633/libar/blob/main/libar-sample/webdemo/libar_rec.js"
click node_ordering "https://github.com/ain0633/libar/blob/main/libar-sample/webdemo/libar_rec.js"
click node_catalogdata "https://github.com/ain0633/libar/tree/main/libar-sample"
click node_search "https://github.com/ain0633/libar/tree/main/libar-sample/webdemo"
click node_recommend "https://github.com/ain0633/libar/tree/main/libar-sample"
click node_popular "https://github.com/ain0633/libar/tree/main/libar-sample"
click node_detectmodule "https://github.com/ain0633/libar/blob/main/libar-sample/daelim_detect.py"
click node_prototype "https://github.com/ain0633/libar/blob/main/libar-sample/pipeline.py"
click node_daelimpipeline "https://github.com/ain0633/libar/blob/main/libar-sample/daelim_pipeline.py"
click node_ondevice "https://github.com/ain0633/libar/blob/main/libar-sample/libar_ondevice.py"
click node_tester "https://github.com/ain0633/libar/blob/main/libar-sample/libar_tester.py"
click node_globaldecode "https://github.com/ain0633/libar/blob/main/libar-sample/libar_global.py"
click node_columnassign "https://github.com/ain0633/libar/blob/main/libar-sample/ocr_column_assign.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_webapp,node_overlay,node_report toneBlue
class node_detect,node_ocr,node_matching,node_ordering toneAmber
class node_catalogdata,node_search,node_recommend,node_popular toneMint
class node_detectmodule,node_prototype,node_daelimpipeline,node_ondevice,node_tester,node_globaldecode,node_columnassign toneRose
class node_camera,node_librarian,node_patron toneIndigo
```

## Components

### On-device experience

- [Browser app](https://github.com/ain0633/libar/tree/main/libar-sample/webdemo): `libar-sample/webdemo`
- [AR overlays](https://github.com/ain0633/libar/tree/main/libar-sample/webdemo): `libar-sample/webdemo`
- [Inspection report](https://github.com/ain0633/libar/tree/main/libar-sample/webdemo): `libar-sample/webdemo`

### Shelf recognition

- [YOLO detection](https://github.com/ain0633/libar/blob/main/libar-sample/daelim_yolo_pipeline.py): `libar-sample/daelim_yolo_pipeline.py`
- [Call-number OCR](https://github.com/ain0633/libar/blob/main/libar-sample/daelim_closeup.py): `libar-sample/daelim_closeup.py`
- [Catalog matching](https://github.com/ain0633/libar/blob/main/libar-sample/webdemo/libar_rec.js): `libar-sample/webdemo/libar_rec.js`
- [LIS ordering](https://github.com/ain0633/libar/blob/main/libar-sample/webdemo/libar_rec.js): `libar-sample/webdemo/libar_rec.js`

### Catalog and discovery

- [Static catalog](https://github.com/ain0633/libar/tree/main/libar-sample): `libar-sample`
- [Book search](https://github.com/ain0633/libar/tree/main/libar-sample/webdemo): `libar-sample/webdemo`
- [Recommendations](https://github.com/ain0633/libar/tree/main/libar-sample): `libar-sample`
- [Popular books](https://github.com/ain0633/libar/tree/main/libar-sample): `libar-sample`

### Python pipeline implementations

- [Color label detector](https://github.com/ain0633/libar/blob/main/libar-sample/daelim_detect.py): `libar-sample/daelim_detect.py`
- [Photo pipeline](https://github.com/ain0633/libar/blob/main/libar-sample/pipeline.py): `libar-sample/pipeline.py`
- [Daelim pipeline](https://github.com/ain0633/libar/blob/main/libar-sample/daelim_pipeline.py): `libar-sample/daelim_pipeline.py`
- [On-device logic](https://github.com/ain0633/libar/blob/main/libar-sample/libar_ondevice.py): `libar-sample/libar_ondevice.py`
- [Integrated tester](https://github.com/ain0633/libar/blob/main/libar-sample/libar_tester.py): `libar-sample/libar_tester.py`
- [Global decoding](https://github.com/ain0633/libar/blob/main/libar-sample/libar_global.py): `libar-sample/libar_global.py`
- [Column assignment](https://github.com/ain0633/libar/blob/main/libar-sample/ocr_column_assign.py): `libar-sample/ocr_column_assign.py`

### Other components

- **Phone camera**
- **Librarian**
- **Library patron**

## Connections

- Phone camera → Browser app: provides frames (evidence: `README.md`)
- Browser app → YOLO detection: scans image (evidence: `README.md`)
- YOLO detection → Call-number OCR: crops labels (evidence: `README.md`)
- Call-number OCR → Catalog matching: reads call numbers (evidence: `README.md`)
- Static catalog → Catalog matching: supplies records (evidence: `README.md`)
- Catalog matching → LIS ordering: checks shelf order (evidence: `README.md`)
- LIS ordering → AR overlays: marks shelf (evidence: `README.md`)
- Browser app → AR overlays: renders results (evidence: `README.md`)
- Library patron → Book search: searches books (evidence: `README.md`)
- Library patron → Recommendations: browses (evidence: `README.md`)
- Library patron → Popular books: browses (evidence: `README.md`)
- Book search → AR overlays: pins found book (evidence: `README.md`)
- Recommendations → AR overlays: pins selection (evidence: `README.md`)
- Popular books → AR overlays: pins selection (evidence: `README.md`)
- Librarian → Browser app: starts inspection (evidence: `README.md`)
- Browser app → Inspection report: creates report (evidence: `README.md`)
- Inspection report → Librarian: shows findings (evidence: `README.md`)
- Color label detector → Daelim pipeline: detects labels (evidence: `libar-sample/daelim_pipeline.py`)
- Daelim pipeline → On-device logic: uses LIS logic (evidence: `libar-sample/daelim_pipeline.py`)
- Integrated tester → Photo pipeline: uses pipeline (evidence: `libar-sample/libar_tester.py`)
- Global decoding → On-device logic: uses matching logic (evidence: `libar-sample/libar_global.py`)
- Column assignment → On-device logic: uses catalog logic (evidence: `libar-sample/ocr_column_assign.py`)
- Daelim pipeline → On-device logic: imports logic (evidence: `libar-sample/daelim_pipeline.py`)
