# SafeVixAI — Research Notebooks 📓 These notebooks are the **research and training layer** of SafeVixAI. Each one processes raw data from the Hub and produces a model, index, or processed dataset used by the live application. --- ## ⚡ One-Click Colab Setup Run this at the top of **any** notebook to mount the full dataset: ```python # Step 1 — Clone the Hub (only run once per session) !git clone https://huggingface.co/datasets/SafeVixAI/SafeVixAI-Dataset-Hub /content/hub # Step 2 — Install dependencies !pip install -q pdfplumber chromadb sentence-transformers ultralytics onnx # Step 3 — Confirm data is accessible import os print("Data folders:", os.listdir("/content/hub")) ``` --- ## 📓 Notebook Index | # | Notebook | What it Produces | Input Data | |---|---|---|---| | 1 | `YOLOv8_Pothole_Detector_Training` | ONNX road damage model | `pothole_training/road_damage_2025/` | | 2 | `ChromaDB_RAG_Vectorstore_Build` | ChromaDB index for legal RAG | `legal/`, `medical/` PDFs | | 3 | `Accident_EDA_&_Hotspot_Generator` | Blackspot seed CSV + heatmap | `accidents/kaggle_india_accidents.csv` | | 4 | `Roads_Data_Processing` | Sampled PMGSY GeoJSON | `roads/pmgsy_roads.geojson` | | 5 | `Risk_Model_ONNX_Training` | Risk scoring ONNX model | `accidents/` + `roads/` | --- ## 📁 Data Paths Used by These Notebooks All notebooks expect data at these paths after cloning the Hub: ``` /content/hub/ ├── chatbot_service/data/ │ ├── accidents/ ← Notebooks 3, 5 │ ├── legal/ ← Notebook 2 │ ├── medical/ ← Notebook 2 │ ├── pothole_training/ ← Notebook 1 │ └── roads/ ← Notebook 4 ├── backend/datasets/ ← Notebook 4, 5 └── frontend/public/models/ ← Output for Notebooks 1, 5 ``` --- ## 🏃 Running Order For a full pipeline run, execute notebooks in this order: ``` 1 → Train pothole detector → produces ONNX model 2 → Build RAG vectorstore → produces ChromaDB index 3 → Accident EDA → produces blackspot_seed.csv 4 → Roads processing → produces sampled GeoJSON 5 → Risk model → combines accidents + roads → risk ONNX ``` --- ## 💾 Saving Outputs Back After training, outputs land in `/content/hub/`. To persist them: ```python # Commit outputs back to Hub (requires HF token) import os os.environ["HUGGING_FACE_TOKEN"] = "your_token_here" !cd /content/hub && git config user.email "you@example.com" !cd /content/hub && git config user.name "SafeVixAI" !cd /content/hub && git add . && git commit -m "chore: update trained model outputs" !cd /content/hub && git push https://your_username:$HUGGING_FACE_TOKEN@huggingface.co/datasets/SafeVixAI/SafeVixAI-Dataset-Hub main ``` --- *Part of the [SafeVixAI](https://github.com/SafeVixAI/SafeVixAI) — IIT Madras Road Safety Hackathon 2026*