A machine learning project that predicts car temperature based on environmental conditions and car characteristics using thermal imaging data. This capstone project was developed at SRM University - AP, Andhra Pradesh to improve fuel efficiency in automobiles through temperature prediction.
- Abstract
- Project Overview
- Objectives
- Dataset
- Project Structure
- Requirements
- Installation
- Methodology
- Models Implemented
- Results
- Key Findings
- Benefits of Thermal Imaging
- Future Work
- Team Members
- References
With emerging technology, engineers have developed methods to monitor car temperature using thermal sensors. This project proposes a simpler, cost-effective solution to predict the temperature range of a car using just two parameters: car color and current outside temperature - without requiring any physical devices.
When a vehicle is parked in the sun, temperature levels in the cabin can be more than 20°C above the ambient temperature. This project helps:
- Determine car temperature in different weather conditions
- Provide insights on fuel savings during hot summer days
- Enable consumers to efficiently plan their air conditioning usage
- Help new car buyers analyze vehicle efficiency
Temperature of an automobile significantly impacts its fuel efficiency. When drivers return to cars parked in sunlight and immediately use air conditioning to decrease temperature, it compromises fuel efficiency by increasing consumption.
Instead of using expensive automatic temperature analysis devices, we use thermal imaging analysis with a FLIR (Forward Looking InfraRed) camera to:
- Capture thermal data of automobiles
- Train machine learning models on the captured data
- Predict car temperature using only external parameters
- Provide temperature range predictions without thermal cameras
- Increase fuel efficiency of automobiles by providing temperature data to consumers without using thermal cameras
- Use multiple machine learning models to improve accuracy and predict automobile temperature range
- Improve thermal imaging applications to solve real-world problems with simple and feasible techniques
- Enable informed decision-making for both current and prospective car owners
Data was collected using a FLIR (Forward Looking InfraRed) thermal camera provided by the mentor.
Key Features:
- Time: Time of day when measurement was taken
- Temperature of Day: Current ambient temperature (°C)
- Temperature of Object: Car surface temperature (°C)
- Inside/Outside: Parking location
- Cloudy/Sunny: Weather condition
- Color of Object: Car color (Black, White, Silver, Orange, Green, Blue, Cream, etc.)
| Image No | Name | Time | Temp of Day | Temp of Obj | Location | Weather | Color |
|---|---|---|---|---|---|---|---|
| FLIR0116 | Black Stand | 3:05 PM | 43°C | 42.9°C | Outside | Sunny | Black |
| FLIR0118 | Iron Rod | 12:05 PM | 45°C | 39.7°C | Outside | Sunny | Blue |
| FLIR0122 | Basketball | 12:30 PM | 46°C | 41.6°C | Outside | Sunny | Orange |
| FLIR0132 | Chevrolet Car | 11:00 PM | 41°C | 40.9°C | Outside | Sunny | Cream |
To generate more data points from limited thermal images:
- Thermal images captured in grayscale with fixed dimensions
- Extracted 10 random 8×8 matrices from each image
- Calculated average grayscale value for each matrix (pixel intensity)
- Applied formula to determine exact temperature:
ExactTemp(a) = ((a'/255) × (maxTemp(a) - minTemp(a))) + minTemp(a)
Where:
a= Image pixel matrix (r1, r2)a'= mean(a) - average grayscale value- Result: 10 temperature measurements per image, drastically increasing dataset size
Car-temperature-analysis/
│
├── Car temperature analysis.ipynb # Main Jupyter notebook
├── Car Temperature Using Thermal Image_Camera.pdf # Final project report
├── README.md # Project documentation
└── data/
└── Final.csv # Processed dataset (if applicable)
-
Car temperature analysis.ipynb: Complete implementation including:
- Data loading and preprocessing
- Feature engineering (time extraction)
- Model training (Random Forest, Decision Tree, Linear Regression, KNN)
- Model evaluation and comparison
-
Car Temperature Using Thermal Image_Camera.pdf: Comprehensive final report containing:
- Literature survey
- Detailed methodology
- Results and visualizations
- Thermal graphs for different car colors
- Model performance metrics
- Python 3.7+
- Jupyter Notebook or JupyterLab
pandas
numpy
scikit-learn
matplotlib
seaborn
-
Clone the repository:
git clone https://github.com/yourusername/Car-temperature-analysis.git cd Car-temperature-analysis -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install required packages:
pip install pandas numpy scikit-learn matplotlib seaborn jupyter
-
Launch Jupyter Notebook:
jupyter notebook
-
Open and run:
- Navigate to
Car temperature analysis.ipynb - Run all cells to reproduce the analysis
- Navigate to
Car Temperature Thermal Image
↓
┌────────┴────────┐
↓ ↓
Grayscale Color Image
↓
├─────────────────┤
↓ ↓
Training Dataset 80% Testing Dataset 20%
└────────┬────────┘
↓
Classification
↓
┌────────┼────────┬────────┐
↓ ↓ ↓ ↓
Linear Random Decision KNN
Regression Forest Tree
└────────┴────────┴────────┘
↓
Performance Values Calculated
↓
Decision
-
Missing Value Handling
- Converted '?' placeholders to NaN values
- Standardized data handling for efficient analysis
-
Feature Engineering
- Extracted hour and minute from time stamps
- Encoded categorical variables (car color, weather conditions)
- Standardized numerical features
-
Train-Test Split
- 80% training data
- 20% testing data
- Ensures uniformity across model evaluations
-
Model Training
- Trained four different ML models
- Evaluated using multiple performance metrics
- Compared results with and without feature engineering
- Ensemble learning method using multiple decision trees
- Reduces overfitting through bagging
- Provides robust predictions through majority voting/averaging
Advantages:
- Unbiased due to training on different data subsets
- Very stable - new data points affect only one tree
- Handles non-linear relationships effectively
Disadvantages:
- High computational complexity
- Longer training time than individual models
- Requires more computational resources
- Tree-based learning with hierarchical decision rules
- Each node represents a feature split
- Leaf nodes provide final predictions
Advantages:
- Easy to understand and interpret
- Minimal data preprocessing required
- Handles both categorical and numerical data
Disadvantages:
- Prone to overfitting without pruning
- Higher multidimensional complexity
- Requires more memory for calculations
- Establishes linear relationship between features and target
- Uses least-squares method to fit the line
- Simple statistical model
Equation:
y = b₀ + b₁x₁ + b₂x₂ + ... + bₙxₙ
Advantages:
- Based on fundamental statistical concepts
- Easy to understand and implement
- Fast training and prediction
Disadvantages:
- Does not automatically incorporate non-linearity
- Performance degrades with many variables
- Assumes linear relationships
Note: Linear Regression performed poorly with categorical data in this use case.
- Instance-based learning algorithm
- Predicts based on similarity to k nearest neighbors
- Uses distance metrics (Euclidean, Manhattan)
Advantages:
- No explicit model training required
- Automatically adjusts with new training data
- Effective for non-linear patterns
Disadvantages:
- Computationally expensive with large datasets
- Difficult to determine optimal k value
- Sensitive to feature scaling
R² Score: 0.9998
Mean Absolute Error: 0.0247
Mean Square Error: 0.0069
🏆 Best Overall Performance
R² Score: 1.0
Mean Absolute Error: 5.995 × 10⁻¹⁵
Mean Square Error: 6.074 × 10⁻²⁹
Note: Perfect scores indicate overfitting on training data, performs poorly on categorical features
R² Score: 1.0
Mean Absolute Error: 0.0
Mean Square Error: 0.0
Note: Perfect training scores but may overfit
R² Score: 0.9214
Mean Absolute Error: 1.0375
Mean Square Error: 2.04
Input Parameters:
- Time: 3:50 AM
- Climate: Cold
- Color: Black
- Current Temperature: 25°C
Predicted Car Temperature:
| Model | Predicted Temperature (°C) |
|---|---|
| Random Forest | 31.10 |
| Decision Tree | 32.50 |
| Linear Regression | 10,955.66* |
| KNN | 34.19 |
*Linear regression failed due to categorical data handling
| Model | Strengths | Use Case |
|---|---|---|
| Random Forest | Best balance of accuracy and generalization | Recommended for production |
| Decision Tree | Perfect training accuracy, interpretable | Good for understanding patterns |
| KNN | Good accuracy, simple | Suitable for smaller datasets |
| Linear Regression | Fast, simple | Not suitable for this categorical data |
Dark-colored cars absorb more sunlight and heat up faster than light-colored cars:
- Black cars: Highest temperature increase (up to 45°C+)
- Silver cars: Moderate temperature increase (~42°C)
- White/Cream cars: Lowest temperature increase (~40°C)
- Color Impact: Dark colors can be 5-7°C hotter than light colors
- Black cars: Still highest at ~42.5°C
- Silver cars: ~41.5°C
- Brown/White cars: ~41°C
- Grey cars: Lowest at ~36-37°C
Why darker colors heat up more:
- Darker colors absorb more light energy across the spectrum
- Lighter colors reflect more sunlight away from the surface
- Black surfaces can absorb up to 90% of incident radiation
- White surfaces reflect up to 70% of incident radiation
- Fuel Efficiency: Dark-colored cars require more air conditioning, consuming more fuel
- Parking Strategy: Light-colored cars are better for sunny climates
- Interior Comfort: Cabin temperature can exceed ambient by 20°C+
- Material Consideration: Beyond color, car body material affects heat absorption
-
Non-Contact Measurement
- No physical sensors required
- No installation costs
- No maintenance needed
-
Problem Detection
- Identify overheating components
- Detect cooling system issues
- Locate thermal leaks in HVAC systems
-
Safety & Security
- Detect potential fire hazards
- Identify malfunctioning electrical equipment
- Monitor brake and tire temperatures
-
Cost Reduction
- Early problem detection reduces repair costs
- Improves vehicle efficiency
- Extends component lifespan
-
Energy Efficiency
- Identify energy loss points
- Optimize HVAC system performance
- Better insulation planning
-
Non-Invasive & Non-Destructive
- Ideal for sensitive equipment
- Real-time monitoring
- Large-area coverage
-
Advanced Feature Engineering
- Derive time-based features (morning/afternoon/evening)
- Create temperature difference features
- Include humidity and wind speed data
- Add geographical location data
-
Advanced Algorithms
- Implement Neural Networks for complex pattern recognition
- Test Gradient Boosting algorithms (XGBoost, LightGBM)
- Explore Support Vector Regression (SVR)
- Try Deep Learning models for image-based prediction
-
Hyperparameter Optimization
- Grid Search for systematic parameter exploration
- Random Search for efficient optimization
- Bayesian Optimization for advanced tuning
-
Ensemble Methods
- Implement Stacking to combine multiple models
- Use Bagging for variance reduction
- Apply Boosting for bias reduction
-
Model Validation
- Cross-validation for robust performance estimates
- Time-series validation for temporal data
- Evaluate generalization on unseen car models
-
Deployment
- Create web application for real-time predictions
- Develop mobile app for on-the-go temperature estimates
- Implement API for third-party integration
-
Continuous Improvement
- Collect user feedback
- Regular model retraining with new data
- Adapt to changing climate patterns
- Expand to different geographical regions
- Car Manufacturers: Integrate into vehicle design considerations
- Insurance Companies: Factor in for premium calculations
- Fleet Management: Optimize parking and fuel efficiency
- Consumer Apps: Help buyers choose efficient cars
This project is available for educational and research purposes.
-
Guo, L. H., Tang, F., Chen, J.P. (2012). "Engine Waste Heat Recovery Based on Organic Rankine Cycle." Vehicle Engine, 2012(2): 30-34.
-
Soni, A. K., et al. (2022). "Modelling and thermal analysis for automobile piston using ANSYS." International Journal on Interactive Design and Manufacturing (IJIDeM), 1-15.
-
Sadhukhan, D., et al. (2020). "Estimating surface temperature from thermal imagery of buildings for accurate thermal transmittance (U-value): A machine learning perspective." Journal of Building Engineering, 32, 101637.
-
Miao, Z., et al. (2023). "A novel method based on thermal image to predict the personal thermal comfort in the vehicle." Case Studies in Thermal Engineering, 45, 102952.
-
He, M.G., Zhang, X.X., Zeng, K. (2009). "A New Combined Thermodynamic Cycle for Waste Heat Recovery Vehicle Engine." Journal of Xi'An Jiaotong University, 43(11).
-
Paidi, V., Fleyeh, H., & Nyberg, R. G. (2020). "Deep learning‐based vehicle occupancy detection in an open parking lot using thermal camera." IET Intelligent Transport Systems, 14(10), 1295-1302.
-
Cruz, S., et al. (2021). "Real-time quality control of heat sealed bottles using thermal images and artificial neural network." Journal of Imaging, 7(2), 24.
-
Szurgacz, D., et al. (2021). "Thermal imaging study to determine the operational condition of a conveyor belt drive system structure." Energies, 14(11), 3258.
-
Holst, G. C. (2000). Common sense approach to thermal imaging (Vol. 1). Washington: SPIE Optical Engineering Press.
-
Williams, T. (2009). Thermal imaging cameras: characteristics and performance. CRC Press.
For questions or feedback about this project, please reach out through the university department or open an issue in the repository.
Note: This project was developed as a capstone project for partial fulfillment of Bachelor of Technology degree requirements in Computer Science and Engineering at SRM University - AP.