An end-to-end pipeline for automated analysis of bridge structural damage (rebar exposure, cracks, corrosion) using LLaVA (Large Language and Vision Assistant). The system generates expert-level damage descriptions from images and produces structured prioritization scores for repair planning.
Python
1
18 commits
updated Jun 3, 2026
Progressive Fine-Tuning of LLaVA-1.5-7B with Quality Guard Agent for Bridge Damage Analysis and Repair Priority Scoring
๐ ๆฅๆฌ่ช็ใใญใฅใกใณใ (Japanese Documentation)
An end-to-end pipeline for automated analysis of bridge structural damage (rebar exposure, cracks, corrosion) using LLaVA (Large Language and Vision Assistant). The system generates expert-level damage descriptions from images and produces structured prioritization scores for repair planning.
graph TB
A[Input Images<br/>254 Bridge Damage Photos] --> B[Preprocessing<br/>Denoise/Resize/Contrast]
B --> C[Vision Analysis<br/>LLaVA-1.5-7B GGUF]
C --> D[JSON Structuring<br/>Swallow-8B]
D --> E[Priority Scoring<br/>Rule-Based Engine]
E --> F[Output<br/>CSV/JSON Reports]
style A fill:#e1f5ff
style C fill:#fff4e1
style E fill:#ffe1e1
style F fill:#e1ffe1
flowchart LR
subgraph Input["๐ Input Stage"]
A1[Raw Images<br/>PNG/JPG]
end
subgraph Preprocess["๐ง Preprocessing"]
B1[Noise Reduction<br/>NL-Means]
B2[Resize<br/>Max 1024x1024]
B3[Contrast<br/>CLAHE]
end
subgraph Vision["๐๏ธ Vision Analysis"]
C1[Image Encoding<br/>CLIP Vision]
C2[LLaVA Inference<br/>Q4_K_M Quantized]
C3[Damage Description<br/>Japanese Text]
end
subgraph Structure["๐ Structuring"]
D1[Swallow-8B LLM<br/>via Ollama]
D2[JSON Parsing<br/>Multi-Pattern]
D3[Structured Data<br/>Type/Severity/Location]
end
subgraph Score["๐ฏ Scoring"]
E1[Rule Evaluation<br/>40% Severity<br/>35% Type<br/>15% Location<br/>10% Risk]
E2[Priority Calculation<br/>0.0-1.0 Score]
E3[Level Assignment<br/>1-5 Priority]
end
subgraph Output["๐พ Output"]
F1[CSV Export<br/>Batch Results]
F2[JSON Export<br/>Detailed Records]
end
A1 --> B1 --> B2 --> B3
B3 --> C1 --> C2 --> C3
C3 --> D1 --> D2 --> D3
D3 --> E1 --> E2 --> E3
E3 --> F1
E3 --> F2
style Input fill:#e1f5ff
style Vision fill:#fff4e1
style Score fill:#ffe1e1
style Output fill:#e1ffe1
| Stage | Module | Purpose | Technology |
|---|---|---|---|
| Preprocessing | image_preprocessor.py | Image quality enhancement | OpenCV 4.12 |
| Vision Analysis | llama_cpp_vision.py | Damage description generation | LLaVA-1.5-7B Q4_K_M (4GB) |
| Structuring | json_structurer.py | Natural language โ JSON | Swallow-8B (Ollama) |
| Scoring | priority_scorer.py | Repair priority calculation | Rule-based (YAML) |
| Pipeline | end_to_end.py | Orchestration | Python 3.12 |
Processing Time Breakdown (per image):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Preprocessing: ~2s (4%) โ
โ Vision Analysis: ~42s (81%) โ
โ JSON Structuring: ~5s (10%) โ
โ Scoring: <1s (2%) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Total: ~51.6 seconds/image โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3 Vision Modes Implemented
Complete Pipeline
Validation Tests
Windows Encoding Issues Resolved
Comprehensive evaluation of LLaVA-1.5-7B quantization levels (Q4_K_M, Q5_K_M, Q8_0) to determine the optimal balance between accuracy, speed, and model size for bridge damage assessment.
Developed a 5-point quality scoring system (v0.2 design) to assess damage description completeness:
| Component | Max Points | Criteria |
|---|---|---|
| Damage Types | 2.0 | Recognition of crack, rebar exposure, corrosion, spalling, section loss |
| Severity Level | 1.0 | Minor, moderate, severe classification |
| Location Info | 1.0 | Spatial information (top, bottom, left, right, etc.) |
| Extent Info | 1.0 | Coverage description (local, widespread, partial, etc.) |
| Total | 5.0 | Comprehensive damage assessment score |
| Quantization | Model Size | Init Time | Avg Inference | Quality Score | Text Length | Success Rate |
|---|---|---|---|---|---|---|
| Q4_K_M | 4.1GB | 3.6s | 5.43s | 2.93 ยฑ 1.53 | 168 ยฑ 41 | 254/254 (100%) |
| Q5_K_M โญ | 4.8GB | 4.5s | 5.67s | 3.18 ยฑ 1.35 | 160 ยฑ 37 | 254/254 (100%) |
| Q8_0 | 7.2GB | 5.9s | 7.63s | 3.27 ยฑ 1.39 | 162 ยฑ 39 | 254/254 (100%) |
Performance Comparison:

Figure 1: Performance metrics across quantization levels (N=254). Shows average inference time, model size vs total time, quality score comparison, and summary statistics.
๐ English Version | Japanese Version

Figure 2: Comprehensive statistical analysis including violin plots (quality, text length, inference time), box plots, scatter plots (quality vs text length/inference time), and detailed statistics table.
Violin Plot Analysis:
Statistical Significance (Mann-Whitney U Test):
| Quantization | Correlation Coefficient | Interpretation |
|---|---|---|
| Q4_K_M | -0.559 | Moderate negative (longer โ lower quality) |
| Q5_K_M | -0.148 | Weak negative (stable across lengths) |
| Q8_0 | -0.393 | Moderate negative |
Insight: Q5_K_M maintains consistent quality regardless of description length, indicating robust performance.
Speed-Quality Efficiency:
Q4_K_M: 0.54 quality/sec (2.93 / 5.43)
Q5_K_M: 0.56 quality/sec (3.18 / 5.67) โ BEST โญ
Q8_0: 0.43 quality/sec (3.27 / 7.63)
Best Quality-Speed Balance
Stable Performance
Resource Efficiency
| Priority | Quantization | Use Case |
|---|---|---|
| ๐ฅRecommended | Q5_K_M | Production deployment (best balance) |
| ๐ฅ Alternative | Q8_0 | High-accuracy applications (if speed is not critical) |
| ๐ฅ Development | Q4_K_M | Fast prototyping only |
For Bridge Damage Assessment:
Quantization is Not Free
Sweet Spot Exists
Statistical Validation is Essential
GPU Compatibility Matters
Quality Metrics Enable Optimization
Prepare high-quality training datasets from n=10,789 bridge damage images for progressive QLoRA fine-tuning of LLaVA-1.5-7B to improve damage description quality from 3.18/5.0 โ 4.5+/5.0.
Completion Date: 2026-05-22
Rank_c_image_text_n10789.xlsxText Length: 15-500 characters
Excluded Patterns:
- Empty or whitespace only
- Question marks only ("???")
- "ใชใ" (none), "่ฉฒๅฝใชใ" (not applicable)
Required Keywords (at least one):
Damage Types: ใฒใณๅฒใ, ใฏใฉใใฏ, ้็ญ, ่
้ฃ, ๅฅ้ข, ๅฃๅ
Components: ๆก, ๅบ็, ๆฏๆฟ, ๆฉ่, ใณใณใฏใชใผใ
Severity: ่ใใ, ้ก่, ้ฒ่ก, ่ปฝๅพฎ
Expected Retention Rate: ~70-80% (7,600-8,600 images passing filters)
Purpose: Maintain representative distribution of component types and damage types across all datasets.
Methodology:
component_type ร damage_typeseed=42 for reproducibilityBenefits:
| Split | Size | Seed | Purpose |
|---|---|---|---|
| Test Set | 800 | 42 | Fixed evaluation set (never used in training) |
| Train 1k | 1,000 | 42+1000 | Initial fine-tuning baseline |
| Train 2k | 2,000 | 42+2000 | Scaling experiment (2x data) |
| Train 3k | 3,000 | 42+3000 | Scaling experiment (3x data) |
| Train 4k | 4,000 | 42+4000 | Maximum scale experiment |
Note: Each training set is independently sampled (not cumulative) to measure pure dataset size effects.
prepare_v03_dataset.pyFeatures:
Usage:
# Activate virtual environment (training)
.\.venv-train\Scripts\Activate.ps1
# Run dataset preparation
python prepare_v03_dataset.py
Output Files:
data/v03_fine_tuning/
โโโ test_set_n800.csv # Fixed test set
โโโ train_1k.csv # 1,000 training samples
โโโ train_2k.csv # 2,000 training samples
โโโ train_3k.csv # 3,000 training samples
โโโ train_4k.csv # 4,000 training samples
โโโ dataset_preparation_report.md # Statistics & distribution analysis
CSV Format:
ใใกใคใซใใน,ๆ่ฆ,component_type,damage_type,text_length
rank_c_images_n10789/IMG_0001.jpg,"ๅบ็ไธ้ขใซ้ก่ใชใฒใณๅฒใ...",ๅบ็,ใฒใณๅฒใ,85
Measure Dataset Size Impact
Detect Overfitting Threshold
Resource Planning
Ablation Study
Completion Date: 2026-05-23
Training Period: 2026-05-22 01:59 - 2026-05-23 00:17 (Total: ~15 hours)
Execute progressive QLoRA fine-tuning of LLaVA-1.5-7B across four dataset scales (1k, 2k, 3k, 4k samples) to measure dataset size impact on model performance and identify the optimal training data volume.
| Stage | Dataset | Training Time | Train/Val Samples | Final Val Loss | Best Checkpoint | Loss Improvement |
|---|---|---|---|---|---|---|
| v0.4.1 | 1k | 1:22:57 | 799 / 200 | 3.135 | checkpoint-100 | - (baseline) |
| v0.4.2 | 2k | 2:55:37 | 1,599 / 400 | 3.073 | checkpoint-300 | โ 1.98% |
| v0.4.3 | 3k | 4:31:44 | 2,398 / 600 | 3.073 | checkpoint-400 | โ 0.00% |
| v0.4.4 | 4k | 6:19:10 | 3,196 / 799 | 3.067 | checkpoint-600 | โ 0.20% |
Performance Plateau at 2k-3k Range
Optimal Model: 2k Samples (v0.4.2)
Diminishing Returns
Base Model: llava-hf/llava-1.5-7b-hf
Quantization: 4-bit NF4 with double quantization
LoRA Parameters:
rank: 32
alpha: 64
dropout: 0.05
target_modules: [q_proj, v_proj, k_proj, o_proj, gate_proj, up_proj, down_proj]
Training Hyperparameters:
batch_size: 4
gradient_accumulation_steps: 4 # Effective batch size: 16
learning_rate: 2e-4
num_epochs: 3
warmup_steps: 50
max_grad_norm: 1.0
weight_decay: 0.01
optimizer: AdamW
lr_scheduler: cosine
mixed_precision: fp16
Hardware:
GPU: NVIDIA GeForce RTX 4060 Ti 16GB
CUDA: 12.4
PyTorch: 2.6.0
Validation Loss
3.14 โค
โ 1k โ
3.12 โค โฒ
โ โฒ
3.10 โค โฒ 2k โโโโโโโโโโโโโโโโโโโ (plateau)
โ 3k 4k
3.08 โค
โ
3.06 โค โ
โ 4k
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1k 2k 3k 4k
models/
โโโ llava_v03_qlora_1k/ # 134.5 MB (v0.4.1) โ
โโโ llava_v03_qlora_2k/ # 134.5 MB (v0.4.2) โ
Recommended
โโโ llava_v03_qlora_3k/ # 134.5 MB (v0.4.3) โ
โโโ llava_v03_qlora_4k/ # 134.5 MB (v0.4.4) โ
See Result_QLoRA_Scale.md for:
Completion Date: 2026-05-24
Evaluation Period: 2026-05-23 - 2026-05-24
Comprehensive evaluation of all 4 QLoRA fine-tuned models (1k/2k/3k/4k) using semantic similarity metrics and creation of publication-quality visualizations for ACVR 2026 paper submission.
Replaced simple quality scoring with Japanese Sentence-BERT cosine similarity:
sonoisa/sentence-bert-base-ja-mean-tokens-v2| Tier | Similarity Range | Interpretation |
|---|---|---|
| Excellent | ฯ โฅ 0.85 | Near-perfect match |
| Good | 0.75 โค ฯ < 0.85 | High quality, minor differences |
| Acceptable | 0.65 โค ฯ < 0.75 | Adequate, usable |
| Poor | 0.50 โค ฯ < 0.65 | Significant gaps |
| Very Poor | ฯ < 0.50 | Unacceptable quality |
| Model | Mean ยฑ Std | Median | Min | Max | Tier |
|---|---|---|---|---|---|
| 1k | 0.6491 ยฑ 0.0875 | 0.6536 | 0.0809 | 0.8462 | Acceptable |
| 2k | 0.6850 ยฑ 0.0814 | 0.6933 | 0.0809 | 0.8526 | Acceptable |
| 3k | 0.6909 ยฑ 0.0784 | 0.7081 | 0.0809 | 0.8540 | Acceptable+ |
| 4k | 0.6739 ยฑ 0.0795 | 0.6808 | 0.0809 | 0.8492 | Acceptable |
| Model | Excellent | Good | Acceptable | Poor | Very Poor |
|---|---|---|---|---|---|
| 1k | 0.0% | 11.9% | 40.0% | 42.9% | 5.2% |
| 2k | 0.1% | 20.8% | 50.6% | 26.2% | 2.2% |
| 3k | 0.0% | 21.0% | 48.9% | 27.6% | 2.5% |
| 4k | 0.0% | 15.9% | 51.9% | 32.1% | 0.1% |
Cosine Similarity
0.70 โค โญโโโ 3k (Peak)
โ โฑ โฒ
0.68 โค โ โฒโ 4k (Degradation)
โ โฑ 2k โฒ
0.66 โค โฑ โฒ
โ โ โฒ
0.64 โค 1k
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
1k 2k 3k 4k
Observation: Semantic similarity improves from 1kโ2k (+5.5%) โ 3k (+0.9%), but degrades at 4k (-2.5%).
Evidence:
Hypothesis: Additional data introduces label noise or vocabulary saturation.
Created 5 comprehensive figures for ACVR 2026 paper:

Bar chart comparing mean cosine similarity across all 4 models with error bars (ยฑ1ฯ).

100% stacked bar chart showing quality tier proportions per model.

Grouped bar chart enabling direct comparison within each quality tier.

Distribution visualization showing density concentration (2k/3k near Good/Acceptable boundaries).

