An AI-powered Quality Control platform for civil engineering.
Combines Computer Vision and Google Gemini AI to verify on-site rebar construction against architectural designs, with automated defect detection, instant compliance scoring, BIM integration via Autodesk Revit, and automated authority notification.
A site engineer uploads a photograph of a reinforced concrete column along with the architect's design drawing. The system automatically:
- Detects rod positions, measures spacings and radii using Computer Vision
- Compares measurements against the design using Gemini AI
- Generates a compliance report with a similarity score
- If the score is below 80%, sends an automated alert email to the higher authority
- Exports JSON files that drive Autodesk Revit via Dynamo scripts to visually highlight defective rods in the BIM model
| Layer | Technology |
|---|---|
| Frontend | Angular 17, TypeScript, Tailwind CSS |
| Backend | Python, Flask, Flask-CORS |
| Computer Vision | OpenCV, NumPy, SciPy |
| AI / LLM | Gemini Flash (via GemPrism Gateway) |
| BIM Integration | Autodesk Revit, Dynamo (Python) |
| Hosting | Vercel (Frontend), Render (Backend) |
| Notifications | Gmail SMTP (smtplib) |
- Top View Analysis: Detects rod count, average radius, and perimeter spacings from a top-view site photograph
- Side View Analysis: Detects vertical stirrup spacing from a side elevation photograph
- Scale Calibration: Optional pixel-to-mm calibration using a physical reference object in the photo
- AI Design Extraction: Gemini reads the architect's drawing and extracts design specifications automatically
- Compliance Scoring: Weighted similarity score (Rod Count 40%, Spacing 40%, Radius 20%)
- BIM Integration: Downloads JSON files that highlight defective rods and colour-code spacings in Revit
- Authority Notification: Automatic email alert with compliance table and annotated image when score < 80%
- CSV Export: Download the full compliance report as a spreadsheet
| Site Photograph | Architect's Design |
|---|---|
![]() |
![]() |
After downloading the result JSON files from the website, the Dynamo scripts are run inside Autodesk Revit to visualise the results directly on the BIM model.
| Rod Lines (Colour-coded spacings) | Rod Highlight (Defective rod) |
|---|---|
![]() |
![]() |
- π’ Green: Acceptable spacing
- π‘ Yellow: Minor Mismatch
- π΄ Red: Not Acceptable
- π΄ Red Circle: Defective or misplaced rod
| Parameter | Design Spec | Site Actual | Status |
|---|---|---|---|
| Number of rods | 8 | 8 | β Acceptable |
| Radius of rods (avg) | 8.0 mm | 12.76 mm | β Not Acceptable |
| Distance R1 to R2 | 125.0 mm | 162.36 mm | |
| Distance R2 to R3 | 125.0 mm | 181.16 mm | β Not Acceptable |
| Distance R3 to R4 | 125.0 mm | 148.91 mm | β Not Acceptable |
| Distance R4 to R5 | 154.0 mm | 185.37 mm | β Not Acceptable |
| Distance R5 to R6 | 125.0 mm | 141.59 mm | β Acceptable |
| Distance R6 to R7 | 125.0 mm | 191.42 mm | β Not Acceptable |
| Distance R7 to R8 | 125.0 mm | 155.55 mm | β Not Acceptable |
| Distance R8 to R1 | 154.0 mm | 199.60 mm | β Not Acceptable |
The CSV report, Rod Lines JSON, and Rod Highlight JSON can all be downloaded directly from the result page on the website. These files are then used with the Dynamo scripts inside Autodesk Revit to produce the BIM visualisations shown above. The Dynamo scripts are located at
test_dataset/revit_models/dynamo_scripts/.
When the similarity score is below 80%, the system automatically sends an email alert to the higher authority.
- After analysis, the result screen shows either:
- π’ "Work is acceptable. You may proceed.": if score β₯ 80%
- π΄ "Please wait. Improvement needed.": if score < 80%
- If the score is below 80%, two input fields appear on screen:
- Column Number: e.g.
C3 - Authority's Email Address: where the alert will be sent
- Column Number: e.g.
- The backend sends an automated email containing the full compliance table and the annotated site photograph
Subject: Rebar Inspection Alert: Column C3 - Score 0%
Rebar Inspection Failed
A recent site inspection for Column C3 has yielded a similarity score of 0%.
Compliance Table
Parameter | Design Spec | Site Actual | Status
Number of rods | 8 | 3 | Not Acceptable
Radius (avg) | 6.0 mm | 25.41 mm | Not Acceptable
Distance R1 to R2 | 125.0 mm | 265.43 mm | Not Acceptable
Distance R2 to R3 | 125.0 mm | 404.40 mm | Not Acceptable
Distance R3 to R1 | 125.0 mm | 276.24 mm | Not Acceptable
[Annotated site photograph attached]
Final Score = (0.40 Γ Rod Count Score) + (0.40 Γ Spacing Score) + (0.20 Γ Radius Score)
Final Score = (0.50 Γ Rod Count Score) + (0.50 Γ Spacing Score)
| Error % | Status |
|---|---|
| β€ 5% | β Acceptable |
| 5% β 15% | |
| > 15% | β Not Acceptable |
Two Python scripts are run inside Autodesk Revit's Dynamo environment. Both scripts auto-detect whether the model has 4 or 8 rods.
Reads highlight_rod.json from the Downloads folder and draws a red circle over the defective rod in the active 3D view.
{ "reset": false, "rod": 3 }Reads rod_lines.json from the Downloads folder and draws colour-coded lines connecting adjacent rods based on their spacing compliance status.
{
"reset": false,
"lines": [
{ "from": 1, "to": 2, "status": "Acceptable" },
{ "from": 2, "to": 3, "status": "Not Acceptable" },
{ "from": 3, "to": 4, "status": "Minor Mismatch" }
]
}Both JSON files are generated and downloadable directly from the result page on the website.
RebarAnalysis/
βββ run.bat
βββ backend/
β βββ src/
β β βββ app.py # Flask API (routes, email)
β β βββ analysis_service.py # OpenCV top-view analysis
β β βββ side_view_service.py # OpenCV side-view analysis
β β βββ scoring_utils.py # Compliance scoring logic
β βββ .env.example
β βββ requirements.txt
β
βββ frontend/
β βββ src/
β βββ app/
β β βββ app.component.ts # Main logic
β β βββ app.component.html # UI template
β β βββ app.component.scss # Styles
β β
β βββ environments/
β βββ environment.ts # Development environment config
β
βββ test_dataset/
βββ lab_columns/ # C1βC8 test images and outputs
β βββ C6/ # Full demonstration dataset
β βββ C6_site.jpeg
β βββ C6_design.jpeg
β βββ C6_annotated.jpg
β βββ C6_revit_rodlines.png
β βββ C6_revit_rodhighlight.png
β βββ C6_output_report.csv
β βββ C6_output_rod_lines.json
β βββ C6_output_highlight_rod.json
βββ revit_models/
β βββ 4_rod_model.rvt
β βββ 8_rod_model.rvt
β βββ dynamo_scripts/
β βββ rodhighlight.py
β βββ rodlines.py
βββ use_case_examples/
βββ top_view/
βββ side_view/
cd backend
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txtCreate a backend/.env file:
SENDER_EMAIL=your_gmail_address@gmail.com
SENDER_APP_PASSWORD=your_gmail_app_password
To get a Gmail App Password: Google Account β Security β 2-Step Verification β App Passwords
Start the backend:
cd src
python app.pyCreate a frontend/src/environments/environment.ts file:
export const environment = {
production: false,
gemprismApiKey: 'gp_live_TOKEN',
gemprismBaseUrl: 'https://gemprism.vercel.app',
apiBaseUrl: 'http://localhost:5000'
};
Start the backend:
cd frontend
npm install
ng serveOpen http://localhost:4200 in your browser.
- Go to rebaranalysis.vercel.app or run locally
- Select Top View or Side View mode
- Upload the site photograph and the architect's design drawing
- Click on each rod center to mark it on the image
- Optionally set a reference scale by marking two known points and entering the real distance in mm
- Click Run Analysis Engine
- View the compliance report and similarity score
- If score < 80%, enter the column number and authority email, an alert will be sent automatically
- Download the Rod Lines JSON and Rod Highlight JSON
- Place both files in your
Downloadsfolder - Open Autodesk Revit with the appropriate
.rvtmodel - Run
rodlines.pyandrodhighlight.pyvia Dynamo to visualise results in BIM
Full end-to-end demonstration available on Google Drive: View Demonstration β




