|
| 1 | +# Barcode Benchmark App |
| 2 | + |
| 3 | +A PySide6 desktop application for benchmarking barcode-reading SDKs against annotated image datasets. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Drag & drop** images or folders onto the image viewer, or use the **Browse Files** button |
| 8 | +- **Load annotation JSON** (`barcode-benchmark/1.0` format) to enable ground-truth accuracy measurement |
| 9 | +- **Load a custom Dynamsoft template** (optional JSON) to override the default capture settings |
| 10 | +- **Select SDKs** — Dynamsoft Barcode Reader and/or ZXing-C++ |
| 11 | +- **Live progress** and per-file results table updated in real time during the benchmark |
| 12 | +- **Image viewer with annotation overlay** — after the benchmark, browse images with: |
| 13 | + - **Green polygons** = ground-truth barcode locations (from annotation JSON) |
| 14 | + - **Colored rectangles** = barcode locations detected by each SDK (one color per library) |
| 15 | + - Barcode text labels drawn next to each box |
| 16 | +- **Export HTML report** — self-contained file matching the web-app report layout, with aggregate summary and per-image detail tables |
| 17 | + |
| 18 | +## Folder Structure |
| 19 | + |
| 20 | +``` |
| 21 | +benchmark_app/ |
| 22 | +├── gui_benchmark.py # Main application entry point |
| 23 | +├── requirements.txt # Python dependencies |
| 24 | +├── config/ |
| 25 | +│ └── benchmark_config.json # SDK configuration (licenses, enabled flags) |
| 26 | +├── src/ |
| 27 | +│ ├── barcode_readers.py # DynamsoftBarcodeReader, ZXingCppReader |
| 28 | +│ └── benchmark_framework.py # BarcodeReaderInterface, BenchmarkResult, TestCase |
| 29 | +└── README.md |
| 30 | +``` |
| 31 | + |
| 32 | +## Requirements |
| 33 | + |
| 34 | +See [`requirements.txt`](requirements.txt). |
| 35 | + |
| 36 | +Install: |
| 37 | + |
| 38 | +```bash |
| 39 | +pip install -r requirements.txt |
| 40 | +``` |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +```bash |
| 45 | +python benchmark_app/gui_benchmark.py |
| 46 | +``` |
| 47 | + |
| 48 | +### Workflow |
| 49 | + |
| 50 | +1. **Add images** — drag & drop images / folders onto the viewer, or click **Browse Files**. |
| 51 | + Supports: JPG, PNG, BMP, TIFF, WebP. |
| 52 | +2. **Load Annotation JSON** *(optional)* — click the toolbar button to load a `barcode-benchmark/1.0` file exported from the annotation tool. The status badge shows `✓ N images, N barcodes`. |
| 53 | +3. **Load DBR Template** *(optional)* — load a custom Dynamsoft template JSON to override capture settings. |
| 54 | +4. **Select SDKs** — check one or more of: Dynamsoft, ZXing Cpp. |
| 55 | +5. **Run Benchmark** — the progress bar tracks each file; the Detailed Results table fills in real time. |
| 56 | +6. **Review results in the image viewer**: |
| 57 | + - Use **Prev / Next** or click any row in the Detailed Results table. |
| 58 | + - **Green polygons** show expected barcode positions from the annotation. |
| 59 | + - **Colored boxes** show what each SDK detected; each library uses a distinct color. |
| 60 | + - The text strip below the image lists detected values and GT match status. |
| 61 | +7. **Export HTML Report** — saves a self-contained HTML file with the same layout as the web-app benchmark report. |
| 62 | + |
| 63 | +## Annotation JSON Format |
| 64 | + |
| 65 | +The annotation JSON must follow the `barcode-benchmark/1.0` schema produced by the annotation tool: |
| 66 | + |
| 67 | +```json |
| 68 | +{ |
| 69 | + "format": "barcode-benchmark/1.0", |
| 70 | + "total_images": 5, |
| 71 | + "total_barcodes": 12, |
| 72 | + "images": [ |
| 73 | + { |
| 74 | + "file": "IMG_001.jpg", |
| 75 | + "barcodes": [ |
| 76 | + { |
| 77 | + "text": "1234567890", |
| 78 | + "format": "Code128", |
| 79 | + "points": [[x1,y1], [x2,y2], [x3,y3], [x4,y4]] |
| 80 | + } |
| 81 | + ] |
| 82 | + } |
| 83 | + ] |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +`text` is used for accuracy matching; `points` are used to draw the ground-truth overlay polygon on the image. |
| 88 | + |
| 89 | +## Configuration |
| 90 | + |
| 91 | +Edit `config/benchmark_config.json` to set SDK license keys and enable/disable libraries: |
| 92 | + |
| 93 | +```json |
| 94 | +{ |
| 95 | + "libraries": { |
| 96 | + "dynamsoft": { "enabled": true, "license": "YOUR_LICENSE_KEY" }, |
| 97 | + "zxing_cpp": { "enabled": true, "options": {} } |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +You can also update the Dynamsoft license through the **SDK Settings** dialog inside the app. |
| 103 | + |
0 commit comments