Comprehensive statistical summary with mean/std/min/max/median and tier percentages.
Submitted to: ACVR 2026 (Asian Conference on Computer Vision and Robotics)
Paper: methodology.tex
Total Pages: 16 pages
Figures: 7 figures (including Validation Loss curve)
Loss-Based Early Stopping Limitation
4k model achieves lowest validation loss (3.067) but worst test performance (0.6739) โ highlights need for domain-specific metrics beyond perplexity.
Mid-Scale Training Advantage
2k-3k range achieves optimal quality-cost balance, challenging "more data = better" assumption in specialized domains.
Overfitting in Low-Resource Domains
Vocabulary saturation and label noise become dominant factors beyond ~3k samples for Japanese bridge damage terminology.
Script: train_v03_qlora.py
QLoRA Configuration:
Base Model: llava-hf/llava-1.5-7b-hf
Quantization: 4-bit NF4 with double quantization
LoRA Parameters:
rank: 32
alpha: 64
dropout: 0.05
target_modules: [q_proj, v_proj, k_proj, o_proj, gate_proj, up_proj, down_proj]
Training Hyperparameters:
batch_size: 4
gradient_accumulation_steps: 4 # Effective batch size: 16
learning_rate: 2e-4
num_epochs: 3
optimizer: AdamW
lr_scheduler: cosine with warmup (50 steps)
mixed_precision: fp16
Training Stages:
# Stage 1: 1k samples (~2-4 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_1k.csv --output-dir models/llava_v03_qlora_1k
# Stage 2: 2k samples (~4-8 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_2k.csv --output-dir models/llava_v03_qlora_2k
# Stage 3: 3k samples (~6-12 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_3k.csv --output-dir models/llava_v03_qlora_3k
# Stage 4: 4k samples (~8-16 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_4k.csv --output-dir models/llava_v03_qlora_4k
Expected Output:
Script: src/evaluation/vector_similarity_evaluator.py
Evaluation Method:
Quality Thresholds:
Excellent: โฅ0.85
Good: โฅ0.75
Acceptable: โฅ0.65
Poor: โฅ0.50
Very Poor: <0.50
Usage:
# Evaluate single model
python -m src.evaluation.vector_similarity_evaluator \
--csv inference_1k_results.csv \
--gt-col "ๆ่ฆ" \
--pred-col "prediction" \
--output data/v03_fine_tuning/evaluations/evaluation_train_1k.json
# Generate progressive training report
python create_progressive_training_report.py \
--eval-dir data/v03_fine_tuning/evaluations \
--output-dir data/v03_fine_tuning/reports
Expected Improvements:
| Metric | v0.2 (Q5_K_M) | v0.3 Target | Improvement |
|---|---|---|---|
| Mean Cosine Similarity | 0.68-0.72 | 0.78-0.85 | +15-20% |
| Quality Distribution (โฅ0.75) | ~45% | 70-80% | +55-78% |
| Standard Deviation | 0.18-0.22 | 0.12-0.16 | Better consistency |
Target: arXiv preprint submission
Paper Structure:
LaTeX Source: paper_damage_vlm/0_Format_arXiv_pdfLaTex/bridge_damage_vlm_quantization_2026.tex
| Phase | Status | Completion Date |
|---|---|---|
| v0.1: Baseline Pipeline | โ Complete | 2025-12 |
| v0.2: Quantization Study | โ Complete | 2026-03 |
| v0.3: Dataset Preparation | โ Complete | 2026-05-22 |
| v0.4: QLoRA Training | โ Complete | 2026-05-23 |
| v0.5.1: Evaluation & Visualization | โ Complete | 2026-05-24 |
| v0.6.3: Quality Guard + Full Pipeline | โ Complete | 2026-05-25 |
| v0.7.1: Image Size Optimization | โ Complete | 2026-05-26 |
| v0.7.2: pairdata_v2 Progressive Retraining | โ Complete | 2026-05-27 |
| v0.7.3: Quality Guard Recalibration & Full Pipeline | โ Complete | 2026-05-28 |
| v0.7.4: 2048-Dimensional Composite Embedding Evaluation | โ Complete | 2026-05-29 |
| v0.7.5: 2k Pipeline Evaluation & Supplementary Paper Update | โ Complete | 2026-05-29 |
| v0.8: pairdata_v3 QLoRA Rank Ablation (r=16/32/64) | โ Complete | 2026-05-30 |
| v0.8.1: DoRA vs. LoRA Comparison (r=64) | โ Complete | 2026-05-30 |
| v0.8.2: Embedding Eval + QG Assessment โ LoRA r=32 Adopted | โ Complete | 2026-05-31 |
| v0.8.3: U.7 Qualitative Analysis Full Update (pairdata v3) | โ Complete | 2026-05-31 |
| v0.8.4: DoRA Rank Ablation Study (r=16/32 vs LoRA r=32) | โ Complete | 2026-06-01 |
| v0.8.5: DoRA r=24 Final Rank Ablation & v1.0.0 Model Selection | โ Complete | 2026-06-02 |
Completion Date: 2026-05-25
Evaluation: Full n=800 test set (v0.6.3 pipeline, 3k model)
v0.6.3 introduces a two-stage Quality Guard Agent that filters low-quality VLM outputs before priority scoring, completing the end-to-end production pipeline:
Image โ LLaVA-1.5-7B (3k QLoRA) โ Quality Guard (Stage 1 + 2) โ Priority Scorer โ Report
| Rule | Threshold | Reject Code |
|---|---|---|
| Token count below minimum | ฮธ_low = 98 (5th percentile) | short_description |
| Token count above maximum | ฮธ_high = 202 (95th percentile) | dirty_or_noisy |
| Excessive repetition (โฅ 3 repeated n-grams) | โ | dirty_or_noisy |
| No damage keyword present | โ | dirty_or_noisy |
| Image file missing | โ | no_such_file |
Token counting uses CJK + ASCII tokenization to correctly handle Japanese text.
Applies natural-language judgement to Stage 1 PASS outputs as a second verification layer. Empirical result: Stage 2 produced 0 additional rejections for the 3k model โ the rule-based Stage 1 alone was sufficient.
| Metric | Value | % |
|---|---|---|
| Total images | 800 | 100.0% |
| PASS (High Quality) | 727 | 90.9% |
| FAIL โ Dirty or Noisy | 36 | 4.5% |
| FAIL โ Short description | 35 | 4.4% |
| FAIL โ No such file | 2 | 0.2% |
| Stage 2 additional rejections | 0 | โ |
| End-to-end throughput | 8.97 s/row | โ |
| Total elapsed | 7,178 s (โ 2.0 h) | โ |
| Metric | Value |
|---|---|
| Priority Level | All Level 3 (100%) |
| Priority Score | 0.54 (uniform) |
| Cosine Similarity (median) | 0.705 (Good tier boundary) |
| Token Count (median) | 120 tokens |
Finding โ Output Mode Collapse: The 3k model generates near-identical descriptions for all PASS images. Main Girder is mentioned in 100% of predictions; Rebar Exposure in 99.6%; Spalling in 98.6%. This stereotyped output pattern causes uniform priority scores (Level 3 saturation). See paper_damage_vlm/1_Methodology/methodology.tex for full analysis.
| Metric | PASS (n=727) | FAIL (n=73) |
|---|---|---|
| Cosine similarity (median) | 0.705 | 0.659 |
| Token count (median) | 120 | 97 โ ฮธ_low |
The Quality Guard preferentially retains predictions with higher semantic alignment โ even though the filter is defined only on output-text properties, it acts as a proxy for semantic quality.
| Figure | Description |
|---|---|
figures_vlm/10_priority_score_violin.png | Priority score saturation + PASS vs FAIL cosine similarity + token count violin |
figures_vlm/10_member_damage_analysis.png | Member/damage frequency bars + co-occurrence heatmap |
pipeline_v063.py โ Full end-to-end v0.6.3 pipelinecreate_figures_10.py โ Analysis figures for n=800 resultsdata/v03_fine_tuning/evaluations/v063_scoring_results.csv (800 rows, 22 columns)The academic paper (paper_damage_vlm/1_Methodology/methodology.tex) is complete with all v0.6.3 results:
Completion Date: 2026-05-25
Experiment: Controlled comparison of 3 input image datasets at 1k scale
LLaVA-1.5-7B uses a CLIP ViT-L/14-336 vision encoder pretrained at 336ร336 px. Feeding images at arbitrary sizes forces internal rescaling and introduces resampling artifacts into the patch embeddings, potentially degrading fine-tuning quality. This experiment quantifies the impact of pre-standardising training images to the model's native resolution.
| Step | Description | Output |
|---|---|---|
| 1 | Long-side resize to 1024 px (aspect-ratio preserved) | data/inspect_images_v2/ โ 10,789 images |
| 2 | Manual removal of blueprints / blank / corrupted images | 10,668 images remain (121 removed) |
| 3a | Center-crop to square โ resize to 336ร336 | data/inspect_images_336/ โ 10,668 images, ~0.034 MB avg |
| 3b | Center-crop to square โ resize to 448ร448 | data/inspect_images_448/ โ 10,668 images, ~0.060 MB avg |
Center-crop (rather than pad-and-resize) was chosen because bridge damage photos are mixed portrait/landscape. Padding introduces black borders that divert the vision encoder's attention from damage regions.
| Dataset | Image Source | Image Size | Training Time | eval_loss | eval Token Accuracy |
|---|---|---|---|---|---|
| pairdata_v2-1 | rank_c_images_n10789 | Variable (original) | 1:34:53 | 3.189 | 89.5% |
| pairdata_v2-2 | inspect_images_336 | 336ร336 px | 1:21:46 | 3.194 | 90.1% |
| pairdata_v2-3 | inspect_images_448 | 448ร448 px | 1:21:57 | 3.202 | 89.9% |
All runs:
train_v07_qlora.py, LoRA r=32/ฮฑ=64, LR=2e-4, batch_size=4, BF16, RTX 4060 Ti 16GB
336ร336 px is the optimal input size for LLaVA-1.5-7B fine-tuning on bridge damage images:
config.yaml and train_v07_qlora.py now default to data/inspect_images_336/:
# config.yaml โ v0.7.1
v03_dataset:
image_dir: "data/inspect_images_336" # 336ร336 center-crop (LLaVA-1.5 native)
# image_dir: "data/inspect_images_448" # 448ร448 alternative
# image_dir: "data/inspect_images_v2" # max 1024px long side (original)
resize_images_v2.py โ Step 1: long-side 1024 px resizecrop_resize_images.py โ Steps 3a/3b: center-crop + resize to 336 and 448train_v07_qlora.py โ Added --image-base-dir CLI option for dataset switchingCompletion Date: 2026-05-27
Scope: Full progressive QLoRA retraining on denoised pairdata_v2 with inspect_images_336
1k, 2k, 3k, 4k) under a fixed training recipepaper_damage_vlm/1_Methodology/figures_vlm/11_s4_validation_loss_pairdata_v2.png| Scale | Train | Val | Skip | Duration | Final eval_loss | Final eval Token Accuracy |
|---|---|---|---|---|---|---|
| 1k | 792 | 198 | 10 | 1h 21m | 3.194 | 90.1% |
| 2k | 1579 | 395 | 26 | 2h 56m | 3.151 | 98.7% |
| 3k | 2374 | 594 | 32 | 4h 24m | 3.135 | 99.0% |
| 4k | 3168 | 792 | 40 | 5h 55m | 3.125 | 99.2% |
1k -> 2k (-0.043 nats eval loss, +8.6 pp token accuracy)2k -> 3k: -0.016 nats, +0.3 pp3k -> 4k: -0.010 nats, +0.2 pp3.124), then slightly increases at epoch 3 (3.125), suggesting near-convergenceTest set: n=800, pairdata-v2 ground truth
Evaluator: paraphrase-multilingual-MiniLM-L12-v2 (cosine similarity)
Tier thresholds: Excellent โฅ 0.85 ยท Good โฅ 0.70 ยท Acceptable โฅ 0.55 ยท Poor โฅ 0.40 ยท Very Poor < 0.40
| Scale | Mean ฯ | ฯ | Median | Good+ (%) | V.Poor (%) |
|---|---|---|---|---|---|
| 1k | 0.5657 | 0.1573 | 0.5916 | 35.2 | 32.9 |
| 2k | 0.6011 | 0.1367 | 0.6137 | 40.6 | 21.9 |
| 3k โ | 0.6013 | 0.1437 | 0.6213 | 39.8 | 21.5 |
| 4k | 0.5742 | 0.1398 | 0.6014 | 33.8 | 28.2 |
All four models fall in the Acceptable tier under pairdata-v2 thresholds.
Absolute values are ~0.08โ0.09 lower than pairdata-v1 results, reflecting the harder matching task of shorter denoised ground-truth texts.
Key findings:
1k โ 2k: +6.3% mean gain (largest improvement)2k โ 3k: ฮฯ = 0.0002 (saturation)4k: โ4.5% from 3k (overfitting: VPoor rises 21.5% โ 28.2%)Model selected: 3k
Rationale: peak mean (0.6013) + highest median (0.6213) + lowest Very Poor rate (21.5%).
Result is consistent with pairdata-v1 finding where 3k also achieved peak performance (ฯ = 0.6909).
Figures generated:
paper_damage_vlm/1_Methodology/figures_vlm/12_v072_similarity_by_scale.pngpaper_damage_vlm/1_Methodology/figures_vlm/13_v072_tier_distribution.pngpaper_damage_vlm/1_Methodology/figures_vlm/14_v072_cosine_violin.png.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 1k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 2k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 3k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 4k
paper_damage_vlm/1_Methodology/methodology.tex (ๆฌ็ทจใฎใฟใSupplementaryๅ้ขๆธใฟ)paper_damage_vlm/1_Methodology/methodology_supp.tex (Supplementary ็ฌ็ซใใกใคใซใS.6็ต่ซๅซใ)paper_damage_vlm/1_Methodology/methodology.pdf (23 pages, recompiled)paper_damage_vlm/1_Methodology/methodology_supp.pdf (7 pages, recompiled)Completion Date: 2026-05-30
Scope: pairdata_v3 denoising; LoRA rank ablation r=16/32/64 at 2,500-sample scale; Supplementary 2 full documentation
| Run | r | eval_loss (best) | token_acc (best) | train_loss | Duration |
|---|---|---|---|---|---|
| v0.8-r16 | 16 | 3.138 | 98.73% | 3.567 | 3h24m |
| v0.8-r32 | 32 | 3.133 | 98.83% | 3.489 | 5h36m |
| v0.8-r64 | 64 | 3.122 | 98.90% | 3.419 | 3h27m |
All best checkpoints at epoch 2.421 of 3.
r=64 selected as optimal: 168.8M trainable parameters (4.56% of 7B backbone) provide sufficient representation space to learn the fine-grained correspondence between complex damage imagery and structured recognition text (member type ร damage category). r=16/32 (42M/84M) leave a residual alignment gap. Critically, r=64 adds no measurable GPU cost over r=16 (3h24m vs 3h27m on RTX 4060 Ti 16GB).
Completion Date: 2026-05-30
Scope: DoRA fine-tuning (use_dora=True, r=64) on pairdata_v3 2,500 samples; U.8 Supplementary 2 fully documented
| Run | Adapter | eval_loss (best) | token_acc (best) | train_loss | Duration | ฮeval |
|---|---|---|---|---|---|---|
| v0.8-r64 | LoRA | 3.122 | 98.90% | 3.419 | 3h27m | โ |
| v0.9-r64 | DoRA | 3.119 | 98.92% | 3.417 | 6h51m | โ0.003 |
Best checkpoints at epoch 2.421; final-epoch: LoRA 3.132/98.93%, DoRA 3.132/98.95%.
| # | Question | Result |
|---|---|---|
| (i) | DoRA lower eval_loss than LoRA at same r? | โ 3.119 < 3.122 (ฮ=โ0.003) |
| (ii) | Cosine similarity improvement? | ๐ Pending inference on n=800 test set |
| (iii) | Hallucination reduction? | ๐ Pending inference on n=800 test set |
train_v09_dora.py --lora-r 64# DoRA training
.venv-train\Scripts\Activate.ps1
python -u train_v09_dora.py --lora-r 64 *> v09_dora_r64_log.txt
# Output: models/llava_v09_dora_r64_2500
# Recompile Supplementary 2
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-05-31
Scope: 2048-dim Sentence-BERT evaluation of all 4 adapters on n=800 test set; Quality Guard + Priority Scoring for LoRA r=32 and DoRA r=64; Structural Member & Damage Type analysis; final model selection
| Model | Adapter | Mean Cosine | Median Cosine | Good+ Rate | Excellent Rate |
|---|---|---|---|---|---|
| v0.8-r16 | LoRA r=16 | 0.6464 | 0.6480 | 18.9% | 0.0% |
| v0.8-r32 | LoRA r=32 | 0.6700 | 0.6689 | 32.9% | 0.0% |
| v0.8-r64 | LoRA r=64 | 0.6571 | 0.6606 | 28.4% | 0.0% |
| v0.9-r64 | DoRA r=64 | 0.6846 | 0.6835 | 41.0% | 0.0% |
Embedding model: hotchpotch/static-embedding-japanese (1024-dim) โ intfloat/multilingual-e5-large (1024-dim), L2-normalized concatenation.
| Model | PASS | FAIL | Token Mean | Token ฯ | Level 3 | Level 4 | Level 5 |
|---|---|---|---|---|---|---|---|
| LoRA r=32 (v0.8) | 798 (99.8%) | 2 (0.2%) | 89.5 | 18.9 | 8.0% | 79.2% | 12.8% |
| DoRA r=64 (v0.9) | 798 (99.8%) | 2 (0.2%) | 84.3 | 4.5 | 0.0% | 100% | 0.0% |
ฮธ_low=30, ฮธ_high=200 (retained from v0.7.3).
| # | Finding | Detail |
|---|---|---|
| (i) | DoRA r=64: highest embedding score | Mean cosine 0.6846, Good+ 41.0% โ best among all adapters |
| (ii) | DoRA r=64: output-level mode collapse | Token ฯ=4.5 (vs LoRA 18.9); all 798 PASS โ Level 4 (100%) |
| (iii) | DoRA r=64: structural member/damage collapse | Main Girder+Deck Slab 100%, Crack/Rebar/Spalling 100% โ stereotyped template |
| (iv) | LoRA r=32: balanced severity distribution | Level 3โ (8.0% vs v0.7.3-3k 2.7%); Level 3/4/5 distribution improves fairness |
| (v) | DoRA r=64 fine-tuning failed | r=64 likely excessive for DoRA; fine-tuning protocol to be established as future work |
| (vi) | LoRA r=32 (v0.8) adopted as final model | Best balance of embedding quality and output diversity |
| Model | Main Girder | Curb | Deck Slab | Crack | Rebar Exp. | Spalling | Lime Effl. |
|---|---|---|---|---|---|---|---|
| LoRA r=32 | 100% | 60.0% | 9.9% | 100% | 88.1% | 99.0% | 73.9% |
| DoRA r=64 | 100% | 0% | 100% | 100% | 100% | 100% | 0% |
DoRA r=64 assigns exactly 3 damage types to exactly 2 members across all 798 predictions: clear evidence of fine-tuning failure.
| Figure | File | Content |
|---|---|---|
| Fig. 22 | 22_v08_similarity_by_adapter.png | Mean/Median cosine similarity by adapter |
| Fig. 23 | 23_v08_tier_distribution.png | Tier distribution stacked bar |
| Fig. 24 | 24_v08_cosine_violin.png | Cosine similarity violin plots |
| Fig. 25 | 25_v08_token_distribution.png | Token count histograms (LoRA r=32 vs DoRA r=64) |
| Fig. 26 | 26_v08_guard_breakdown.png | PASS/FAIL + reason code breakdown |
| Fig. 27 | 27_v08_priority_distribution.png | Priority level distribution |
| Fig. 28 | 28_v08_member_damage_r32_dora.png | Structural member ร damage co-occurrence (S.7.1 style) |
# Sentence-BERT evaluation (4 models)
.venv-eval\Scripts\Activate.ps1
python -u evaluate_v08_sbert.py
# Quality Guard + Priority Scoring
python -u pipeline_v08.py
# Generate Figures 22-24 (U.5)
python -u create_u8_figures.py
# Generate Figures 25-27 (U.6)
python -u create_u6_figures.py
# Generate Figure 28 (U.6.1, S.7.1 style)
python -u create_u61_figures.py
# Recompile Supplementary 2 (21 pages)
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-05-31
Scope: U.7 qualitative analysis section fully rebuilt on pairdata v3 (inference_r32.csv); 12 representative PASS images re-selected with member ร damage diversity; caption simplified and enriched; shared keyword highlighting added
| Item | Description |
|---|---|
| Image selection | 12 images re-selected from inference_r32.csv (pairdata v3 test set) using greedy member ร damage diversity |
| Caption structure | Simplified to 3 items: Quality Metrics / GT / Pred |
| Quality Metrics | Sim(emb) (2048-dim cosine) + Priority Score (0โ1) + Level (priority tier 3/4/5) |
| Keyword highlight | Keywords appearing in both GT and Pred rendered in gothic font (\CJKfamily{ipxg}) for visual emphasis |
| s8 folder | All 12 JPEGs replaced (figures_vlm/s8/s8_01_*.jpg โ s8_12_*.jpg) |
| methodology_supp2.pdf rebuilt โ 19 pages |
| # | Member | Damage | Sim(emb) | Priority | Level |
|---|---|---|---|---|---|
| 01 | girder | cracking | 0.840 | 1.00 | 5 |
| 02 | girder | rebar_exposure | 0.808 | 0.81 | 4 |
| 03 | girder | spalling | 0.774 | 0.81 | 4 |
| 04 | girder | corrosion | 0.713 | 0.81 | 4 |
| 05 | girder | settlement | 0.572 | 0.81 | 4 |
| 06 | girder | other | 0.585 | 0.81 | 4 |
| 07 | slab | cracking | 0.806 | 1.00 | 5 |
| 08 | slab | rebar_exposure | 0.778 | 0.81 | 4 |
| 09 | slab | corrosion | 0.741 | 0.81 | 4 |
| 10 | abutment | cracking | 0.798 | 1.00 | 5 |
| 11 | abutment | rebar_exposure | 0.797 | 0.81 | 4 |
| 12 | abutment | spalling | 0.669 | 0.81 | 4 |
.venv-eval\Scripts\Activate.ps1
python create_u7_figures.py
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-06-01
Scope: DoRA fine-tuning at r=16 (full pipeline: train โ merge โ inference โ SBERT โ quality guard โ figures); 3-way rank ablation (LoRA r=32 vs. DoRA r=32 vs. DoRA r=16) with Figures 35โ41 and U.7.2 discussion update
v0.8.4 extends the DoRA investigation with a lower-rank variant (r=16) and performs a full 3-way comparison against the LoRA r=32 baseline and DoRA r=32. The ablation reveals a non-monotone relationship between DoRA rank and output quality: r=16 achieves the most balanced priority distribution despite having the smallest trainable capacity.
| Item | Value |
|---|---|
| Script | train_v09_dora.py --lora-r 16 |
| Adapter | DoRA (use_dora=True), r=16, alpha=32, dropout=0.05 |
| Dataset | pairdata-v3, 2,500 samples (80/20 split) |
| eval_loss (best, ep 2.421) | 3.135 |
| eval_loss (final, ep 3.0) | 3.138 |
| Training duration | 6h 48m 26s |
| Merged model | models/llava_v09_dora_r16_merged/ (85 shards, max_shard_size=200MB) |
| Model | Mean | Std | Median | Good+ (โฅ0.70) |
|---|---|---|---|---|
| LoRA r=32 (v0.8 baseline) | 0.6700 | 0.0657 | 0.6854 | 32.9% |
| DoRA r=32 (v0.9) | 0.6564 | 0.0682 | 0.6691 | 25.0% |
| DoRA r=16 (v0.9) | 0.6717 | 0.0639 | 0.6811 | 36.0% |
| Model | PASS | FAIL | L3 | L4 | L5 | Token mean |
|---|---|---|---|---|---|---|
| LoRA r=32 | 798 (99.8%) | 2 | 64 | 632 | 102 | 89.5 |
| DoRA r=32 | 798 (99.8%) | 2 | 65 | 726 | 7 | 88.0 |
| DoRA r=16 | 797 (99.6%) | 3 | 61 | 705 | 31 | 74.5 |
| DoRA r=64 (ref) | 798 (99.8%) | 2 | 0 | 798 | 0 | 84.3 |
Key finding: DoRA r=64 undergoes complete mode collapse (all Level 4). DoRA r=16 achieves the most balanced Level 3/4/5 distribution among DoRA variants.
| Figure | File | Content |
|---|---|---|
| 35 | 35_u72_similarity.png | Mean/median cosine similarity (3-way bar) |
| 36 | 36_u72_tier.png | Quality tier distribution |
| 37 | 37_u72_violin.png | Cosine similarity violin plots |
| 38 | 38_u72_token.png | Token count histograms |
| 39 | 39_u72_priority.png | Priority level distribution |
| 40 | 40_u72_member_damage.png | Member ร damage co-occurrence analysis |
| 41 | 41_u7_dora_rank_training_loss.png | Validation loss trajectories (3 models) |
| Section | Change |
|---|---|
| U.7.1 | Figure 41 (validation loss) + "Training dynamics" analysis paragraph added |
| U.7.2 | Title updated to "DoRA Rank Ablation Studies: LoRA r=32 vs. DoRA r=32/16" |
| U.7.2 | Figures 35โ40 inserted (3-way 6-panel comparison) |
| U.7.2 Discussion | DoRA r=64 gradient collapse, r=16 balanced output, r=24 proposed as future work |
| methodology_supp2.pdf rebuilt โ 5648 KB |
# Phase 1: Training (requires .venv-train)
.\.venv-train\Scripts\python.exe train_v09_dora.py --lora-r 16
# Phase 2: Merge (requires .venv-dora)
.\.venv-dora\Scripts\python.exe merge_dora.py
# Phase 3: Inference (requires .venv-dora, NOT .venv-eval)
.\.venv-dora\Scripts\python.exe inference_v082_lora_dora.py --models r16_dora
# Phase 4: SBERT evaluation
.\.venv-eval\Scripts\python.exe evaluate_v08_sbert.py
# Phase 5: Quality Guard + Priority Scoring
.\.venv-eval\Scripts\python.exe pipeline_v08.py
# Phase 6: Figures 35-40 + U.7.2 update
.\.venv-eval\Scripts\python.exe create_u72_dora_ablation.py
# PDF recompile
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
Completion Date: 2026-06-02
Scope: DoRA r=24 full pipeline; 4-way rank ablation (LoRA r=32 + DoRA r=32/16/24); Figure 15 & Figures 35โ40 updated to 4-model comparison; U.7.2 Discussion extended; U.7.3 Qualitative Analysis added; DoRA r=24 selected as v1.0.0 final model
v0.8.5 completes the DoRA rank ablation study by adding DoRA r=24 โ the midpoint proposed in v0.8.4 to resolve the non-monotone rankโquality tradeoff. The experiment confirms that DoRA r=24 achieves the best overall balance among all tested variants, leading to its adoption as the production model for v1.0.0.
| Item | Value |
|---|---|
| Script | train_v09_dora.py --lora-r 24 |
| Adapter | DoRA (use_dora=True), r=24, alpha=48, dropout=0.05 |
| Dataset | pairdata-v3, 2,500 samples (80/20 split) |
| eval_loss (best, ep 2.421) | 3.137 |
| Training duration | ~6h 50m |
| Merged model | models/llava_v09_dora_r24_merged/ |
| Model | Mean | Std | Median | Good+ (โฅ0.70) |
|---|---|---|---|---|
| LoRA r=32 (v0.8 baseline) | 0.6700 | 0.0667 | 0.6689 | 32.9% |
| DoRA r=32 (v0.9) | 0.6564 | 0.0630 | 0.6602 | 25.0% |
| DoRA r=16 (v0.9) | 0.6717 | 0.0639 | 0.6811 | 36.0% |
| DoRA r=24 (v0.9) | 0.6791 | 0.0635 | 0.6834 | 37.8% |
| Model | PASS | FAIL | L3 | L4 | L5 | Token mean |
|---|---|---|---|---|---|---|
| LoRA r=32 | 798 (99.8%) | 2 | 64 | 632 | 102 | 89.5 |
| DoRA r=32 | 798 (99.8%) | 2 | 65 | 726 | 7 | 88.0 |
| DoRA r=16 | 797 (99.6%) | 3 | 61 | 705 | 31 | 74.5 |
| DoRA r=24 | 798 (99.8%) | 2 | 48 | 674 | 78 | 90.6 |
Key finding: DoRA r=24 achieves the highest SBERT similarity (mean=0.6791, Good+=37.8%) while maintaining a balanced priority distribution (L3/L4/L5 = 6.0%/84.5%/9.8%). This non-monotone optimum confirms DoRA r=24 as the sweet spot for LLaVA-1.5-7B on this structural damage domain.
| Section | Change |
|---|---|
| Figure 15 | Updated to "four models"; DoRA r=24 (eval_loss=3.137) added as 4th curve |
| Training dynamics paragraph | DoRA r=24 convergence behaviour added |
| U.7.2 title | โ "DoRA Rank Ablation Studies: LoRA r=32 vs. DoRA r=32/16/24" |
| U.7.2 Figures 35โ40 | Regenerated as 4-model comparison (added DoRA r=24 column) |
| U.7.2 Discussion | Expanded to 6 paragraphs: rankโquality relationship; figure-level evidence for each of Figs 35โ40; final model selection |
| U.7.3 | New subsection: Qualitative Analysis: Finetuned Model Predictions DoRA r=24 (12 panels, Figure 12โ14 style) |
| methodology_supp2.pdf rebuilt, no errors |
DoRA r=24 (v0.9) is adopted as the v1.0.0 production model based on:
| Item | Value |
|---|---|
| Script | inference_v10_full.py |
| Model | DoRA r=24 merged (models/llava_v09_dora_r24_merged/) |
| Input | Rank_c_image_text_n10789.xlsx (10,903 rows) |
| Pipeline | VLM inference + Quality Guard + Priority Scoring (single pass) |
| Checkpoint | every 2,000 rows โ data/v10_full/checkpoint_{n:06d}.xlsx |
| Speed | 3.5 s/image (batch_size=4, RTX 4060 Ti 16GB) |
| Total time | 10.55 h (37,968 s) |
| Output | data/v10_full/v10_full_r24_dora.xlsx |
| Figure | File | Content |
|---|---|---|
| 15 | 15_training_dynamics.png | Validation loss curves โ 4 models |
| 35 | 35_u72_similarity.png | Mean/median cosine similarity (4-model bar) |
| 36 | 36_u72_tier.png | Quality tier distribution (4 models) |
| 37 | 37_u72_violin.png | Cosine similarity violin plots (4 models) |
| 38 | 38_u72_token.png | Token count histograms (4 panels) |
| 39 | 39_u72_priority.png | Priority level distribution (4 models) |
| 40 | 40_u72_member_damage.png | Member ร damage co-occurrence (4 columns) |
| U.7.3 Figs | s9/s9_01โs9_12.jpg | DoRA r=24 qualitative panels |
# Phase 1: Training (requires .venv-train)
.\.venv-train\Scripts\python.exe train_v09_dora.py --lora-r 24
# Phase 2: Merge (requires .venv-dora)
.\.venv-dora\Scripts\python.exe merge_dora.py --rank 24
# Phase 3: Inference n=800 (requires .venv-dora)
.\.venv-dora\Scripts\python.exe inference_v082_lora_dora.py --models r24_dora
# Phase 4: SBERT evaluation
.\.venv-eval\Scripts\python.exe evaluate_v08_sbert.py
# Phase 5: Quality Guard + Priority Scoring
.\.venv-eval\Scripts\python.exe pipeline_v08.py
# Phase 6: Figures 35-40 (4-way) + U.7.2 Discussion update
.\.venv-eval\Scripts\python.exe create_u72_dora_4way.py
# Phase 7: U.7.3 Qualitative Analysis
.\.venv-eval\Scripts\python.exe create_u73_qualitative.py
# Phase 8: PDF recompile
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
# Phase 9: v1.0.0 full inference โ see v1.0.0 section below
chcp 65001 | Out-Null; [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
.\.venv-dora\Scripts\python.exe -u inference_v10_full.py --checkpoint-every 2000 2>&1 | Tee-Object -FilePath "v10_full_r24_dora_log.txt"
Execution period: 2026-06-02 20:20 โ 2026-06-03 06:53 JST
Scope: Full-dataset deployment of DoRA r=24 model over all 10,903 records; Quality Guard + Priority Scoring end-to-end; member ร damage analysis; Supplementary 2 U.7.4 added to paper
| Metric | Count | Ratio (%) |
|---|---|---|
| Total records | 10,903 | 100.0 |
| Quality Guard PASS | 10,668 | 97.8 |
| Quality Guard FAIL | 0 | 0.0 |
| Missing (no image) | 235 | 2.2 |
| Priority Level 3 | 454 | 4.3 |
| Priority Level 4 | 9,185 | 86.1 |
| Priority Level 5 | 1,029 | 9.6 |
| Total processing time | 10.55 h (37,968 s) | โ |
| Mean speed (batch=4) | 3.5 s/image | โ |
Key finding: PASS rate 97.8% at production scale (n=10,903) is consistent with the validation-set rate. Zero FAIL outputs confirm robust generalisation across the full field dataset. Batch-size-4 processing delivers a 50% speed improvement over single-image inference.
| Member | Count | % of PASS |
|---|---|---|
| Main Girder | 8,293 | 77.7% |
| Deck Slab | 4,139 | 38.8% |
| Curb | 3,404 | 31.9% |
| Railing/Parapet | 2,862 | 26.8% |
| Abutment | 2,180 | 20.4% |
| Expansion Joint | 532 | 5.0% |
| Drainage | 138 | 1.3% |
| Bearing | 78 | 0.7% |
| Damage Type | Count | % of PASS |
|---|---|---|
| Crack | 10,666 | 100.0% |
| Rebar Exposure | 9,837 | 92.2% |
| Spalling | 4,277 | 40.1% |
| Lime Efflorescence | 3,697 | 34.7% |
| Corrosion | 3,645 | 34.2% |
| Deformation | 2,943 | 27.6% |
| Delamination | 675 | 6.3% |
| Deterioration | 468 | 4.4% |
| Member | Most Associated Damage | Co-occ. Rate |
|---|---|---|
| Main Girder | Crack | 100.0% |
| Main Girder | Rebar Exposure | 92.4% |
| Deck Slab | Crack + Rebar Exposure | 100.0% |
| Curb | Corrosion | 81.5% |
| Railing/Parapet | Deformation | 99.9% |
| Abutment | Rebar Exposure | 99.4% |
| Section | Change |
|---|---|
| U.7.4 (new) | "Damage VLM Apps v1.0.0 Test Prediction: n=10,903" โ inference config table, results table, memberรdamage figure & discussion |
| Figure (fig:u74_member_damage) | 3-panel: member frequency / damage type frequency / memberรdamage heatmap for PASS n=10,668 |
| methodology_supp2.pdf rebuilt, no errors |
| File | Description |
|---|---|
data/v10_full/v10_full_r24_dora.xlsx | Final predictions (10,903 rows) |
data/v10_full/checkpoint_{002000โฆ010903}.xlsx | Checkpoints every 2,000 rows |
paper_damage_vlm/1_Methodology/figures_vlm/u74_member_damage_analysis.png | Memberรdamage analysis figure |
# Full inference (10,903 rows, batch_size=4, ~10.5 h on RTX 4060 Ti 16GB)
chcp 65001 | Out-Null; [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
.\.venv-dora\Scripts\python.exe -u inference_v10_full.py --checkpoint-every 2000 2>&1 | Tee-Object -FilePath "v10_full_r24_dora_log.txt"
# Member ร Damage analysis figure (U.7.4)
.\.venv-eval\Scripts\python.exe create_figures_u74.py
# Recompile paper (run twice for cross-references)
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
| Test Scale | Processing Time | Success Rate | Avg Time/Image |
|---|---|---|---|
| Single Image | 42s | 100% | 42s |
| 10-Image Batch | 8m 35s | 100% | 51.6s |
| 50-Image (Est.) | ~43m | - | ~52s |
| 254-Image (Est.) | ~3.6h | - | ~51s |
git clone https://github.com/your-username/damage_text_score.git
cd damage_text_score
# Windows PowerShell
python -m venv .venv
.venv\Scripts\Activate.ps1
# Linux/macOS
python -m venv .venv
source .venv/bin/activate
# PyTorch (CUDA 12.4)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
# llama-cpp-python (GPU version)
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124
# Other dependencies
pip install -r requirements.txt
# LLaVA GGUF Model (Recommended)
python download_llava_gguf.py
# Downloads:
# - models/ggml-model-q4_k.gguf (4.08GB)
# - models/mmproj-model-f16.gguf (624MB)
# Install Ollama
# https://ollama.com/download
# Pull Swallow-8B model
ollama pull swallow8b-lora-n4000-v09-q4:latest
# Test single image (~42s)
python quickstart.py --mode 1
# Process 10-image batch (~8.5 min)
python quickstart.py --mode 2
# Process 50 images (~43 min)
python quickstart.py --mode 3
# Process all 254 images (~3.6 hours)
python quickstart.py --mode 4
data/outputs/
โโโ quickstart_single.csv # Single image result
โโโ quickstart_10images.csv # 10-image results
โโโ quickstart_50images.csv # 50-image results
โโโ quickstart_254images.csv # Full dataset results
CSV Example:
image_name,damage_type,severity,location,risk,priority_score,priority_level,description
kensg-rebarexposureRb_001.png,crack,high,girder,structural,0.952,5,Extensive cracking observed...
JSON Structure:
{
"damage_type": "rebar_exposure",
"severity": "high",
"location": "girder",
"risk": "structural",
"description_ja": "้็ญ้ฒๅบใ่ฆใใใ่
้ฃใ้ฒ่กใใฆใใ...",
"key_features": ["rebar exposure", "moderate corrosion"],
"priority_score": 0.952,
"priority_level": 5
}
from src.pipeline.end_to_end import DamageAnalysisPipeline
# Initialize pipeline
pipeline = DamageAnalysisPipeline("config.yaml")
# Process single image
result = pipeline.process_image("path/to/image.png")
# Batch processing
results = pipeline.process_batch(image_paths, output_csv="results.csv")
| Mode | Model | Size | Time/Image | GPU Usage | Rating |
|---|---|---|---|---|---|
| llama-cpp-python | LLaVA-1.5-7B Q4_K_M | 4.08GB | 51.6s | 100% | โญโญโญโญโญ |
| HuggingFace | llava-1.5-7b-hf | 14GB | 45s | 100% | โญโญโญโญ |
| Ollama | llava:7b | 4.7GB | 88s | 0% (CPU) | โญโญ |
llama-cpp-python (Recommended)
HuggingFace
Ollama
LLaVA-1.5-7B - Vision-Language Model
Swallow-8B - Japanese LLM
damage_vlm_finetune/
โโโ .venv-train/ # Virtual environment: training (v0.7+)
โโโ .venv-pred/ # Virtual environment: inference/Unsloth (v0.5+)
โโโ data/ # Datasets
โ โโโ image_text_inspect_n10789/ # Master dataset (v0.3)
โ โ โโโ Rank_c_image_text_n10789.xlsx # 10,789 annotations
โ โ โโโ rank_c_images_n10789/ # Image files
โ โโโ v03_fine_tuning/ # v0.3 prepared datasets โ
โ โ โโโ test_set_n800.csv # Fixed test set
โ โ โโโ train_1k.csv # Training: 1k samples
โ โ โโโ train_2k.csv # Training: 2k samples
โ โ โโโ train_3k.csv # Training: 3k samples
โ โ โโโ train_4k.csv # Training: 4k samples
โ โ โโโ dataset_preparation_report.md
โ โ โโโ evaluations/ # Evaluation results (v0.5)
โ โ โโโ reports/ # Progressive training reports
โ โโโ rebar_exposure_n254/ # v0.2 validation dataset
โ โ โโโ outputs/ # v0.2 outputs
โ โโโ preprocessed_640x480_n10789/ # Preprocessed images
โโโ models/ # Model files
โ โโโ llava-v1.5-7b-Q5_K_M.gguf # Base model (v0.2)
โ โโโ llava_v03_qlora_1k/ # v0.4.1 LoRA adapters โ
โ โโโ llava_v03_qlora_2k/ # v0.4.2 โ
Recommended
โ โโโ llava_v03_qlora_3k/ # v0.4.3 โ
โ โโโ llava_v03_qlora_4k/ # v0.4.4 โ
โ โโโ scoring_rules.yaml # Rule-based scoring
โโโ src/ # Source code
โ โโโ preprocessing/ # Image preprocessing
โ โ โโโ image_preprocessor.py
โ โโโ vision/ # Vision analysis (v0.1-v0.2)
โ โ โโโ llama_cpp_vision.py # llama-cpp-python
โ โ โโโ gguf_vlm_analyzer.py # GGUF wrapper
โ โ โโโ ollama_vision.py # Ollama integration
โ โโโ structuring/ # JSON structuring
โ โ โโโ json_structurer.py
โ โโโ scoring/ # Priority scoring
โ โ โโโ priority_scorer.py
โ โโโ evaluation/ # v0.5 evaluation โ
โ โ โโโ __init__.py
โ โ โโโ vector_similarity_evaluator.py
โ โโโ pipeline/ # Pipeline orchestration
โ โ โโโ end_to_end.py
โ โโโ utils/ # Utilities
โ โโโ config.py
โ โโโ ollama_client.py
โโโ paper_damage_vlm/ # v0.6 Academic paper
โ โโโ 0_Format_arXiv_pdfLaTex/
โ โ โโโ bridge_damage_vlm_quantization_2026.tex
โ โ โโโ bridge_damage_vlm_quantization_2026.bib
โ โ โโโ figures/
โ โโโ 1_Methodology/
โโโ docs/ # Documentation
โ โโโ ARCHITECTURE.md
โ โโโ GPU_SETUP.md
โ โโโ VLM_COMPARISON_PLAN_v02.md
โ โโโ VLM_VALIDATION_REPORT_v02.md
โโโ prepare_v03_dataset.py # v0.3 dataset preparation โ
โโโ train_v03_qlora.py # v0.4 QLoRA training โ
โโโ create_progressive_training_report.py # v0.5 reporting โ
โโโ config.yaml # Unified configuration โ
โโโ SETUP_VENV_VLM.md # v0.3 setup guide โ
โโโ QUICKSTART_V03_V05.md # v0.3-v0.5 workflow โ
โโโ V03_V05_IMPLEMENTATION_SUMMARY.md # Implementation summary โ
โโโ requirements.txt # Python dependencies
โโโ README.md # This file (English)
โโโ README_JP.md # Japanese documentation
โโโ CHANGELOG.md # Version history
โโโ LICENSE # Apache License 2.0
Legend:
Symptom: Japanese characters appear garbled in PowerShell
Solution:
# Change to UTF-8
chcp 65001
python quickstart.py
Symptom: CUDA out of memory error
Solution:
# config.yaml
llama_cpp_vision:
n_gpu_layers: 20 # Reduce from -1 (all layers) to partial GPU
Symptom: Failed to connect to Ollama
Solution:
# Check Ollama server
ollama list
# Restart server
ollama serve
Symptom: Failed building wheel for llama-cpp-python
Solution:
# Install CUDA version explicitly
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124
# Or enable CUDA via environment variable
$env:CMAKE_ARGS="-DLLAMA_CUBLAS=on"
pip install llama-cpp-python --force-reinstall --no-cache-dir
inspect_images_336).venv-eval environment (CPU-only, separate from .venv-pred)SETUP_ENV_EVAL.md created (.venv-eval setup guide)data/v10_full/v10_full_r24_dora.xlsx (10,903 rows)create_figures_u74.py -> figures_vlm/u74_member_damage_analysis.pngIf you use this project in your research, please cite:
@software{bridge_damage_assessment_2026,
title = {Bridge Damage Assessment and Repair Priority Scoring System},
author = {Your Name},
year = {2026},
version = {0.1.0},
url = {https://github.com/your-username/damage_text_score}
}
Apache License 2.0 - See LICENSE for details
Completion Date: 2026-05-28
Scope: Quality Guard recalibration + keyword structuring pipeline on 3k pairdata_v2 model (n=800)
pipeline_v073.py): n=800 in < 2 seconds| Verdict | Count | Rate |
|---|---|---|
| PASS โ High Quality | 787 | 98.4% |
| FAIL โ Error / Too short | 13 | 1.6% |
| Level | Description | Count | Rate |
|---|---|---|---|
| 3 | Planned maintenance | 21 | 2.7% |
| 4 | Priority repair | 651 | 82.7% |
| 5 | Immediate repair | 115 | 14.6% |
Contrast with v0.6.3 where 100% of PASS samples scored Level 3 (scoring saturation at 0.54).
| Figure | File | Description |
|---|---|---|
| 15 | 15_v073_token_distribution.png | Token count with recalibrated thresholds |
| 16 | 16_v073_guard_breakdown.png | PASS/FAIL verdict breakdown |
| 17 | 17_v073_priority_distribution.png | Priority level distribution |
| 18 | 18_member_damage_comparison.png | Member ร Damage comparison (v0.6.3 vs v0.7.3) |
| 19 | 19_priority_comparison.png | Priority level comparison (v0.6.3 vs v0.7.3) |
.\.venv-pred\Scripts\Activate.ps1
python pipeline_v073.py
methodology_supp.tex โ S.7 Quality Guard Recalibrationmethodology_supp.tex โ S.7.1 Member & Damage Type comparisonmethodology_supp.tex โ S.7.2 Priority Level comparisonmethodology_supp.pdf โ 10 pages, no errorsLast Updated: May 29, 2026 (v0.7.3 โ Quality Guard recalibration, full pipeline, scoring saturation resolved)
Completion Date: 2026-05-29
Scope: Extended semantic similarity evaluation using a 2,048-dimensional composite embedding (n=800 test set ร 4 scales)
v0.7.4 replaces the 384-dimensional single-model evaluator (paraphrase-multilingual-MiniLM-L12-v2) with a 2,048-dimensional composite embedding formed by combining two complementary Japanese-capable sentence encoders. This yields substantially higher and more discriminative cosine similarity scores and revises the optimal training scale from 3k to 2k.
| Component | Model | Dimensions | Properties |
|---|---|---|---|
| M1 | hotchpotch/static-embedding-japanese | 1,024 | Static EmbeddingBag, CPU-native, Japanese-specialised |
| M2 | intfloat/multilingual-e5-large | 1,024 | Transformer encoder, 100+ languages, STS prefix "query: " |
| Combined | L2-normalise โ concat โ re-normalise | 2,048 | Arithmetic mean of per-model cosine similarities |
Given ground-truth text $t^{gt}$ and prediction $t^{pred}$:
Test set: n=800 (pairdata-v2 ground truth), CPU inference
Tier thresholds: Excellent โฅ 0.85 ยท Good โฅ 0.70 ยท Acceptable โฅ 0.55 ยท Poor โฅ 0.40 ยท Very Poor < 0.40
| Scale | Mean ฯ | ฯ | Median | Good+ (%) | V.Poor (%) |
|---|---|---|---|---|---|
| 1k | 0.6725 | 0.0706 | 0.6749 | 37.8 | 0.4 |
| 2k โ | 0.6950 | 0.0824 | 0.7053 | 53.1 | 0.4 |
| 3k | 0.6767 | 0.0751 | 0.6799 | 37.8 | 0.4 |
| 4k | 0.6749 | 0.0742 | 0.6803 | 38.4 | 0.4 |
| Scale | 384-dim MiniLM | 2048-dim Composite | ฮ |
|---|---|---|---|
| 1k | 0.5657 | 0.6725 | +18.9% |
| 2k | 0.6011 | 0.6950 | +15.6% |
| 3k | 0.6013 | 0.6767 | +12.5% |
| 4k | 0.5742 | 0.6749 | +17.5% |
Very Poor rate: 384-dim was 21.5โ32.9%; 2048-dim is uniformly โ0.4%.
| Figure | File | Description |
|---|---|---|
| Fig. 12 | figures_vlm/12_v072_similarity_by_scale.png | Mean/median ฯ by scale; red dashed = 384-dim baseline |
| Fig. 13 | figures_vlm/13_v072_tier_distribution.png | Quality-tier stacked bar chart (2048-dim results) |
| Fig. 14 | figures_vlm/14_v072_cosine_violin.png | Cosine similarity violin plots (2048-dim results) |
paper_damage_vlm/1_Methodology/methodology_supp.tex โ S.6 fully rewritten: evaluator description, Table with 2048-dim values, Key findings (2k peak), Figure 12/13/14 captions, Model selection (3k โ 2k), Extended Evaluation subsubsection with three mathematical formulaspaper_damage_vlm/1_Methodology/methodology_supp.pdf โ 14 pages, recompiled (no errors)| File | Purpose |
|---|---|
evaluate_2048dim.py | 2048-dim composite embedding evaluation script |
create_figures_v072_2048dim.py | Figure 12/13/14 generator from 2048-dim JSON results |
SETUP_ENV_EVAL.md | .venv-eval environment setup guide |
# 1. Create evaluation environment (CPU-only, independent of .venv-pred)
python -m venv .venv-eval
.venv-eval\Scripts\pip.exe install "torch==2.6.0+cpu" --index-url https://download.pytorch.org/whl/cpu
.venv-eval\Scripts\pip.exe install "sentence-transformers==3.3.1" numpy pandas scikit-learn matplotlib seaborn
# 2. Run evaluation (n=800 x 4 scales, ~26 min total on CPU)
.venv-eval\Scripts\python.exe evaluate_2048dim.py
# 3. Regenerate Figure 12/13/14
.venv-eval\Scripts\python.exe create_figures_v072_2048dim.py
Output JSON files: data/v07_fine_tuning/evaluations_2048dim/evaluation_2048dim_{1k,2k,3k,4k}.json
Last Updated: May 29, 2026
Scope: 2k model established as primary pipeline; cross-model comparison figures; full S.7โS.8 supplementary paper update
Building on the v0.7.4 finding that the 2k model is optimal (mean ฯ=0.6950, Good+=53.1%), v0.7.5 designates the 2k QLoRA pipeline as the primary production variant and adds cross-model comparative analysis to the supplementary paper.
figures_vlm/19_member_damage_v073_v075.png
Side-by-side frequency bars and co-occurrence heatmaps comparing the 3k model (v0.7.3) against the 2k model (v0.7.5).
Notable finding โ Cross Beam saturation in 2k:
| Member | v0.7.3 (3k) | v0.7.5 (2k) |
|---|---|---|
| Main Girder | ~100.0% | ~100.0% |
| Cross Beam | ~40% | 98.3% |
| Rebar Exposure | ~99% | ~99% |
The 2k model systematically appends cross beam descriptors in 98.3% of all predictions, reflecting template-driven vocabulary learned from the smaller training corpus.
figures_vlm/20_priority_score_violin.png
Violin plots comparing priority score distributions across all three pipeline versions:
| Version | Model | Mean | Std | Level 4โ5 |
|---|---|---|---|---|
| v0.6.3 | pairdata-v1 3k | 0.54 (point mass) | 0.000 | 0% |
| v0.7.3 | pairdata-v2 3k | 0.838 | 0.070 | 97.3% |
| v0.7.5 | pairdata-v2 2k | 0.811 | 0.025 | ~97% |
Interpretation: v0.6.3 collapses to a single value (mode-collapsed outputs). Both v0.7.x models restore discriminability; v0.7.5 (2k) shows a tighter, more predictable Level-4 cluster (std=0.025) while v0.7.3 (3k) reaches higher scores with greater variance (std=0.070), reflecting its longer training.
paper_damage_vlm/1_Methodology/methodology_supp.tex โ Section S.8
All 12 representative PASS panels updated to display three rows per image:
| Row | Source | Notes |
|---|---|---|
| GT | Original inspection record | Terms shared with Predโ and Predโ both bold |
| Predโ (2k) | v0.7.5 pipeline output | Terms shared with GT bold |
| Predโ (3k) | v0.7.3 pipeline output | Terms shared with GT bold |
Additional formatting changes applied to all 12 panels:
0.675\linewidth (ร0.9 from 0.75)| # | Sim(emb) 2k (Predโ) | Sim(emb) 3k (Predโ) | ฮ |
|---|---|---|---|
| 01 | 0.552 | 0.394 | +0.158 |
| 02 | 0.418 | 0.400 | +0.018 |
| 03 | 0.658 | 0.668 | โ0.010 |
| 04 | 0.441 | 0.397 | +0.044 |
| 05 | 0.537 | 0.504 | +0.033 |
| 06 | 0.643 | 0.622 | +0.021 |
| 07 | 0.593 | 0.592 | +0.001 |
| 08 | 0.700 | 0.685 | +0.015 |
| 09 | 0.555 | 0.489 | +0.066 |
| 10 | 0.770 | 0.756 | +0.014 |
| 11 | 0.798 | 0.783 | +0.015 |
| 12 | 0.656 | 0.722 | โ0.066 |
The 2k model achieves higher Sim(emb) in 9 of 12 panels; the 3k model leads in 3 (panels 03, 07, 12).
| File | Purpose |
|---|---|
create_figures_v075_s71_s72.py | Generates Figure 19 (member/damage comparison) and Figure 20 (priority score violin) |
paper_damage_vlm/1_Methodology/methodology_supp.tex โ S.7.1, S.7.2, S.8 fully updatedpaper_damage_vlm/1_Methodology/methodology_supp.pdf โ 17 pages, no errors (pdflatex)# Generate Figure 19 and Figure 20
.venv-eval\Scripts\python.exe create_figures_v075_s71_s72.py
# Recompile supplementary PDF
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp.tex
Last Updated: June 1, 2026 (v0.8.4 โ DoRA rank ablation r=16/32 full pipeline complete; DoRA r=16 achieves best Good+ rate 36.0% and most balanced priority distribution; U.7.2 updated with 3-way comparison Figures 35โ41; DoRA r=24 proposed as next experiment)
An end-to-end pipeline for automated analysis of bridge structural damage (rebar exposure, cracks, corrosion) using LLaVA (Large Language and Vision Assistant). The system generates expert-level damage descriptions from images and produces structured prioritization scores for repair planning.
Python
1
18 commits
updated Jun 3, 2026
Progressive Fine-Tuning of LLaVA-1.5-7B with Quality Guard Agent for Bridge Damage Analysis and Repair Priority Scoring
๐ ๆฅๆฌ่ช็ใใญใฅใกใณใ (Japanese Documentation)
An end-to-end pipeline for automated analysis of bridge structural damage (rebar exposure, cracks, corrosion) using LLaVA (Large Language and Vision Assistant). The system generates expert-level damage descriptions from images and produces structured prioritization scores for repair planning.
graph TB
A[Input Images<br/>254 Bridge Damage Photos] --> B[Preprocessing<br/>Denoise/Resize/Contrast]
B --> C[Vision Analysis<br/>LLaVA-1.5-7B GGUF]
C --> D[JSON Structuring<br/>Swallow-8B]
D --> E[Priority Scoring<br/>Rule-Based Engine]
E --> F[Output<br/>CSV/JSON Reports]
style A fill:#e1f5ff
style C fill:#fff4e1
style E fill:#ffe1e1
style F fill:#e1ffe1
flowchart LR
subgraph Input["๐ Input Stage"]
A1[Raw Images<br/>PNG/JPG]
end
subgraph Preprocess["๐ง Preprocessing"]
B1[Noise Reduction<br/>NL-Means]
B2[Resize<br/>Max 1024x1024]
B3[Contrast<br/>CLAHE]
end
subgraph Vision["๐๏ธ Vision Analysis"]
C1[Image Encoding<br/>CLIP Vision]
C2[LLaVA Inference<br/>Q4_K_M Quantized]
C3[Damage Description<br/>Japanese Text]
end
subgraph Structure["๐ Structuring"]
D1[Swallow-8B LLM<br/>via Ollama]
D2[JSON Parsing<br/>Multi-Pattern]
D3[Structured Data<br/>Type/Severity/Location]
end
subgraph Score["๐ฏ Scoring"]
E1[Rule Evaluation<br/>40% Severity<br/>35% Type<br/>15% Location<br/>10% Risk]
E2[Priority Calculation<br/>0.0-1.0 Score]
E3[Level Assignment<br/>1-5 Priority]
end
subgraph Output["๐พ Output"]
F1[CSV Export<br/>Batch Results]
F2[JSON Export<br/>Detailed Records]
end
A1 --> B1 --> B2 --> B3
B3 --> C1 --> C2 --> C3
C3 --> D1 --> D2 --> D3
D3 --> E1 --> E2 --> E3
E3 --> F1
E3 --> F2
style Input fill:#e1f5ff
style Vision fill:#fff4e1
style Score fill:#ffe1e1
style Output fill:#e1ffe1
| Stage | Module | Purpose | Technology |
|---|---|---|---|
| Preprocessing | image_preprocessor.py | Image quality enhancement | OpenCV 4.12 |
| Vision Analysis | llama_cpp_vision.py | Damage description generation | LLaVA-1.5-7B Q4_K_M (4GB) |
| Structuring | json_structurer.py | Natural language โ JSON | Swallow-8B (Ollama) |
| Scoring | priority_scorer.py | Repair priority calculation | Rule-based (YAML) |
| Pipeline | end_to_end.py | Orchestration | Python 3.12 |
Processing Time Breakdown (per image):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Preprocessing: ~2s (4%) โ
โ Vision Analysis: ~42s (81%) โ
โ JSON Structuring: ~5s (10%) โ
โ Scoring: <1s (2%) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Total: ~51.6 seconds/image โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3 Vision Modes Implemented
Complete Pipeline
Validation Tests
Windows Encoding Issues Resolved
Comprehensive evaluation of LLaVA-1.5-7B quantization levels (Q4_K_M, Q5_K_M, Q8_0) to determine the optimal balance between accuracy, speed, and model size for bridge damage assessment.
Developed a 5-point quality scoring system (v0.2 design) to assess damage description completeness:
| Component | Max Points | Criteria |
|---|---|---|
| Damage Types | 2.0 | Recognition of crack, rebar exposure, corrosion, spalling, section loss |
| Severity Level | 1.0 | Minor, moderate, severe classification |
| Location Info | 1.0 | Spatial information (top, bottom, left, right, etc.) |
| Extent Info | 1.0 | Coverage description (local, widespread, partial, etc.) |
| Total | 5.0 | Comprehensive damage assessment score |
| Quantization | Model Size | Init Time | Avg Inference | Quality Score | Text Length | Success Rate |
|---|---|---|---|---|---|---|
| Q4_K_M | 4.1GB | 3.6s | 5.43s | 2.93 ยฑ 1.53 | 168 ยฑ 41 | 254/254 (100%) |
| Q5_K_M โญ | 4.8GB | 4.5s | 5.67s | 3.18 ยฑ 1.35 | 160 ยฑ 37 | 254/254 (100%) |
| Q8_0 | 7.2GB | 5.9s | 7.63s | 3.27 ยฑ 1.39 | 162 ยฑ 39 | 254/254 (100%) |
Performance Comparison:

Figure 1: Performance metrics across quantization levels (N=254). Shows average inference time, model size vs total time, quality score comparison, and summary statistics.
๐ English Version | Japanese Version

Figure 2: Comprehensive statistical analysis including violin plots (quality, text length, inference time), box plots, scatter plots (quality vs text length/inference time), and detailed statistics table.
Violin Plot Analysis:
Statistical Significance (Mann-Whitney U Test):
| Quantization | Correlation Coefficient | Interpretation |
|---|---|---|
| Q4_K_M | -0.559 | Moderate negative (longer โ lower quality) |
| Q5_K_M | -0.148 | Weak negative (stable across lengths) |
| Q8_0 | -0.393 | Moderate negative |
Insight: Q5_K_M maintains consistent quality regardless of description length, indicating robust performance.
Speed-Quality Efficiency:
Q4_K_M: 0.54 quality/sec (2.93 / 5.43)
Q5_K_M: 0.56 quality/sec (3.18 / 5.67) โ BEST โญ
Q8_0: 0.43 quality/sec (3.27 / 7.63)
Best Quality-Speed Balance
Stable Performance
Resource Efficiency
| Priority | Quantization | Use Case |
|---|---|---|
| ๐ฅRecommended | Q5_K_M | Production deployment (best balance) |
| ๐ฅ Alternative | Q8_0 | High-accuracy applications (if speed is not critical) |
| ๐ฅ Development | Q4_K_M | Fast prototyping only |
For Bridge Damage Assessment:
Quantization is Not Free
Sweet Spot Exists
Statistical Validation is Essential
GPU Compatibility Matters
Quality Metrics Enable Optimization
Prepare high-quality training datasets from n=10,789 bridge damage images for progressive QLoRA fine-tuning of LLaVA-1.5-7B to improve damage description quality from 3.18/5.0 โ 4.5+/5.0.
Completion Date: 2026-05-22
Rank_c_image_text_n10789.xlsxText Length: 15-500 characters
Excluded Patterns:
- Empty or whitespace only
- Question marks only ("???")
- "ใชใ" (none), "่ฉฒๅฝใชใ" (not applicable)
Required Keywords (at least one):
Damage Types: ใฒใณๅฒใ, ใฏใฉใใฏ, ้็ญ, ่
้ฃ, ๅฅ้ข, ๅฃๅ
Components: ๆก, ๅบ็, ๆฏๆฟ, ๆฉ่, ใณใณใฏใชใผใ
Severity: ่ใใ, ้ก่, ้ฒ่ก, ่ปฝๅพฎ
Expected Retention Rate: ~70-80% (7,600-8,600 images passing filters)
Purpose: Maintain representative distribution of component types and damage types across all datasets.
Methodology:
component_type ร damage_typeseed=42 for reproducibilityBenefits:
| Split | Size | Seed | Purpose |
|---|---|---|---|
| Test Set | 800 | 42 | Fixed evaluation set (never used in training) |
| Train 1k | 1,000 | 42+1000 | Initial fine-tuning baseline |
| Train 2k | 2,000 | 42+2000 | Scaling experiment (2x data) |
| Train 3k | 3,000 | 42+3000 | Scaling experiment (3x data) |
| Train 4k | 4,000 | 42+4000 | Maximum scale experiment |
Note: Each training set is independently sampled (not cumulative) to measure pure dataset size effects.
prepare_v03_dataset.pyFeatures:
Usage:
# Activate virtual environment (training)
.\.venv-train\Scripts\Activate.ps1
# Run dataset preparation
python prepare_v03_dataset.py
Output Files:
data/v03_fine_tuning/
โโโ test_set_n800.csv # Fixed test set
โโโ train_1k.csv # 1,000 training samples
โโโ train_2k.csv # 2,000 training samples
โโโ train_3k.csv # 3,000 training samples
โโโ train_4k.csv # 4,000 training samples
โโโ dataset_preparation_report.md # Statistics & distribution analysis
CSV Format:
ใใกใคใซใใน,ๆ่ฆ,component_type,damage_type,text_length
rank_c_images_n10789/IMG_0001.jpg,"ๅบ็ไธ้ขใซ้ก่ใชใฒใณๅฒใ...",ๅบ็,ใฒใณๅฒใ,85
Measure Dataset Size Impact
Detect Overfitting Threshold
Resource Planning
Ablation Study
Completion Date: 2026-05-23
Training Period: 2026-05-22 01:59 - 2026-05-23 00:17 (Total: ~15 hours)
Execute progressive QLoRA fine-tuning of LLaVA-1.5-7B across four dataset scales (1k, 2k, 3k, 4k samples) to measure dataset size impact on model performance and identify the optimal training data volume.
| Stage | Dataset | Training Time | Train/Val Samples | Final Val Loss | Best Checkpoint | Loss Improvement |
|---|---|---|---|---|---|---|
| v0.4.1 | 1k | 1:22:57 | 799 / 200 | 3.135 | checkpoint-100 | - (baseline) |
| v0.4.2 | 2k | 2:55:37 | 1,599 / 400 | 3.073 | checkpoint-300 | โ 1.98% |
| v0.4.3 | 3k | 4:31:44 | 2,398 / 600 | 3.073 | checkpoint-400 | โ 0.00% |
| v0.4.4 | 4k | 6:19:10 | 3,196 / 799 | 3.067 | checkpoint-600 | โ 0.20% |
Performance Plateau at 2k-3k Range
Optimal Model: 2k Samples (v0.4.2)
Diminishing Returns
Base Model: llava-hf/llava-1.5-7b-hf
Quantization: 4-bit NF4 with double quantization
LoRA Parameters:
rank: 32
alpha: 64
dropout: 0.05
target_modules: [q_proj, v_proj, k_proj, o_proj, gate_proj, up_proj, down_proj]
Training Hyperparameters:
batch_size: 4
gradient_accumulation_steps: 4 # Effective batch size: 16
learning_rate: 2e-4
num_epochs: 3
warmup_steps: 50
max_grad_norm: 1.0
weight_decay: 0.01
optimizer: AdamW
lr_scheduler: cosine
mixed_precision: fp16
Hardware:
GPU: NVIDIA GeForce RTX 4060 Ti 16GB
CUDA: 12.4
PyTorch: 2.6.0
Validation Loss
3.14 โค
โ 1k โ
3.12 โค โฒ
โ โฒ
3.10 โค โฒ 2k โโโโโโโโโโโโโโโโโโโ (plateau)
โ 3k 4k
3.08 โค
โ
3.06 โค โ
โ 4k
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1k 2k 3k 4k
models/
โโโ llava_v03_qlora_1k/ # 134.5 MB (v0.4.1) โ
โโโ llava_v03_qlora_2k/ # 134.5 MB (v0.4.2) โ
Recommended
โโโ llava_v03_qlora_3k/ # 134.5 MB (v0.4.3) โ
โโโ llava_v03_qlora_4k/ # 134.5 MB (v0.4.4) โ
See Result_QLoRA_Scale.md for:
Completion Date: 2026-05-24
Evaluation Period: 2026-05-23 - 2026-05-24
Comprehensive evaluation of all 4 QLoRA fine-tuned models (1k/2k/3k/4k) using semantic similarity metrics and creation of publication-quality visualizations for ACVR 2026 paper submission.
Replaced simple quality scoring with Japanese Sentence-BERT cosine similarity:
sonoisa/sentence-bert-base-ja-mean-tokens-v2| Tier | Similarity Range | Interpretation |
|---|---|---|
| Excellent | ฯ โฅ 0.85 | Near-perfect match |
| Good | 0.75 โค ฯ < 0.85 | High quality, minor differences |
| Acceptable | 0.65 โค ฯ < 0.75 | Adequate, usable |
| Poor | 0.50 โค ฯ < 0.65 | Significant gaps |
| Very Poor | ฯ < 0.50 | Unacceptable quality |
| Model | Mean ยฑ Std | Median | Min | Max | Tier |
|---|---|---|---|---|---|
| 1k | 0.6491 ยฑ 0.0875 | 0.6536 | 0.0809 | 0.8462 | Acceptable |
| 2k | 0.6850 ยฑ 0.0814 | 0.6933 | 0.0809 | 0.8526 | Acceptable |
| 3k | 0.6909 ยฑ 0.0784 | 0.7081 | 0.0809 | 0.8540 | Acceptable+ |
| 4k | 0.6739 ยฑ 0.0795 | 0.6808 | 0.0809 | 0.8492 | Acceptable |
| Model | Excellent | Good | Acceptable | Poor | Very Poor |
|---|---|---|---|---|---|
| 1k | 0.0% | 11.9% | 40.0% | 42.9% | 5.2% |
| 2k | 0.1% | 20.8% | 50.6% | 26.2% | 2.2% |
| 3k | 0.0% | 21.0% | 48.9% | 27.6% | 2.5% |
| 4k | 0.0% | 15.9% | 51.9% | 32.1% | 0.1% |
Cosine Similarity
0.70 โค โญโโโ 3k (Peak)
โ โฑ โฒ
0.68 โค โ โฒโ 4k (Degradation)
โ โฑ 2k โฒ
0.66 โค โฑ โฒ
โ โ โฒ
0.64 โค 1k
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
1k 2k 3k 4k
Observation: Semantic similarity improves from 1kโ2k (+5.5%) โ 3k (+0.9%), but degrades at 4k (-2.5%).
Evidence:
Hypothesis: Additional data introduces label noise or vocabulary saturation.
Created 5 comprehensive figures for ACVR 2026 paper:

Bar chart comparing mean cosine similarity across all 4 models with error bars (ยฑ1ฯ).

100% stacked bar chart showing quality tier proportions per model.

Grouped bar chart enabling direct comparison within each quality tier.

Distribution visualization showing density concentration (2k/3k near Good/Acceptable boundaries).

Comprehensive statistical summary with mean/std/min/max/median and tier percentages.
Submitted to: ACVR 2026 (Asian Conference on Computer Vision and Robotics)
Paper: methodology.tex
Total Pages: 16 pages
Figures: 7 figures (including Validation Loss curve)
Loss-Based Early Stopping Limitation
4k model achieves lowest validation loss (3.067) but worst test performance (0.6739) โ highlights need for domain-specific metrics beyond perplexity.
Mid-Scale Training Advantage
2k-3k range achieves optimal quality-cost balance, challenging "more data = better" assumption in specialized domains.
Overfitting in Low-Resource Domains
Vocabulary saturation and label noise become dominant factors beyond ~3k samples for Japanese bridge damage terminology.
Script: train_v03_qlora.py
QLoRA Configuration:
Base Model: llava-hf/llava-1.5-7b-hf
Quantization: 4-bit NF4 with double quantization
LoRA Parameters:
rank: 32
alpha: 64
dropout: 0.05
target_modules: [q_proj, v_proj, k_proj, o_proj, gate_proj, up_proj, down_proj]
Training Hyperparameters:
batch_size: 4
gradient_accumulation_steps: 4 # Effective batch size: 16
learning_rate: 2e-4
num_epochs: 3
optimizer: AdamW
lr_scheduler: cosine with warmup (50 steps)
mixed_precision: fp16
Training Stages:
# Stage 1: 1k samples (~2-4 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_1k.csv --output-dir models/llava_v03_qlora_1k
# Stage 2: 2k samples (~4-8 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_2k.csv --output-dir models/llava_v03_qlora_2k
# Stage 3: 3k samples (~6-12 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_3k.csv --output-dir models/llava_v03_qlora_3k
# Stage 4: 4k samples (~8-16 hours)
python train_v03_qlora.py --train-data data/v03_fine_tuning/train_4k.csv --output-dir models/llava_v03_qlora_4k
Expected Output:
Script: src/evaluation/vector_similarity_evaluator.py
Evaluation Method:
Quality Thresholds:
Excellent: โฅ0.85
Good: โฅ0.75
Acceptable: โฅ0.65
Poor: โฅ0.50
Very Poor: <0.50
Usage:
# Evaluate single model
python -m src.evaluation.vector_similarity_evaluator \
--csv inference_1k_results.csv \
--gt-col "ๆ่ฆ" \
--pred-col "prediction" \
--output data/v03_fine_tuning/evaluations/evaluation_train_1k.json
# Generate progressive training report
python create_progressive_training_report.py \
--eval-dir data/v03_fine_tuning/evaluations \
--output-dir data/v03_fine_tuning/reports
Expected Improvements:
| Metric | v0.2 (Q5_K_M) | v0.3 Target | Improvement |
|---|---|---|---|
| Mean Cosine Similarity | 0.68-0.72 | 0.78-0.85 | +15-20% |
| Quality Distribution (โฅ0.75) | ~45% | 70-80% | +55-78% |
| Standard Deviation | 0.18-0.22 | 0.12-0.16 | Better consistency |
Target: arXiv preprint submission
Paper Structure:
LaTeX Source: paper_damage_vlm/0_Format_arXiv_pdfLaTex/bridge_damage_vlm_quantization_2026.tex
| Phase | Status | Completion Date |
|---|---|---|
| v0.1: Baseline Pipeline | โ Complete | 2025-12 |
| v0.2: Quantization Study | โ Complete | 2026-03 |
| v0.3: Dataset Preparation | โ Complete | 2026-05-22 |
| v0.4: QLoRA Training | โ Complete | 2026-05-23 |
| v0.5.1: Evaluation & Visualization | โ Complete | 2026-05-24 |
| v0.6.3: Quality Guard + Full Pipeline | โ Complete | 2026-05-25 |
| v0.7.1: Image Size Optimization | โ Complete | 2026-05-26 |
| v0.7.2: pairdata_v2 Progressive Retraining | โ Complete | 2026-05-27 |
| v0.7.3: Quality Guard Recalibration & Full Pipeline | โ Complete | 2026-05-28 |
| v0.7.4: 2048-Dimensional Composite Embedding Evaluation | โ Complete | 2026-05-29 |
| v0.7.5: 2k Pipeline Evaluation & Supplementary Paper Update | โ Complete | 2026-05-29 |
| v0.8: pairdata_v3 QLoRA Rank Ablation (r=16/32/64) | โ Complete | 2026-05-30 |
| v0.8.1: DoRA vs. LoRA Comparison (r=64) | โ Complete | 2026-05-30 |
| v0.8.2: Embedding Eval + QG Assessment โ LoRA r=32 Adopted | โ Complete | 2026-05-31 |
| v0.8.3: U.7 Qualitative Analysis Full Update (pairdata v3) | โ Complete | 2026-05-31 |
| v0.8.4: DoRA Rank Ablation Study (r=16/32 vs LoRA r=32) | โ Complete | 2026-06-01 |
| v0.8.5: DoRA r=24 Final Rank Ablation & v1.0.0 Model Selection | โ Complete | 2026-06-02 |
Completion Date: 2026-05-25
Evaluation: Full n=800 test set (v0.6.3 pipeline, 3k model)
v0.6.3 introduces a two-stage Quality Guard Agent that filters low-quality VLM outputs before priority scoring, completing the end-to-end production pipeline:
Image โ LLaVA-1.5-7B (3k QLoRA) โ Quality Guard (Stage 1 + 2) โ Priority Scorer โ Report
| Rule | Threshold | Reject Code |
|---|---|---|
| Token count below minimum | ฮธ_low = 98 (5th percentile) | short_description |
| Token count above maximum | ฮธ_high = 202 (95th percentile) | dirty_or_noisy |
| Excessive repetition (โฅ 3 repeated n-grams) | โ | dirty_or_noisy |
| No damage keyword present | โ | dirty_or_noisy |
| Image file missing | โ | no_such_file |
Token counting uses CJK + ASCII tokenization to correctly handle Japanese text.
Applies natural-language judgement to Stage 1 PASS outputs as a second verification layer. Empirical result: Stage 2 produced 0 additional rejections for the 3k model โ the rule-based Stage 1 alone was sufficient.
| Metric | Value | % |
|---|---|---|
| Total images | 800 | 100.0% |
| PASS (High Quality) | 727 | 90.9% |
| FAIL โ Dirty or Noisy | 36 | 4.5% |
| FAIL โ Short description | 35 | 4.4% |
| FAIL โ No such file | 2 | 0.2% |
| Stage 2 additional rejections | 0 | โ |
| End-to-end throughput | 8.97 s/row | โ |
| Total elapsed | 7,178 s (โ 2.0 h) | โ |
| Metric | Value |
|---|---|
| Priority Level | All Level 3 (100%) |
| Priority Score | 0.54 (uniform) |
| Cosine Similarity (median) | 0.705 (Good tier boundary) |
| Token Count (median) | 120 tokens |
Finding โ Output Mode Collapse: The 3k model generates near-identical descriptions for all PASS images. Main Girder is mentioned in 100% of predictions; Rebar Exposure in 99.6%; Spalling in 98.6%. This stereotyped output pattern causes uniform priority scores (Level 3 saturation). See paper_damage_vlm/1_Methodology/methodology.tex for full analysis.
| Metric | PASS (n=727) | FAIL (n=73) |
|---|---|---|
| Cosine similarity (median) | 0.705 | 0.659 |
| Token count (median) | 120 | 97 โ ฮธ_low |
The Quality Guard preferentially retains predictions with higher semantic alignment โ even though the filter is defined only on output-text properties, it acts as a proxy for semantic quality.
| Figure | Description |
|---|---|
figures_vlm/10_priority_score_violin.png | Priority score saturation + PASS vs FAIL cosine similarity + token count violin |
figures_vlm/10_member_damage_analysis.png | Member/damage frequency bars + co-occurrence heatmap |
pipeline_v063.py โ Full end-to-end v0.6.3 pipelinecreate_figures_10.py โ Analysis figures for n=800 resultsdata/v03_fine_tuning/evaluations/v063_scoring_results.csv (800 rows, 22 columns)The academic paper (paper_damage_vlm/1_Methodology/methodology.tex) is complete with all v0.6.3 results:
Completion Date: 2026-05-25
Experiment: Controlled comparison of 3 input image datasets at 1k scale
LLaVA-1.5-7B uses a CLIP ViT-L/14-336 vision encoder pretrained at 336ร336 px. Feeding images at arbitrary sizes forces internal rescaling and introduces resampling artifacts into the patch embeddings, potentially degrading fine-tuning quality. This experiment quantifies the impact of pre-standardising training images to the model's native resolution.
| Step | Description | Output |
|---|---|---|
| 1 | Long-side resize to 1024 px (aspect-ratio preserved) | data/inspect_images_v2/ โ 10,789 images |
| 2 | Manual removal of blueprints / blank / corrupted images | 10,668 images remain (121 removed) |
| 3a | Center-crop to square โ resize to 336ร336 | data/inspect_images_336/ โ 10,668 images, ~0.034 MB avg |
| 3b | Center-crop to square โ resize to 448ร448 | data/inspect_images_448/ โ 10,668 images, ~0.060 MB avg |
Center-crop (rather than pad-and-resize) was chosen because bridge damage photos are mixed portrait/landscape. Padding introduces black borders that divert the vision encoder's attention from damage regions.
| Dataset | Image Source | Image Size | Training Time | eval_loss | eval Token Accuracy |
|---|---|---|---|---|---|
| pairdata_v2-1 | rank_c_images_n10789 | Variable (original) | 1:34:53 | 3.189 | 89.5% |
| pairdata_v2-2 | inspect_images_336 | 336ร336 px | 1:21:46 | 3.194 | 90.1% |
| pairdata_v2-3 | inspect_images_448 | 448ร448 px | 1:21:57 | 3.202 | 89.9% |
All runs:
train_v07_qlora.py, LoRA r=32/ฮฑ=64, LR=2e-4, batch_size=4, BF16, RTX 4060 Ti 16GB
336ร336 px is the optimal input size for LLaVA-1.5-7B fine-tuning on bridge damage images:
config.yaml and train_v07_qlora.py now default to data/inspect_images_336/:
# config.yaml โ v0.7.1
v03_dataset:
image_dir: "data/inspect_images_336" # 336ร336 center-crop (LLaVA-1.5 native)
# image_dir: "data/inspect_images_448" # 448ร448 alternative
# image_dir: "data/inspect_images_v2" # max 1024px long side (original)
resize_images_v2.py โ Step 1: long-side 1024 px resizecrop_resize_images.py โ Steps 3a/3b: center-crop + resize to 336 and 448train_v07_qlora.py โ Added --image-base-dir CLI option for dataset switchingCompletion Date: 2026-05-27
Scope: Full progressive QLoRA retraining on denoised pairdata_v2 with inspect_images_336
1k, 2k, 3k, 4k) under a fixed training recipepaper_damage_vlm/1_Methodology/figures_vlm/11_s4_validation_loss_pairdata_v2.png| Scale | Train | Val | Skip | Duration | Final eval_loss | Final eval Token Accuracy |
|---|---|---|---|---|---|---|
| 1k | 792 | 198 | 10 | 1h 21m | 3.194 | 90.1% |
| 2k | 1579 | 395 | 26 | 2h 56m | 3.151 | 98.7% |
| 3k | 2374 | 594 | 32 | 4h 24m | 3.135 | 99.0% |
| 4k | 3168 | 792 | 40 | 5h 55m | 3.125 | 99.2% |
1k -> 2k (-0.043 nats eval loss, +8.6 pp token accuracy)2k -> 3k: -0.016 nats, +0.3 pp3k -> 4k: -0.010 nats, +0.2 pp3.124), then slightly increases at epoch 3 (3.125), suggesting near-convergenceTest set: n=800, pairdata-v2 ground truth
Evaluator: paraphrase-multilingual-MiniLM-L12-v2 (cosine similarity)
Tier thresholds: Excellent โฅ 0.85 ยท Good โฅ 0.70 ยท Acceptable โฅ 0.55 ยท Poor โฅ 0.40 ยท Very Poor < 0.40
| Scale | Mean ฯ | ฯ | Median | Good+ (%) | V.Poor (%) |
|---|---|---|---|---|---|
| 1k | 0.5657 | 0.1573 | 0.5916 | 35.2 | 32.9 |
| 2k | 0.6011 | 0.1367 | 0.6137 | 40.6 | 21.9 |
| 3k โ | 0.6013 | 0.1437 | 0.6213 | 39.8 | 21.5 |
| 4k | 0.5742 | 0.1398 | 0.6014 | 33.8 | 28.2 |
All four models fall in the Acceptable tier under pairdata-v2 thresholds.
Absolute values are ~0.08โ0.09 lower than pairdata-v1 results, reflecting the harder matching task of shorter denoised ground-truth texts.
Key findings:
1k โ 2k: +6.3% mean gain (largest improvement)2k โ 3k: ฮฯ = 0.0002 (saturation)4k: โ4.5% from 3k (overfitting: VPoor rises 21.5% โ 28.2%)Model selected: 3k
Rationale: peak mean (0.6013) + highest median (0.6213) + lowest Very Poor rate (21.5%).
Result is consistent with pairdata-v1 finding where 3k also achieved peak performance (ฯ = 0.6909).
Figures generated:
paper_damage_vlm/1_Methodology/figures_vlm/12_v072_similarity_by_scale.pngpaper_damage_vlm/1_Methodology/figures_vlm/13_v072_tier_distribution.pngpaper_damage_vlm/1_Methodology/figures_vlm/14_v072_cosine_violin.png.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 1k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 2k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 3k
.\.venv-train\Scripts\Activate.ps1 ; python -u train_v07_qlora.py --train-size 4k
paper_damage_vlm/1_Methodology/methodology.tex (ๆฌ็ทจใฎใฟใSupplementaryๅ้ขๆธใฟ)paper_damage_vlm/1_Methodology/methodology_supp.tex (Supplementary ็ฌ็ซใใกใคใซใS.6็ต่ซๅซใ)paper_damage_vlm/1_Methodology/methodology.pdf (23 pages, recompiled)paper_damage_vlm/1_Methodology/methodology_supp.pdf (7 pages, recompiled)Completion Date: 2026-05-30
Scope: pairdata_v3 denoising; LoRA rank ablation r=16/32/64 at 2,500-sample scale; Supplementary 2 full documentation
| Run | r | eval_loss (best) | token_acc (best) | train_loss | Duration |
|---|---|---|---|---|---|
| v0.8-r16 | 16 | 3.138 | 98.73% | 3.567 | 3h24m |
| v0.8-r32 | 32 | 3.133 | 98.83% | 3.489 | 5h36m |
| v0.8-r64 | 64 | 3.122 | 98.90% | 3.419 | 3h27m |
All best checkpoints at epoch 2.421 of 3.
r=64 selected as optimal: 168.8M trainable parameters (4.56% of 7B backbone) provide sufficient representation space to learn the fine-grained correspondence between complex damage imagery and structured recognition text (member type ร damage category). r=16/32 (42M/84M) leave a residual alignment gap. Critically, r=64 adds no measurable GPU cost over r=16 (3h24m vs 3h27m on RTX 4060 Ti 16GB).
Completion Date: 2026-05-30
Scope: DoRA fine-tuning (use_dora=True, r=64) on pairdata_v3 2,500 samples; U.8 Supplementary 2 fully documented
| Run | Adapter | eval_loss (best) | token_acc (best) | train_loss | Duration | ฮeval |
|---|---|---|---|---|---|---|
| v0.8-r64 | LoRA | 3.122 | 98.90% | 3.419 | 3h27m | โ |
| v0.9-r64 | DoRA | 3.119 | 98.92% | 3.417 | 6h51m | โ0.003 |
Best checkpoints at epoch 2.421; final-epoch: LoRA 3.132/98.93%, DoRA 3.132/98.95%.
| # | Question | Result |
|---|---|---|
| (i) | DoRA lower eval_loss than LoRA at same r? | โ 3.119 < 3.122 (ฮ=โ0.003) |
| (ii) | Cosine similarity improvement? | ๐ Pending inference on n=800 test set |
| (iii) | Hallucination reduction? | ๐ Pending inference on n=800 test set |
train_v09_dora.py --lora-r 64# DoRA training
.venv-train\Scripts\Activate.ps1
python -u train_v09_dora.py --lora-r 64 *> v09_dora_r64_log.txt
# Output: models/llava_v09_dora_r64_2500
# Recompile Supplementary 2
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-05-31
Scope: 2048-dim Sentence-BERT evaluation of all 4 adapters on n=800 test set; Quality Guard + Priority Scoring for LoRA r=32 and DoRA r=64; Structural Member & Damage Type analysis; final model selection
| Model | Adapter | Mean Cosine | Median Cosine | Good+ Rate | Excellent Rate |
|---|---|---|---|---|---|
| v0.8-r16 | LoRA r=16 | 0.6464 | 0.6480 | 18.9% | 0.0% |
| v0.8-r32 | LoRA r=32 | 0.6700 | 0.6689 | 32.9% | 0.0% |
| v0.8-r64 | LoRA r=64 | 0.6571 | 0.6606 | 28.4% | 0.0% |
| v0.9-r64 | DoRA r=64 | 0.6846 | 0.6835 | 41.0% | 0.0% |
Embedding model: hotchpotch/static-embedding-japanese (1024-dim) โ intfloat/multilingual-e5-large (1024-dim), L2-normalized concatenation.
| Model | PASS | FAIL | Token Mean | Token ฯ | Level 3 | Level 4 | Level 5 |
|---|---|---|---|---|---|---|---|
| LoRA r=32 (v0.8) | 798 (99.8%) | 2 (0.2%) | 89.5 | 18.9 | 8.0% | 79.2% | 12.8% |
| DoRA r=64 (v0.9) | 798 (99.8%) | 2 (0.2%) | 84.3 | 4.5 | 0.0% | 100% | 0.0% |
ฮธ_low=30, ฮธ_high=200 (retained from v0.7.3).
| # | Finding | Detail |
|---|---|---|
| (i) | DoRA r=64: highest embedding score | Mean cosine 0.6846, Good+ 41.0% โ best among all adapters |
| (ii) | DoRA r=64: output-level mode collapse | Token ฯ=4.5 (vs LoRA 18.9); all 798 PASS โ Level 4 (100%) |
| (iii) | DoRA r=64: structural member/damage collapse | Main Girder+Deck Slab 100%, Crack/Rebar/Spalling 100% โ stereotyped template |
| (iv) | LoRA r=32: balanced severity distribution | Level 3โ (8.0% vs v0.7.3-3k 2.7%); Level 3/4/5 distribution improves fairness |
| (v) | DoRA r=64 fine-tuning failed | r=64 likely excessive for DoRA; fine-tuning protocol to be established as future work |
| (vi) | LoRA r=32 (v0.8) adopted as final model | Best balance of embedding quality and output diversity |
| Model | Main Girder | Curb | Deck Slab | Crack | Rebar Exp. | Spalling | Lime Effl. |
|---|---|---|---|---|---|---|---|
| LoRA r=32 | 100% | 60.0% | 9.9% | 100% | 88.1% | 99.0% | 73.9% |
| DoRA r=64 | 100% | 0% | 100% | 100% | 100% | 100% | 0% |
DoRA r=64 assigns exactly 3 damage types to exactly 2 members across all 798 predictions: clear evidence of fine-tuning failure.
| Figure | File | Content |
|---|---|---|
| Fig. 22 | 22_v08_similarity_by_adapter.png | Mean/Median cosine similarity by adapter |
| Fig. 23 | 23_v08_tier_distribution.png | Tier distribution stacked bar |
| Fig. 24 | 24_v08_cosine_violin.png | Cosine similarity violin plots |
| Fig. 25 | 25_v08_token_distribution.png | Token count histograms (LoRA r=32 vs DoRA r=64) |
| Fig. 26 | 26_v08_guard_breakdown.png | PASS/FAIL + reason code breakdown |
| Fig. 27 | 27_v08_priority_distribution.png | Priority level distribution |
| Fig. 28 | 28_v08_member_damage_r32_dora.png | Structural member ร damage co-occurrence (S.7.1 style) |
# Sentence-BERT evaluation (4 models)
.venv-eval\Scripts\Activate.ps1
python -u evaluate_v08_sbert.py
# Quality Guard + Priority Scoring
python -u pipeline_v08.py
# Generate Figures 22-24 (U.5)
python -u create_u8_figures.py
# Generate Figures 25-27 (U.6)
python -u create_u6_figures.py
# Generate Figure 28 (U.6.1, S.7.1 style)
python -u create_u61_figures.py
# Recompile Supplementary 2 (21 pages)
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-05-31
Scope: U.7 qualitative analysis section fully rebuilt on pairdata v3 (inference_r32.csv); 12 representative PASS images re-selected with member ร damage diversity; caption simplified and enriched; shared keyword highlighting added
| Item | Description |
|---|---|
| Image selection | 12 images re-selected from inference_r32.csv (pairdata v3 test set) using greedy member ร damage diversity |
| Caption structure | Simplified to 3 items: Quality Metrics / GT / Pred |
| Quality Metrics | Sim(emb) (2048-dim cosine) + Priority Score (0โ1) + Level (priority tier 3/4/5) |
| Keyword highlight | Keywords appearing in both GT and Pred rendered in gothic font (\CJKfamily{ipxg}) for visual emphasis |
| s8 folder | All 12 JPEGs replaced (figures_vlm/s8/s8_01_*.jpg โ s8_12_*.jpg) |
| methodology_supp2.pdf rebuilt โ 19 pages |
| # | Member | Damage | Sim(emb) | Priority | Level |
|---|---|---|---|---|---|
| 01 | girder | cracking | 0.840 | 1.00 | 5 |
| 02 | girder | rebar_exposure | 0.808 | 0.81 | 4 |
| 03 | girder | spalling | 0.774 | 0.81 | 4 |
| 04 | girder | corrosion | 0.713 | 0.81 | 4 |
| 05 | girder | settlement | 0.572 | 0.81 | 4 |
| 06 | girder | other | 0.585 | 0.81 | 4 |
| 07 | slab | cracking | 0.806 | 1.00 | 5 |
| 08 | slab | rebar_exposure | 0.778 | 0.81 | 4 |
| 09 | slab | corrosion | 0.741 | 0.81 | 4 |
| 10 | abutment | cracking | 0.798 | 1.00 | 5 |
| 11 | abutment | rebar_exposure | 0.797 | 0.81 | 4 |
| 12 | abutment | spalling | 0.669 | 0.81 | 4 |
.venv-eval\Scripts\Activate.ps1
python create_u7_figures.py
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp2.tex
Completion Date: 2026-06-01
Scope: DoRA fine-tuning at r=16 (full pipeline: train โ merge โ inference โ SBERT โ quality guard โ figures); 3-way rank ablation (LoRA r=32 vs. DoRA r=32 vs. DoRA r=16) with Figures 35โ41 and U.7.2 discussion update
v0.8.4 extends the DoRA investigation with a lower-rank variant (r=16) and performs a full 3-way comparison against the LoRA r=32 baseline and DoRA r=32. The ablation reveals a non-monotone relationship between DoRA rank and output quality: r=16 achieves the most balanced priority distribution despite having the smallest trainable capacity.
| Item | Value |
|---|---|
| Script | train_v09_dora.py --lora-r 16 |
| Adapter | DoRA (use_dora=True), r=16, alpha=32, dropout=0.05 |
| Dataset | pairdata-v3, 2,500 samples (80/20 split) |
| eval_loss (best, ep 2.421) | 3.135 |
| eval_loss (final, ep 3.0) | 3.138 |
| Training duration | 6h 48m 26s |
| Merged model | models/llava_v09_dora_r16_merged/ (85 shards, max_shard_size=200MB) |
| Model | Mean | Std | Median | Good+ (โฅ0.70) |
|---|---|---|---|---|
| LoRA r=32 (v0.8 baseline) | 0.6700 | 0.0657 | 0.6854 | 32.9% |
| DoRA r=32 (v0.9) | 0.6564 | 0.0682 | 0.6691 | 25.0% |
| DoRA r=16 (v0.9) | 0.6717 | 0.0639 | 0.6811 | 36.0% |
| Model | PASS | FAIL | L3 | L4 | L5 | Token mean |
|---|---|---|---|---|---|---|
| LoRA r=32 | 798 (99.8%) | 2 | 64 | 632 | 102 | 89.5 |
| DoRA r=32 | 798 (99.8%) | 2 | 65 | 726 | 7 | 88.0 |
| DoRA r=16 | 797 (99.6%) | 3 | 61 | 705 | 31 | 74.5 |
| DoRA r=64 (ref) | 798 (99.8%) | 2 | 0 | 798 | 0 | 84.3 |
Key finding: DoRA r=64 undergoes complete mode collapse (all Level 4). DoRA r=16 achieves the most balanced Level 3/4/5 distribution among DoRA variants.
| Figure | File | Content |
|---|---|---|
| 35 | 35_u72_similarity.png | Mean/median cosine similarity (3-way bar) |
| 36 | 36_u72_tier.png | Quality tier distribution |
| 37 | 37_u72_violin.png | Cosine similarity violin plots |
| 38 | 38_u72_token.png | Token count histograms |
| 39 | 39_u72_priority.png | Priority level distribution |
| 40 | 40_u72_member_damage.png | Member ร damage co-occurrence analysis |
| 41 | 41_u7_dora_rank_training_loss.png | Validation loss trajectories (3 models) |
| Section | Change |
|---|---|
| U.7.1 | Figure 41 (validation loss) + "Training dynamics" analysis paragraph added |
| U.7.2 | Title updated to "DoRA Rank Ablation Studies: LoRA r=32 vs. DoRA r=32/16" |
| U.7.2 | Figures 35โ40 inserted (3-way 6-panel comparison) |
| U.7.2 Discussion | DoRA r=64 gradient collapse, r=16 balanced output, r=24 proposed as future work |
| methodology_supp2.pdf rebuilt โ 5648 KB |
# Phase 1: Training (requires .venv-train)
.\.venv-train\Scripts\python.exe train_v09_dora.py --lora-r 16
# Phase 2: Merge (requires .venv-dora)
.\.venv-dora\Scripts\python.exe merge_dora.py
# Phase 3: Inference (requires .venv-dora, NOT .venv-eval)
.\.venv-dora\Scripts\python.exe inference_v082_lora_dora.py --models r16_dora
# Phase 4: SBERT evaluation
.\.venv-eval\Scripts\python.exe evaluate_v08_sbert.py
# Phase 5: Quality Guard + Priority Scoring
.\.venv-eval\Scripts\python.exe pipeline_v08.py
# Phase 6: Figures 35-40 + U.7.2 update
.\.venv-eval\Scripts\python.exe create_u72_dora_ablation.py
# PDF recompile
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
Completion Date: 2026-06-02
Scope: DoRA r=24 full pipeline; 4-way rank ablation (LoRA r=32 + DoRA r=32/16/24); Figure 15 & Figures 35โ40 updated to 4-model comparison; U.7.2 Discussion extended; U.7.3 Qualitative Analysis added; DoRA r=24 selected as v1.0.0 final model
v0.8.5 completes the DoRA rank ablation study by adding DoRA r=24 โ the midpoint proposed in v0.8.4 to resolve the non-monotone rankโquality tradeoff. The experiment confirms that DoRA r=24 achieves the best overall balance among all tested variants, leading to its adoption as the production model for v1.0.0.
| Item | Value |
|---|---|
| Script | train_v09_dora.py --lora-r 24 |
| Adapter | DoRA (use_dora=True), r=24, alpha=48, dropout=0.05 |
| Dataset | pairdata-v3, 2,500 samples (80/20 split) |
| eval_loss (best, ep 2.421) | 3.137 |
| Training duration | ~6h 50m |
| Merged model | models/llava_v09_dora_r24_merged/ |
| Model | Mean | Std | Median | Good+ (โฅ0.70) |
|---|---|---|---|---|
| LoRA r=32 (v0.8 baseline) | 0.6700 | 0.0667 | 0.6689 | 32.9% |
| DoRA r=32 (v0.9) | 0.6564 | 0.0630 | 0.6602 | 25.0% |
| DoRA r=16 (v0.9) | 0.6717 | 0.0639 | 0.6811 | 36.0% |
| DoRA r=24 (v0.9) | 0.6791 | 0.0635 | 0.6834 | 37.8% |
| Model | PASS | FAIL | L3 | L4 | L5 | Token mean |
|---|---|---|---|---|---|---|
| LoRA r=32 | 798 (99.8%) | 2 | 64 | 632 | 102 | 89.5 |
| DoRA r=32 | 798 (99.8%) | 2 | 65 | 726 | 7 | 88.0 |
| DoRA r=16 | 797 (99.6%) | 3 | 61 | 705 | 31 | 74.5 |
| DoRA r=24 | 798 (99.8%) | 2 | 48 | 674 | 78 | 90.6 |
Key finding: DoRA r=24 achieves the highest SBERT similarity (mean=0.6791, Good+=37.8%) while maintaining a balanced priority distribution (L3/L4/L5 = 6.0%/84.5%/9.8%). This non-monotone optimum confirms DoRA r=24 as the sweet spot for LLaVA-1.5-7B on this structural damage domain.
| Section | Change |
|---|---|
| Figure 15 | Updated to "four models"; DoRA r=24 (eval_loss=3.137) added as 4th curve |
| Training dynamics paragraph | DoRA r=24 convergence behaviour added |
| U.7.2 title | โ "DoRA Rank Ablation Studies: LoRA r=32 vs. DoRA r=32/16/24" |
| U.7.2 Figures 35โ40 | Regenerated as 4-model comparison (added DoRA r=24 column) |
| U.7.2 Discussion | Expanded to 6 paragraphs: rankโquality relationship; figure-level evidence for each of Figs 35โ40; final model selection |
| U.7.3 | New subsection: Qualitative Analysis: Finetuned Model Predictions DoRA r=24 (12 panels, Figure 12โ14 style) |
| methodology_supp2.pdf rebuilt, no errors |
DoRA r=24 (v0.9) is adopted as the v1.0.0 production model based on:
| Item | Value |
|---|---|
| Script | inference_v10_full.py |
| Model | DoRA r=24 merged (models/llava_v09_dora_r24_merged/) |
| Input | Rank_c_image_text_n10789.xlsx (10,903 rows) |
| Pipeline | VLM inference + Quality Guard + Priority Scoring (single pass) |
| Checkpoint | every 2,000 rows โ data/v10_full/checkpoint_{n:06d}.xlsx |
| Speed | 3.5 s/image (batch_size=4, RTX 4060 Ti 16GB) |
| Total time | 10.55 h (37,968 s) |
| Output | data/v10_full/v10_full_r24_dora.xlsx |
| Figure | File | Content |
|---|---|---|
| 15 | 15_training_dynamics.png | Validation loss curves โ 4 models |
| 35 | 35_u72_similarity.png | Mean/median cosine similarity (4-model bar) |
| 36 | 36_u72_tier.png | Quality tier distribution (4 models) |
| 37 | 37_u72_violin.png | Cosine similarity violin plots (4 models) |
| 38 | 38_u72_token.png | Token count histograms (4 panels) |
| 39 | 39_u72_priority.png | Priority level distribution (4 models) |
| 40 | 40_u72_member_damage.png | Member ร damage co-occurrence (4 columns) |
| U.7.3 Figs | s9/s9_01โs9_12.jpg | DoRA r=24 qualitative panels |
# Phase 1: Training (requires .venv-train)
.\.venv-train\Scripts\python.exe train_v09_dora.py --lora-r 24
# Phase 2: Merge (requires .venv-dora)
.\.venv-dora\Scripts\python.exe merge_dora.py --rank 24
# Phase 3: Inference n=800 (requires .venv-dora)
.\.venv-dora\Scripts\python.exe inference_v082_lora_dora.py --models r24_dora
# Phase 4: SBERT evaluation
.\.venv-eval\Scripts\python.exe evaluate_v08_sbert.py
# Phase 5: Quality Guard + Priority Scoring
.\.venv-eval\Scripts\python.exe pipeline_v08.py
# Phase 6: Figures 35-40 (4-way) + U.7.2 Discussion update
.\.venv-eval\Scripts\python.exe create_u72_dora_4way.py
# Phase 7: U.7.3 Qualitative Analysis
.\.venv-eval\Scripts\python.exe create_u73_qualitative.py
# Phase 8: PDF recompile
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
# Phase 9: v1.0.0 full inference โ see v1.0.0 section below
chcp 65001 | Out-Null; [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
.\.venv-dora\Scripts\python.exe -u inference_v10_full.py --checkpoint-every 2000 2>&1 | Tee-Object -FilePath "v10_full_r24_dora_log.txt"
Execution period: 2026-06-02 20:20 โ 2026-06-03 06:53 JST
Scope: Full-dataset deployment of DoRA r=24 model over all 10,903 records; Quality Guard + Priority Scoring end-to-end; member ร damage analysis; Supplementary 2 U.7.4 added to paper
| Metric | Count | Ratio (%) |
|---|---|---|
| Total records | 10,903 | 100.0 |
| Quality Guard PASS | 10,668 | 97.8 |
| Quality Guard FAIL | 0 | 0.0 |
| Missing (no image) | 235 | 2.2 |
| Priority Level 3 | 454 | 4.3 |
| Priority Level 4 | 9,185 | 86.1 |
| Priority Level 5 | 1,029 | 9.6 |
| Total processing time | 10.55 h (37,968 s) | โ |
| Mean speed (batch=4) | 3.5 s/image | โ |
Key finding: PASS rate 97.8% at production scale (n=10,903) is consistent with the validation-set rate. Zero FAIL outputs confirm robust generalisation across the full field dataset. Batch-size-4 processing delivers a 50% speed improvement over single-image inference.
| Member | Count | % of PASS |
|---|---|---|
| Main Girder | 8,293 | 77.7% |
| Deck Slab | 4,139 | 38.8% |
| Curb | 3,404 | 31.9% |
| Railing/Parapet | 2,862 | 26.8% |
| Abutment | 2,180 | 20.4% |
| Expansion Joint | 532 | 5.0% |
| Drainage | 138 | 1.3% |
| Bearing | 78 | 0.7% |
| Damage Type | Count | % of PASS |
|---|---|---|
| Crack | 10,666 | 100.0% |
| Rebar Exposure | 9,837 | 92.2% |
| Spalling | 4,277 | 40.1% |
| Lime Efflorescence | 3,697 | 34.7% |
| Corrosion | 3,645 | 34.2% |
| Deformation | 2,943 | 27.6% |
| Delamination | 675 | 6.3% |
| Deterioration | 468 | 4.4% |
| Member | Most Associated Damage | Co-occ. Rate |
|---|---|---|
| Main Girder | Crack | 100.0% |
| Main Girder | Rebar Exposure | 92.4% |
| Deck Slab | Crack + Rebar Exposure | 100.0% |
| Curb | Corrosion | 81.5% |
| Railing/Parapet | Deformation | 99.9% |
| Abutment | Rebar Exposure | 99.4% |
| Section | Change |
|---|---|
| U.7.4 (new) | "Damage VLM Apps v1.0.0 Test Prediction: n=10,903" โ inference config table, results table, memberรdamage figure & discussion |
| Figure (fig:u74_member_damage) | 3-panel: member frequency / damage type frequency / memberรdamage heatmap for PASS n=10,668 |
| methodology_supp2.pdf rebuilt, no errors |
| File | Description |
|---|---|
data/v10_full/v10_full_r24_dora.xlsx | Final predictions (10,903 rows) |
data/v10_full/checkpoint_{002000โฆ010903}.xlsx | Checkpoints every 2,000 rows |
paper_damage_vlm/1_Methodology/figures_vlm/u74_member_damage_analysis.png | Memberรdamage analysis figure |
# Full inference (10,903 rows, batch_size=4, ~10.5 h on RTX 4060 Ti 16GB)
chcp 65001 | Out-Null; [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
.\.venv-dora\Scripts\python.exe -u inference_v10_full.py --checkpoint-every 2000 2>&1 | Tee-Object -FilePath "v10_full_r24_dora_log.txt"
# Member ร Damage analysis figure (U.7.4)
.\.venv-eval\Scripts\python.exe create_figures_u74.py
# Recompile paper (run twice for cross-references)
Set-Location "paper_damage_vlm\1_Methodology"
pdflatex -interaction=nonstopmode methodology_supp2.tex
pdflatex -interaction=nonstopmode methodology_supp2.tex
Set-Location "..\.."
| Test Scale | Processing Time | Success Rate | Avg Time/Image |
|---|---|---|---|
| Single Image | 42s | 100% | 42s |
| 10-Image Batch | 8m 35s | 100% | 51.6s |
| 50-Image (Est.) | ~43m | - | ~52s |
| 254-Image (Est.) | ~3.6h | - | ~51s |
git clone https://github.com/your-username/damage_text_score.git
cd damage_text_score
# Windows PowerShell
python -m venv .venv
.venv\Scripts\Activate.ps1
# Linux/macOS
python -m venv .venv
source .venv/bin/activate
# PyTorch (CUDA 12.4)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
# llama-cpp-python (GPU version)
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124
# Other dependencies
pip install -r requirements.txt
# LLaVA GGUF Model (Recommended)
python download_llava_gguf.py
# Downloads:
# - models/ggml-model-q4_k.gguf (4.08GB)
# - models/mmproj-model-f16.gguf (624MB)
# Install Ollama
# https://ollama.com/download
# Pull Swallow-8B model
ollama pull swallow8b-lora-n4000-v09-q4:latest
# Test single image (~42s)
python quickstart.py --mode 1
# Process 10-image batch (~8.5 min)
python quickstart.py --mode 2
# Process 50 images (~43 min)
python quickstart.py --mode 3
# Process all 254 images (~3.6 hours)
python quickstart.py --mode 4
data/outputs/
โโโ quickstart_single.csv # Single image result
โโโ quickstart_10images.csv # 10-image results
โโโ quickstart_50images.csv # 50-image results
โโโ quickstart_254images.csv # Full dataset results
CSV Example:
image_name,damage_type,severity,location,risk,priority_score,priority_level,description
kensg-rebarexposureRb_001.png,crack,high,girder,structural,0.952,5,Extensive cracking observed...
JSON Structure:
{
"damage_type": "rebar_exposure",
"severity": "high",
"location": "girder",
"risk": "structural",
"description_ja": "้็ญ้ฒๅบใ่ฆใใใ่
้ฃใ้ฒ่กใใฆใใ...",
"key_features": ["rebar exposure", "moderate corrosion"],
"priority_score": 0.952,
"priority_level": 5
}
from src.pipeline.end_to_end import DamageAnalysisPipeline
# Initialize pipeline
pipeline = DamageAnalysisPipeline("config.yaml")
# Process single image
result = pipeline.process_image("path/to/image.png")
# Batch processing
results = pipeline.process_batch(image_paths, output_csv="results.csv")
| Mode | Model | Size | Time/Image | GPU Usage | Rating |
|---|---|---|---|---|---|
| llama-cpp-python | LLaVA-1.5-7B Q4_K_M | 4.08GB | 51.6s | 100% | โญโญโญโญโญ |
| HuggingFace | llava-1.5-7b-hf | 14GB | 45s | 100% | โญโญโญโญ |
| Ollama | llava:7b | 4.7GB | 88s | 0% (CPU) | โญโญ |
llama-cpp-python (Recommended)
HuggingFace
Ollama
LLaVA-1.5-7B - Vision-Language Model
Swallow-8B - Japanese LLM
damage_vlm_finetune/
โโโ .venv-train/ # Virtual environment: training (v0.7+)
โโโ .venv-pred/ # Virtual environment: inference/Unsloth (v0.5+)
โโโ data/ # Datasets
โ โโโ image_text_inspect_n10789/ # Master dataset (v0.3)
โ โ โโโ Rank_c_image_text_n10789.xlsx # 10,789 annotations
โ โ โโโ rank_c_images_n10789/ # Image files
โ โโโ v03_fine_tuning/ # v0.3 prepared datasets โ
โ โ โโโ test_set_n800.csv # Fixed test set
โ โ โโโ train_1k.csv # Training: 1k samples
โ โ โโโ train_2k.csv # Training: 2k samples
โ โ โโโ train_3k.csv # Training: 3k samples
โ โ โโโ train_4k.csv # Training: 4k samples
โ โ โโโ dataset_preparation_report.md
โ โ โโโ evaluations/ # Evaluation results (v0.5)
โ โ โโโ reports/ # Progressive training reports
โ โโโ rebar_exposure_n254/ # v0.2 validation dataset
โ โ โโโ outputs/ # v0.2 outputs
โ โโโ preprocessed_640x480_n10789/ # Preprocessed images
โโโ models/ # Model files
โ โโโ llava-v1.5-7b-Q5_K_M.gguf # Base model (v0.2)
โ โโโ llava_v03_qlora_1k/ # v0.4.1 LoRA adapters โ
โ โโโ llava_v03_qlora_2k/ # v0.4.2 โ
Recommended
โ โโโ llava_v03_qlora_3k/ # v0.4.3 โ
โ โโโ llava_v03_qlora_4k/ # v0.4.4 โ
โ โโโ scoring_rules.yaml # Rule-based scoring
โโโ src/ # Source code
โ โโโ preprocessing/ # Image preprocessing
โ โ โโโ image_preprocessor.py
โ โโโ vision/ # Vision analysis (v0.1-v0.2)
โ โ โโโ llama_cpp_vision.py # llama-cpp-python
โ โ โโโ gguf_vlm_analyzer.py # GGUF wrapper
โ โ โโโ ollama_vision.py # Ollama integration
โ โโโ structuring/ # JSON structuring
โ โ โโโ json_structurer.py
โ โโโ scoring/ # Priority scoring
โ โ โโโ priority_scorer.py
โ โโโ evaluation/ # v0.5 evaluation โ
โ โ โโโ __init__.py
โ โ โโโ vector_similarity_evaluator.py
โ โโโ pipeline/ # Pipeline orchestration
โ โ โโโ end_to_end.py
โ โโโ utils/ # Utilities
โ โโโ config.py
โ โโโ ollama_client.py
โโโ paper_damage_vlm/ # v0.6 Academic paper
โ โโโ 0_Format_arXiv_pdfLaTex/
โ โ โโโ bridge_damage_vlm_quantization_2026.tex
โ โ โโโ bridge_damage_vlm_quantization_2026.bib
โ โ โโโ figures/
โ โโโ 1_Methodology/
โโโ docs/ # Documentation
โ โโโ ARCHITECTURE.md
โ โโโ GPU_SETUP.md
โ โโโ VLM_COMPARISON_PLAN_v02.md
โ โโโ VLM_VALIDATION_REPORT_v02.md
โโโ prepare_v03_dataset.py # v0.3 dataset preparation โ
โโโ train_v03_qlora.py # v0.4 QLoRA training โ
โโโ create_progressive_training_report.py # v0.5 reporting โ
โโโ config.yaml # Unified configuration โ
โโโ SETUP_VENV_VLM.md # v0.3 setup guide โ
โโโ QUICKSTART_V03_V05.md # v0.3-v0.5 workflow โ
โโโ V03_V05_IMPLEMENTATION_SUMMARY.md # Implementation summary โ
โโโ requirements.txt # Python dependencies
โโโ README.md # This file (English)
โโโ README_JP.md # Japanese documentation
โโโ CHANGELOG.md # Version history
โโโ LICENSE # Apache License 2.0
Legend:
Symptom: Japanese characters appear garbled in PowerShell
Solution:
# Change to UTF-8
chcp 65001
python quickstart.py
Symptom: CUDA out of memory error
Solution:
# config.yaml
llama_cpp_vision:
n_gpu_layers: 20 # Reduce from -1 (all layers) to partial GPU
Symptom: Failed to connect to Ollama
Solution:
# Check Ollama server
ollama list
# Restart server
ollama serve
Symptom: Failed building wheel for llama-cpp-python
Solution:
# Install CUDA version explicitly
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124
# Or enable CUDA via environment variable
$env:CMAKE_ARGS="-DLLAMA_CUBLAS=on"
pip install llama-cpp-python --force-reinstall --no-cache-dir
inspect_images_336).venv-eval environment (CPU-only, separate from .venv-pred)SETUP_ENV_EVAL.md created (.venv-eval setup guide)data/v10_full/v10_full_r24_dora.xlsx (10,903 rows)create_figures_u74.py -> figures_vlm/u74_member_damage_analysis.pngIf you use this project in your research, please cite:
@software{bridge_damage_assessment_2026,
title = {Bridge Damage Assessment and Repair Priority Scoring System},
author = {Your Name},
year = {2026},
version = {0.1.0},
url = {https://github.com/your-username/damage_text_score}
}
Apache License 2.0 - See LICENSE for details
Completion Date: 2026-05-28
Scope: Quality Guard recalibration + keyword structuring pipeline on 3k pairdata_v2 model (n=800)
pipeline_v073.py): n=800 in < 2 seconds| Verdict | Count | Rate |
|---|---|---|
| PASS โ High Quality | 787 | 98.4% |
| FAIL โ Error / Too short | 13 | 1.6% |
| Level | Description | Count | Rate |
|---|---|---|---|
| 3 | Planned maintenance | 21 | 2.7% |
| 4 | Priority repair | 651 | 82.7% |
| 5 | Immediate repair | 115 | 14.6% |
Contrast with v0.6.3 where 100% of PASS samples scored Level 3 (scoring saturation at 0.54).
| Figure | File | Description |
|---|---|---|
| 15 | 15_v073_token_distribution.png | Token count with recalibrated thresholds |
| 16 | 16_v073_guard_breakdown.png | PASS/FAIL verdict breakdown |
| 17 | 17_v073_priority_distribution.png | Priority level distribution |
| 18 | 18_member_damage_comparison.png | Member ร Damage comparison (v0.6.3 vs v0.7.3) |
| 19 | 19_priority_comparison.png | Priority level comparison (v0.6.3 vs v0.7.3) |
.\.venv-pred\Scripts\Activate.ps1
python pipeline_v073.py
methodology_supp.tex โ S.7 Quality Guard Recalibrationmethodology_supp.tex โ S.7.1 Member & Damage Type comparisonmethodology_supp.tex โ S.7.2 Priority Level comparisonmethodology_supp.pdf โ 10 pages, no errorsLast Updated: May 29, 2026 (v0.7.3 โ Quality Guard recalibration, full pipeline, scoring saturation resolved)
Completion Date: 2026-05-29
Scope: Extended semantic similarity evaluation using a 2,048-dimensional composite embedding (n=800 test set ร 4 scales)
v0.7.4 replaces the 384-dimensional single-model evaluator (paraphrase-multilingual-MiniLM-L12-v2) with a 2,048-dimensional composite embedding formed by combining two complementary Japanese-capable sentence encoders. This yields substantially higher and more discriminative cosine similarity scores and revises the optimal training scale from 3k to 2k.
| Component | Model | Dimensions | Properties |
|---|---|---|---|
| M1 | hotchpotch/static-embedding-japanese | 1,024 | Static EmbeddingBag, CPU-native, Japanese-specialised |
| M2 | intfloat/multilingual-e5-large | 1,024 | Transformer encoder, 100+ languages, STS prefix "query: " |
| Combined | L2-normalise โ concat โ re-normalise | 2,048 | Arithmetic mean of per-model cosine similarities |
Given ground-truth text $t^{gt}$ and prediction $t^{pred}$:
Test set: n=800 (pairdata-v2 ground truth), CPU inference
Tier thresholds: Excellent โฅ 0.85 ยท Good โฅ 0.70 ยท Acceptable โฅ 0.55 ยท Poor โฅ 0.40 ยท Very Poor < 0.40
| Scale | Mean ฯ | ฯ | Median | Good+ (%) | V.Poor (%) |
|---|---|---|---|---|---|
| 1k | 0.6725 | 0.0706 | 0.6749 | 37.8 | 0.4 |
| 2k โ | 0.6950 | 0.0824 | 0.7053 | 53.1 | 0.4 |
| 3k | 0.6767 | 0.0751 | 0.6799 | 37.8 | 0.4 |
| 4k | 0.6749 | 0.0742 | 0.6803 | 38.4 | 0.4 |
| Scale | 384-dim MiniLM | 2048-dim Composite | ฮ |
|---|---|---|---|
| 1k | 0.5657 | 0.6725 | +18.9% |
| 2k | 0.6011 | 0.6950 | +15.6% |
| 3k | 0.6013 | 0.6767 | +12.5% |
| 4k | 0.5742 | 0.6749 | +17.5% |
Very Poor rate: 384-dim was 21.5โ32.9%; 2048-dim is uniformly โ0.4%.
| Figure | File | Description |
|---|---|---|
| Fig. 12 | figures_vlm/12_v072_similarity_by_scale.png | Mean/median ฯ by scale; red dashed = 384-dim baseline |
| Fig. 13 | figures_vlm/13_v072_tier_distribution.png | Quality-tier stacked bar chart (2048-dim results) |
| Fig. 14 | figures_vlm/14_v072_cosine_violin.png | Cosine similarity violin plots (2048-dim results) |
paper_damage_vlm/1_Methodology/methodology_supp.tex โ S.6 fully rewritten: evaluator description, Table with 2048-dim values, Key findings (2k peak), Figure 12/13/14 captions, Model selection (3k โ 2k), Extended Evaluation subsubsection with three mathematical formulaspaper_damage_vlm/1_Methodology/methodology_supp.pdf โ 14 pages, recompiled (no errors)| File | Purpose |
|---|---|
evaluate_2048dim.py | 2048-dim composite embedding evaluation script |
create_figures_v072_2048dim.py | Figure 12/13/14 generator from 2048-dim JSON results |
SETUP_ENV_EVAL.md | .venv-eval environment setup guide |
# 1. Create evaluation environment (CPU-only, independent of .venv-pred)
python -m venv .venv-eval
.venv-eval\Scripts\pip.exe install "torch==2.6.0+cpu" --index-url https://download.pytorch.org/whl/cpu
.venv-eval\Scripts\pip.exe install "sentence-transformers==3.3.1" numpy pandas scikit-learn matplotlib seaborn
# 2. Run evaluation (n=800 x 4 scales, ~26 min total on CPU)
.venv-eval\Scripts\python.exe evaluate_2048dim.py
# 3. Regenerate Figure 12/13/14
.venv-eval\Scripts\python.exe create_figures_v072_2048dim.py
Output JSON files: data/v07_fine_tuning/evaluations_2048dim/evaluation_2048dim_{1k,2k,3k,4k}.json
Last Updated: May 29, 2026
Scope: 2k model established as primary pipeline; cross-model comparison figures; full S.7โS.8 supplementary paper update
Building on the v0.7.4 finding that the 2k model is optimal (mean ฯ=0.6950, Good+=53.1%), v0.7.5 designates the 2k QLoRA pipeline as the primary production variant and adds cross-model comparative analysis to the supplementary paper.
figures_vlm/19_member_damage_v073_v075.png
Side-by-side frequency bars and co-occurrence heatmaps comparing the 3k model (v0.7.3) against the 2k model (v0.7.5).
Notable finding โ Cross Beam saturation in 2k:
| Member | v0.7.3 (3k) | v0.7.5 (2k) |
|---|---|---|
| Main Girder | ~100.0% | ~100.0% |
| Cross Beam | ~40% | 98.3% |
| Rebar Exposure | ~99% | ~99% |
The 2k model systematically appends cross beam descriptors in 98.3% of all predictions, reflecting template-driven vocabulary learned from the smaller training corpus.
figures_vlm/20_priority_score_violin.png
Violin plots comparing priority score distributions across all three pipeline versions:
| Version | Model | Mean | Std | Level 4โ5 |
|---|---|---|---|---|
| v0.6.3 | pairdata-v1 3k | 0.54 (point mass) | 0.000 | 0% |
| v0.7.3 | pairdata-v2 3k | 0.838 | 0.070 | 97.3% |
| v0.7.5 | pairdata-v2 2k | 0.811 | 0.025 | ~97% |
Interpretation: v0.6.3 collapses to a single value (mode-collapsed outputs). Both v0.7.x models restore discriminability; v0.7.5 (2k) shows a tighter, more predictable Level-4 cluster (std=0.025) while v0.7.3 (3k) reaches higher scores with greater variance (std=0.070), reflecting its longer training.
paper_damage_vlm/1_Methodology/methodology_supp.tex โ Section S.8
All 12 representative PASS panels updated to display three rows per image:
| Row | Source | Notes |
|---|---|---|
| GT | Original inspection record | Terms shared with Predโ and Predโ both bold |
| Predโ (2k) | v0.7.5 pipeline output | Terms shared with GT bold |
| Predโ (3k) | v0.7.3 pipeline output | Terms shared with GT bold |
Additional formatting changes applied to all 12 panels:
0.675\linewidth (ร0.9 from 0.75)| # | Sim(emb) 2k (Predโ) | Sim(emb) 3k (Predโ) | ฮ |
|---|---|---|---|
| 01 | 0.552 | 0.394 | +0.158 |
| 02 | 0.418 | 0.400 | +0.018 |
| 03 | 0.658 | 0.668 | โ0.010 |
| 04 | 0.441 | 0.397 | +0.044 |
| 05 | 0.537 | 0.504 | +0.033 |
| 06 | 0.643 | 0.622 | +0.021 |
| 07 | 0.593 | 0.592 | +0.001 |
| 08 | 0.700 | 0.685 | +0.015 |
| 09 | 0.555 | 0.489 | +0.066 |
| 10 | 0.770 | 0.756 | +0.014 |
| 11 | 0.798 | 0.783 | +0.015 |
| 12 | 0.656 | 0.722 | โ0.066 |
The 2k model achieves higher Sim(emb) in 9 of 12 panels; the 3k model leads in 3 (panels 03, 07, 12).
| File | Purpose |
|---|---|
create_figures_v075_s71_s72.py | Generates Figure 19 (member/damage comparison) and Figure 20 (priority score violin) |
paper_damage_vlm/1_Methodology/methodology_supp.tex โ S.7.1, S.7.2, S.8 fully updatedpaper_damage_vlm/1_Methodology/methodology_supp.pdf โ 17 pages, no errors (pdflatex)# Generate Figure 19 and Figure 20
.venv-eval\Scripts\python.exe create_figures_v075_s71_s72.py
# Recompile supplementary PDF
cd paper_damage_vlm\1_Methodology
pdflatex -interaction=nonstopmode methodology_supp.tex
Last Updated: June 1, 2026 (v0.8.4 โ DoRA rank ablation r=16/32 full pipeline complete; DoRA r=16 achieves best Good+ rate 36.0% and most balanced priority distribution; U.7.2 updated with 3-way comparison Figures 35โ41; DoRA r=24 proposed as next experiment)