Computer Vision and Machine Learning for Inland Empire Freight Traffic Analysis
A Leonard Transportation Center (LTC) research project analyzing freight exposure and environmental justice in California's most freight-intensive region.
- Quick Start
- Project Overview
- Repository Structure
- Installation & Setup
- Data Pipeline
- Key Results
- Research Context
- Technical Documentation
- Contact & Acknowledgments
For First-Time Users:
- Review the proposal: Start with
LTC Proposal Freight Services_BK.docx.mdto understand the research objectives and methodology - Install dependencies: Follow the Installation & Setup section below
- Explore sample outputs: Check the segmentation examples:
sample_truck_segmentation.pngand.json(original demo)sample_truck_segmentation_20251201.pngand.json(latest version)
- Examine data structure: Navigate through the
data/raw_images/directory organized by camera location - Review results: See
OpenSeeD/extracted_data_full/for processed segmentation outputs
Key Files to Start With:
- 📄
LTC Proposal Freight Services_BK.docx.md- Full research proposal and methodology - 📊
DATA.md- Important! How to obtain camera images and data - 📸
sample_truck_segmentation*.png- Visual demonstration of segmentation capabilities - 📊
sample_truck_segmentation*.json- Sample JSON output structure - 📝
requirements.txt- Python dependencies list
⚠️ Data Notice: Raw camera images (~19,543 files, ~5-6GB) are NOT included in this repository due to size constraints and licensing. See DATA.md for instructions on obtaining the data.
FreTIS (Freight Traffic Intelligence System) is a research initiative that transforms freeway camera imagery into actionable freight analytics to address environmental justice concerns in Southern California's Inland Empire.
- Computer Vision Pipeline: Develop Inland Empire-specific freight vehicle detection and segmentation using OpenSeeD
- Freight Metrics: Quantify truck volumes, temporal patterns, and freight intensity across major corridors
- Data Integration: Combine vision-derived metrics with demographic, environmental, health, and safety datasets
- Correlation Analysis: Assess freight exposure impacts on disadvantaged communities
- Predictive Modeling: Forecast truck volumes 1-7 days ahead for proactive risk alerts
- Policy Support: Deliver web-based analytics and peer-reviewed research
The Problem:
- 11.15M+ medium-duty truck trips annually (2021)
- 5.73M+ heavy-duty truck trips annually (2021)
- 2.63M+ residents exposed to freight corridors (2024)
- 700+ large distribution centers with continued expansion
- Elevated pollution and health impacts in disadvantaged communities
The Gap: Traditional traffic monitoring (e.g., Caltrans PeMS) provides:
- Aggregate flow data without vehicle-type detail
- No lane-level behavior analysis
- No visual/incident context
- Poor freight vehicle classification
FreTIS Solution:
- Vehicle-specific freight measurement
- Lane-level analysis with visual context
- Camera-level spatial resolution
- Hourly temporal resolution
- Integration with environmental justice data
IE_TrafficSeg/
│
├── 📄 README.md # This navigation guide
├── 📄 LTC Proposal Freight Services_BK.docx.md # Full research proposal (START HERE!)
├── 📄 requirements.txt # Python dependencies
├── 📄 generate_uml_diagram.py # Project structure visualization tool
├── 📄 scraper.log # Data collection logs
├── 📄 WARP.md # [Documentation file]
│
├── 📸 sample_truck_segmentation.png # Example segmentation output (demo)
├── 📊 sample_truck_segmentation.json # Example JSON output (demo)
├── 📸 sample_truck_segmentation_20251201.png # Latest segmentation example
├── 📊 sample_truck_segmentation_20251201.json # Latest JSON output
│
├── 📂 data/ # All data files
│ └── 📂 raw_images/ # Freeway camera images by location
│ ├── 📁 i1012westofhaven/ # I-10 @ 2 West of Haven
│ ├── 📁 i101810mileswestofcherry/ # I-10 @ 18/10 Miles West of Cherry
│ ├── 📁 i10200i210/ # I-10 @ 200/I-210 Interchange
│ ├── 📁 i1026westofrancho/ # I-10 @ 26 West of Rancho
│ ├── 📁 i1033eastofwaterman/ # I-10 @ 33 East of Waterman
│ ├── 📁 i1587foothillblvd/ # I-15 @ 87 Foothill Blvd
│ ├── 📁 i215207vinestreet/ # I-215 @ 207 Vine Street
│ ├── 📁 sr60153eastofeuclidavemuebonviewavenue/ # SR-60 @ 153 East of Euclid
│ ├── 📁 sr60359westofvalleyway/ # SR-60 @ 359 West of Valley Way
│ └── 📁 sr60362marketstreet/ # SR-60 @ 362 Market Street
│
├── 📂 OpenSeeD/ # Open-vocabulary segmentation model
│ ├── 📂 configs/ # Model configurations
│ ├── 📂 datasets/ # Dataset definitions
│ ├── 📂 demo/ # Demo scripts and examples
│ ├── 📂 extracted_data_full/ # 🔍 PROCESSED OUTPUT - Segmentation results
│ ├── 📂 figs/ # Visualization outputs
│ └── [Additional OpenSeeD model files]
│
├── 📂 src/ # Source code (processing & analysis)
│ └── [Analysis scripts and utilities]
│
└── 📂 venv/ # Python virtual environment (created after setup)
Monitored Corridors:
| Corridor | Camera Locations | Subdirectory Name |
|---|---|---|
| I-10 | 2 West of Haven | i1012westofhaven |
| 18/10 Miles West of Cherry | i101810mileswestofcherry |
|
| 200/I-210 Interchange | i10200i210 |
|
| 26 West of Rancho | i1026westofrancho |
|
| 33 East of Waterman | i1033eastofwaterman |
|
| I-15 | 87 Foothill Blvd | i1587foothillblvd |
| I-215 | 207 Vine Street | i215207vinestreet |
| SR-60 | 153 East of Euclid Ave | sr60153eastofeuclidavemuebonviewavenue |
| 359 West of Valley Way | sr60359westofvalleyway |
|
| 362 Market Street | sr60362marketstreet |
Total Images Processed: ~19,543 (as of proposal date)
- Python 3.8 or higher
- Windows, macOS, or Linux
- ~5GB free disk space (for virtual environment and dependencies)
- Internet connection (for initial setup)
cd C:\Users\Helen\Downloads\LTC_project\IE_TrafficSegWindows (PowerShell/CMD):
python -m venv venv
.\venv\Scripts\activateUnix/macOS:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython -c "import cv2; import torch; import pandas as pd; print('All packages installed successfully!')"- Python not found: Install Python from python.org
- Permission errors: Run terminal as administrator (Windows) or use
sudo(Unix/macOS) - Package conflicts: Try upgrading pip:
pip install --upgrade pip
Freeway Cameras → Image Collection → Vehicle Segmentation → Metric Extraction →
Spatial Analysis → Correlation Analysis → Forecasting → Policy Insights
Source: Caltrans District 8 freeway camerasStorage: data/raw_images/[location]/Format: JPEG imagesSampling: Regular intervals capturing:
- Diverse traffic conditions
- Various lighting scenarios
- Different congestion states
Model: OpenSeeD (Open-vocabulary Panoptic Segmentation)Configuration: OpenSeeD/configs/Process:
- Load image from camera location folder
- Apply OpenSeeD segmentation model
- Identify vehicle instances (cars, trucks, buses)
- Extract roadway elements (lanes, barriers)
- Generate segmentation masks and bounding boxes
Output Location: OpenSeeD/extracted_data_full/Output Format: JSON files with:
- Vehicle classifications (passenger car, light truck, heavy truck)
- Bounding box coordinates
- Lane positions
- Confidence scores
- Timestamps
Example Output: See sample_truck_segmentation_20251201.json
Computed Metrics:
- Hourly truck counts by corridor
- Car-to-truck ratios
- Peak-hour exposure profiles
- Temporal patterns (hourly/daily/weekly)
- Lane-specific vehicle distributions
External Datasets Integrated:
| Category | Source | Data Type |
|---|---|---|
| Demographics | US Census ACS | Income, race/ethnicity, linguistic isolation |
| Environment | CalEnviroScreen 4.0 | Diesel PM, PM2.5, ozone, traffic density |
| EPA EJScreen | Environmental justice indicators | |
| CARB/SCAQMD | Air quality monitoring | |
| Health | CA Healthy Places Index | Asthma ER visits, cardiovascular disease |
| Land Use | SCAG | Warehouse locations, truck routes |
| LODES | Employment patterns | |
| Safety | SWITRS/TIMS | Truck-involved crash records |
Integration Method: Spatial joins at census tract/block group levels
Phase 1 - Correlation Analysis:
- Spatial regression analysis
- Stratified temporal methods
- Testing freight exposure vs.:
- Pollution burden in disadvantaged communities
- Health outcomes (asthma, cardiovascular)
- Crash frequencies
- Warehouse density
Phase 2 - Forecasting:
- Time-series models: ARIMA, Prophet
- Machine learning: Gradient Boosting, LSTM
- Prediction horizon: 1-7 days
- Proactive exposure alerts
- Policy scenario modeling
Figure 2 Analysis (Proposal Section 4):
- Truck traffic: Peaks morning-to-early-afternoon
- Passenger vehicles: Peak later in day
- Key insight: Clear temporal separation demonstrates need for freight-specific analysis rather than aggregate traffic counts
Figure 3 Analysis (Proposal Section 4):
- Significant variation in truck intensity across camera locations
- Some corridors show elevated truck presence despite similar total vehicle counts
- Traditional loop detectors would miss these distinctions
Figure 4 Analysis (Proposal Section 4):
| Corridor | Pattern | Peak Characteristics |
|---|---|---|
| I-10 | Extended high intensity | Sustained daytime freight activity |
| SR-60 | Extended high intensity | Sustained daytime freight activity |
| I-15 | Concentrated peaks | Shorter, focused peak periods |
| SR-91 | Concentrated peaks | Shorter, focused peak periods |
| I-215 | Concentrated peaks | Shorter, focused peak periods |
Key Insight: These hour-by-hour, corridor-by-corridor patterns are not observable using aggregate loop-detector data.
- Vehicle-level segmentation compared against ground-truth annotations
- Cross-referenced with Caltrans PeMS vehicle classification (where available)
- Camera-level spatial resolution enables unprecedented freight analysis detail
Strategic Importance:
- Primary inland distribution hub for goods from Ports of LA/Long Beach
- Major corridors: I-10, I-15, SR-60, SR-91, I-215
Scale (2021 Data):
- Medium-weight truck trips: ~11.15 million
- Heavy-weight truck trips: ~5.73 million
- Population: 2.63+ million residents (2024)
- Warehouse facilities: 700+ large-scale distribution centers
- 2023 expansion: 28+ million sq ft of new warehouse space
Freight Activity Patterns:
- Peaks mid-week
- Aligned with port throughput
- Tied to warehouse operations
- Intensifies September-December (holiday season)
Exposure Burdens (CalEnviroScreen 4.0 / EPA EJScreen):
- Elevated diesel particulate matter
- High PM2.5 and ozone levels
- Increased asthma ER visit rates
- Elevated cardiovascular vulnerability
Demographic Correlations:
- Lower median household income
- Higher renter occupancy
- Greater linguistic isolation
- Proximity to freight corridors
Safety Impact:
- 12,000+ annual truck-involved injury crashes in California (2022-2024)
- Several hundred fatalities annually
- Risk increases during peak freight seasons
Existing research relies on:
- Aggregate traffic counts
- Surveys
- Policy indicators
Missing: Direct, vehicle-specific measurement at appropriate spatial/temporal scales.
FreTIS fills this gap with camera-level, hourly freight exposure metrics.
Full Name: Open-vocabulary Panoptic SegmentationType: Deep learning computer vision modelCapabilities:
- Instance segmentation (individual vehicle detection)
- Semantic segmentation (roadway elements)
- Open-vocabulary recognition (text-driven, flexible labels)
- Single-pass inference (efficient)
Advantages over Fixed-Label Models:
- No predefined vehicle categories required
- Flexible classification ("heavy-duty truck" vs. "passenger car")
- Better generalization to diverse traffic scenes
- Lane-level context understanding
JSON Structure (see sample_truck_segmentation_20251201.json):
{
"image_id": "camera_location_timestamp",
"vehicles": [
{
"type": "heavy_duty_truck",
"bbox": [x, y, width, height],
"confidence": 0.95,
"lane": 2,
"timestamp": "2025-12-01T10:30:00"
},
...
],
"summary": {
"total_vehicles": 45,
"trucks": 12,
"cars": 33,
"truck_percentage": 26.7
}
}- Ground Truth Comparison: Manual annotation of sample images
- PeMS Cross-Reference: Where spatially/temporally aligned data exists
- Inter-Corridor Consistency: Logical pattern verification
- Temporal Plausibility: Expected daily/weekly patterns
| Method | Type | Characteristics |
|---|---|---|
| ARIMA | Statistical | Time-series, trend/seasonality |
| Prophet | Statistical | Robust to outliers, holidays |
| Gradient Boosting | ML Ensemble | Complex non-linear relationships |
| LSTM | Deep Learning | Sequential dependencies, long-term patterns |
Evaluation Metrics:
- Mean Absolute Error (MAE)
- Root Mean Square Error (RMSE)
- Mean Absolute Percentage Error (MAPE)
| Weeks | Phase | Tasks |
|---|---|---|
| 1-3 | Setup & Refinement | Finalize datasets, refine segmentation pipeline |
| 4-6 | Data Integration | Extract freight metrics, integrate demographic/environmental/safety datasets |
| 7-9 | Analysis & Dashboard | Conduct correlation analyses, develop web-based analytics dashboard |
| 10-12 | Publication & Delivery | Finalize analytics product, prepare journal/conference submission |
Current Status: Data collection and preliminary analysis complete (~19,543 images processed)
Principal Investigator: Dr. Bilal Khan California State University-San Bernardino bilal.khan@csusb.edu (909) 537-5428
Student Researcher: Ha Trinh California State University-San Bernardino helentrinh9784@gmail.com
Leonard Transportation Center (LTC) California State University-San Bernardino
This research advances LTC goals in:
- Freight systems analysis
- Transportation equity
- Applied analytics for environmental justice
- Student research mentorship
- Data-driven policy support
Key references are documented in the full proposal (LTC Proposal Freight Services_BK.docx.md), including:
- Khatri, B. (2024). "Truck Traffic Analysis in the Inland Empire." Master's project, CSUSB.
- California crash statistics (CHP, 2022-2024)
- CalEnviroScreen 4.0 (OEHHA, 2023)
- Inland Empire development and population reports (2022-2024)
If you use this code, data, or methods in your research, please cite:
@techreport{Khan2025FreTIS,
author = {Khan, Bilal and Trinh, Ha},
title = {Freight Traffic Intelligence System (FreTIS): Computer Vision and Machine Learning for Inland Empire Freight Traffic Analysis},
institution = {Leonard Transportation Center, California State University-San Bernardino},
year = {2025},
type = {Research Project}
}This project is licensed under the MIT License - see the LICENSE file for details.
Summary:
- ✅ Free to use, modify, and distribute
- ✅ Suitable for academic and commercial use
- ✅ Attribution required (cite our work)
⚠️ Provided "as-is" without warranty
Note: This license applies to the code. Data usage may be subject to additional terms from data providers (e.g., Caltrans). Please consult with the research team before using this project.
- Caltrans District 8: Freeway camera imagery access
- Leonard Transportation Center: Research funding and support
- California State University-San Bernardino: Institutional support
- Community Partners: Input on environmental justice concerns
Last Updated: January 2025 Repository Maintainer: Ha Trinh Documentation Version: 2.0
For questions about navigation or usage, please contact the research team.