The problem
AI-Based Flood Prediction using Rainfall and River-Level Data is a machine-learning system that forecasts river levels 72 hours ahead from public Indian data: IMD gridded rainfall and CWC gauge levels. Floods in India arrive as a slow build-up, not a sudden event: days of rain upstream raise a river gradually, and by the time the water crosses the danger level there is little time left to move. This project turns reaction into forecast: an LSTM reads the last 14 days of rainfall and river level for one station and predicts the next 72 hours of level, mapped onto warning and danger bands. In the demo build, 14 days of rainfall totalling 342 mm lifted the simulated Ganga level at Patna by 1.84 m — a measured result of the build. A river remembers rain: today's level is the sum of the last two weeks of rain, delayed by the catchment, and that delay makes the forecast possible.
IMD gridded rainfall and CWC gauge levels for the catchment, cleaned and aligned by date.
Follow the working sequence
How it works
The system works end to end as a sequence-forecasting pipeline: rainfall and river-level records are cleaned and aligned by date, a 14-day sliding window of those two series becomes one training example, and an LSTM learns how past rain and levels shape the next 72 hours. At prediction time the trained model is frozen — it does not learn from new data — and reads the latest 14 days to produce three forecast points, which the dashboard compares against the warning and danger levels to set the risk band and fire alerts. Training, evaluation and inference are separate phases with different data: training uses historical monsoon seasons, evaluation uses a held-out monsoon season scored in metres with RMSE and MAE, and inference uses only the most recent 14 days. The demo reproduces the same features and risk logic with a rule-based simulation, labelled as a demo, so the dashboard can be seen without waiting for a training run.
- IMD daily gridded rainfall (0.25° × 0.25° grid, mm per day) is downloaded for the catchment cell and CWC daily gauge levels (m) are collected for the chosen station, then both series are aligned by date.
- Missing days are handled explicitly (forward-fill for short gaps, flagged and excluded for long gaps) and both series are scaled to a common range for training.
- A 14-day sliding window of rainfall and level becomes one input sequence; the target is the river level at +24 h, +48 h and +72 h.
- A two-layer LSTM (64 units per layer, dropout between layers) is trained on historical monsoon seasons with early stopping on validation loss.
- The trained model is evaluated once on a held-out monsoon season using RMSE and MAE in metres; no accuracy percentage is reported because level forecasting is a regression task.
- In the dashboard, the frozen model reads the latest 14 days, outputs the 72-hour forecast, maps each point onto the warning and danger bands, and logs an alert whenever the band changes.
Tech stack:
- Python 3, TensorFlow/Keras
- Pandas, NumPy (data preparation)
- Matplotlib (evaluation plots)
- Flask (dashboard backend)
- HTML, CSS, JavaScript (dashboard frontend)
- IMD gridded rainfall dataset
- CWC gauge-level dataset
- Git, Jupyter Notebook
Dataset & model details
- Dataset: IMD daily gridded rainfall — 0.25° × 0.25° grid (approximately 28 km cells), daily values in mm, covering 1901 onwards, built from 6,955 rain-gauge stations (Pai et al.); joined with Central Water Commission daily river-gauge levels (m) for the selected station. The CWC issues flood forecasts at 338 stations across India (200 level-forecast stations + 138 inflow-forecast stations). A selected subset of years and one station is used for this implementation.
- Task: Sequence-to-sequence regression; input = 14-day window of daily rainfall (mm) and river level (m); output = river level (m) at +24 h, +48 h and +72 h, plus a risk band derived from the station's warning and danger levels.
- Model: LSTM, 2 layers × 64 units, dropout between layers, trained with Adam and mean-squared-error loss; input shape 14 timesteps × 2 features; output 3 forecast horizons. Training (offline, on historical seasons) is fully separated from inference (frozen model, latest 14 days only).
- Metrics: RMSE and MAE in metres on a held-out monsoon season. No accuracy percentage is claimed: river level is a continuous value, so error in metres is the honest metric. Final performance depends on the station, the years used, the train/test split and the preprocessing, and the report records only the figures the build's own training run produces.
| Parameter | Value |
|---|---|
| Input window | 14 days of daily data |
| Forecast horizon | 72 hours (+24 h, +48 h, +72 h) |
| Input features | 2 (daily rainfall in mm, river level in m) |
| Model | LSTM, 2 layers × 64 units (design target) |
| Rainfall grid | 0.25° × 0.25°, approximately 28 km cells (IMD datasheet value) |
| Rain-gauge stations behind IMD grid | 6,955 stations (Pai et al., datasheet value) |
| CWC forecast stations (context) | 338 stations (200 level + 138 inflow, CWC published figure) |
| Demo warning level | 47.50 m (design target for the demo scenario) |
| Demo danger level | 48.60 m (design target for the demo scenario) |
| Demo 14-day rainfall | 342 mm (measured from the demo build) |
| Demo level rise | 1.84 m over 14 days (measured from the demo build) |
| Evaluation metrics | RMSE and MAE in metres (no accuracy percentage) |
| Training time | Approximately 20–40 min on a laptop CPU (expected) |
| Inference | Approximately 50 ms per forecast on CPU (expected) |
| Demo | Single-file web app, runs offline after download |
Project features
The strongest capabilities of this project are its 72-hour LSTM river-level forecast, its risk banding, its alert timeline, and its explainability panel that shows which feature drives each risk score. The forecast is the core: a two-layer LSTM reads a 14-day window of rainfall and river level and outputs the expected level at 24, 48 and 72 hours, so the dashboard shows where the river is heading. The risk banding turns that forecast into decisions by comparing every predicted level against the station's warning and danger levels and labelling the result Low, Moderate, High or Severe. The alert timeline records every band change with its time and trigger, and the explainability panel breaks the risk score into its drivers — rainfall history, level above warning, rate of rise and upstream rain. Around those four, the build adds station switching across three gauges, rainfall-and-level charts, and honest demo labelling that separates simulation from the trained model.
- [72-hour LSTM forecast — Implemented] A two-layer LSTM (64 units per layer) reads a 14-day window of daily rainfall and river level and outputs the predicted level at +24 h, +48 h and +72 h for the selected gauge station.
- [Risk-band dashboard — Implemented] Every observed and forecast level is mapped onto Normal, Watch, High and Severe bands against the station's warning and danger levels, with a risk score out of 100 and a colour-coded gauge.
- [Rainfall and river-level charts — Implemented] A 14-day rainfall bar chart (mm per day) sits beside a river-level line chart (m) with the warning and danger levels drawn as reference lines, so the rain-to-rise relationship is visible at a glance.
- [Alert timeline — Implemented] Every band crossing is logged with its date, time and trigger — warning-level crossing, heavy-rain advisory, risk-band change — in a readable timeline.
- [Feature-contribution panel — Implemented] The risk score is broken into its drivers (14-day rainfall, level above warning, rate of rise, upstream rain) with point contributions, so the forecast can be explained in the viva.
- [Three-station switching — Implemented] The dashboard covers three gauge stations — Ganga at Patna, Brahmaputra at Guwahati and Godavari at Rajahmundry — with the demo using Patna's thresholds throughout and labelling them as demo values.
- [Alert delivery (SMS and WhatsApp) — Optional customization] The base build logs alerts on the dashboard; SMS to officials and WhatsApp to riverside residents can be added on request with a messaging provider.
- [Live IMD and CWC data feed — Future scope] The base build trains on downloaded IMD and CWC datasets; automatic daily fetching of fresh readings is future scope and is not claimed as implemented.
What is included
- Complete data-preparation and training Jupyter notebook (IMD + CWC pipeline)
- Trained LSTM model file with the preprocessing code and frozen weights
- Forecast dashboard (72-hour forecast, risk bands, alert timeline, charts)
- Evaluation report with RMSE and MAE in metres on a held-out monsoon season
- Project report PDF (background, LSTM theory, data sources, methodology, results)
- PPT presentation for final review
- Viva Q&A preparation document (LSTM, sequence windows, RMSE vs accuracy, data limitations)
Limitations & prerequisites
- A flood forecast is a prediction, not a warning: this is an academic prototype and must never be presented as an official flood warning or used for evacuation decisions.
- The model is trained for one gauge station at a time; a new station needs its own data download and training run.
- The IMD 0.25° grid cell covers roughly 660 sq km, so it cannot represent rainfall in a small catchment; localised cloudbursts may be missed.
- CWC gauge data access varies by station and period; some series need registration or a data request, which can delay the build.
- The demo dashboard is a rule-based simulation with illustrative data (342 mm over 14 days), clearly labelled — it is not the trained model and not live data.
- Heavy rain upstream of the gauge, dam releases and tidal effects are not modelled; the forecast can under-predict when those dominate.
- RMSE and MAE are reported in metres only after the build's own training run; no performance figure is promised in advance.
Frequently Asked Questions
Which datasets are used and where do they come from?
IMD daily gridded rainfall (0.25° × 0.25° grid, built from 6,955 rain-gauge stations) and Central Water Commission daily river-gauge levels for the selected station. Both are public Indian government sources: IMD through its data portal and CWC through its flood-forecasting system, which covers 338 stations. The build downloads the data, aligns the two series by date and station, and documents the exact years used.
Which model is used and why an LSTM?
A two-layer LSTM with 64 units per layer. River level depends on the history of rain and level, not just today's values, and an LSTM keeps that history in its memory cells across the 14-day input window. A plain regression on today's rainfall would miss the catchment delay entirely. Training happens offline on historical monsoon seasons; inference uses the frozen model on the latest 14 days only.
What accuracy does the model achieve?
No accuracy percentage is claimed or promised, because river level is a continuous value and accuracy is a classification metric. The model is evaluated with RMSE and MAE in metres on a held-out monsoon season, and the report records only the figures the build's own training run produces. A useful way to judge it in the viva is the error in metres against the gap between the warning and danger levels.
Can the project cover my local river or a different station?
Yes, with a fresh data download and training run for that station. The pipeline is station-agnostic: the same code reads any IMD grid cell and any CWC gauge series, but the warning and danger levels, the catchment behaviour and the trained weights are all station-specific. The dashboard already supports three stations, and more can be added the same way.
Can this project be customized?
Yes. Realistic additions are more gauge stations, SMS and WhatsApp alert delivery, a live daily data feed, a map view of the catchment, and a comparison of LSTM against simpler baselines such as ARIMA. Each is scoped separately, since station data access and messaging providers vary.
Is this project suitable for a final-year project?
Yes, for Computer Science, IT and AI & Machine Learning programs. It demonstrates time-series data preparation, sequence modelling with LSTM, regression evaluation with RMSE and MAE, and a working forecast dashboard with alerts, and it works with real public Indian hydrological data rather than toy data.
Components & software requirements
- Python 3, TensorFlow/Keras
- Pandas, NumPy (data preparation)
- Matplotlib (evaluation plots)
- Flask (dashboard backend)
- HTML, CSS, JavaScript (dashboard frontend)
- IMD gridded rainfall dataset
- CWC gauge-level dataset
- Git, Jupyter Notebook
Dataset & model details
- Dataset: IMD daily gridded rainfall — 0.25° × 0.25° grid (approximately 28 km cells), daily values in mm, covering 1901 onwards, built from 6,955 rain-gauge stations (Pai et al.); joined with Central Water Commission daily river-gauge levels (m) for the selected station. The CWC issues flood forecasts at 338 stations across India (200 level-forecast stations + 138 inflow-forecast stations). A selected subset of years and one station is used for this implementation.
- Task: Sequence-to-sequence regression; input = 14-day window of daily rainfall (mm) and river level (m); output = river level (m) at +24 h, +48 h and +72 h, plus a risk band derived from the station's warning and danger levels.
- Model: LSTM, 2 layers × 64 units, dropout between layers, trained with Adam and mean-squared-error loss; input shape 14 timesteps × 2 features; output 3 forecast horizons. Training (offline, on historical seasons) is fully separated from inference (frozen model, latest 14 days only).
- Metrics: RMSE and MAE in metres on a held-out monsoon season. No accuracy percentage is claimed: river level is a continuous value, so error in metres is the honest metric. Final performance depends on the station, the years used, the train/test split and the preprocessing, and the report records only the figures the build's own training run produces.
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.