← Back to list

I Built an AI System That Predicts Tourist Crowds at Courtallam Waterfalls

Here’s How-

T R Rahul · 2026-04-12 09:32 · 3 claps · 4.7 min read
#machine-learning #python #flask #data-science #tourism-technologies
Open on Medium ↗
Wiki topics: ML · Machine Learning EDU · Education & Learning 🌐 · Web Development 🔬 · Science · General ⚖️ · Law & Justice ✈️ · Travel

I Built an AI System That Predicts Tourist Crowds at Courtallam Waterfalls

Here’s How-

Every year, millions of tourists flock to Courtallam — Tamil Nadu’s “Spa of South India.” But nobody warns them about the chaos waiting on the wrong day. I decided to change that with AI.

The Problem Nobody Was Solving

Picture this: You plan a peaceful weekend trip to Courtallam waterfalls. You wake up at 5 AM, drive 3 hours, and arrive to find 8,000 people already there. The queue stretches half a kilometer. The waterfalls are barely visible through the crowd.

This isn’t a rare scenario — it happens every monsoon season, every festival weekend, every school holiday.

Courtallam sees anywhere from 500 to 45,000 visitors in a single day depending on the season, weather, and day of the week. Yet there was no tool — no app, no website, no system — that could tell a tourist in advance: “Don’t go today. Go Thursday morning instead.” So I built one.

What I Built

Tourist Crowd Forecasting System — an AI-powered web application that predicts the expected number of visitors at Courtallam waterfalls based on:

  • Day of the week
  • Season (Summer / Monsoon / Winter)
  • Whether it’s a weekend or holiday
  • Festival events
  • Rainfall and temperature
  • Month and date

The system classifies predictions into three crowd levels — Low 🟢, Moderate 🟡, High 🔴 — and gives real-time safety advisories, experience scores, and the best time to visit.

Tech Stack

ML Model — Random Forest Regressor , Backend-Flask(python) ,Frontend-HTML,CSS,Bootstrap5 ,Data- Custom dataset , Deployment-Local

The Dataset

One of the biggest challenges was data. There’s no publicly available tourist count dataset for Courtallam. So I built one.

The dataset (Courtallam_Tourist_Crowd_Dataset_1000_Rows.csv) contains 1,000 records with features including:

day_of_week | is_weekend | is_holiday | season |
rainfall_mm | temperature | festival_event | month | day | tourist_count

The target variable is tourist_count — the actual number of visitors on a given day.

Key patterns found in the data:

  • Monsoon season (July–September) sees the highest footfall — people come specifically for the flowing waterfalls
  • Festival days spike visitor counts by 2.5x on average
  • Weekends consistently show 40% more visitors than weekdays
  • Rainfall above 80mm paradoxically increases visitors (the falls flow stronger)
  • Temperature above 38°C significantly reduces visitor count

Building the ML Model

Feature Engineering

Two categorical features — day_of_week and season — needed encoding before feeding into the model.

Python:

from sklearn.preprocessing import LabelEncoder

day_encoder = LabelEncoder() season_encoder = LabelEncoder()

df[‘day_encoded’] = day_encoder.fit_transform(df[‘day_of_week’]) df[‘season_encoded’] = season_encoder.fit_transform(df[‘season’])

I saved both encoders using joblib so the Flask app could reuse them at prediction time without retraining.

Model Selection

I tested three regression models: Linear Regressor , Decision Tree , Random Forest Regressor.

Random Forest won comfortably. Its ability to capture non-linear interactions between features (e.g., rainfall + festival + weekend all happening together) is exactly what this problem needed.

Python:

from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split

X = df[[‘day_of_week’,’is_weekend’,’is_holiday’,’season’, ‘rainfall_mm’,’temperature’,’festival_event’,’month’,’day’]] y = df[‘tourist_count’]

X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 )

model = RandomForestRegressor(n_estimators=100, random_state=42) model.fit(X_train, y_train)

Saving the Model

Python:

import joblib joblib.dump(model, ‘tourist_crowd_model.pkl’) joblib.dump(day_encoder, ‘day_encoder.pkl’) joblib.dump(season_encoder,’season_encoder.pkl’)

Building the Flask Backend

The Flask app has three routes:

**GET /** — Renders the prediction form (index.html)

**POST /predict** — Takes form input, encodes categoricals, runs prediction, returns result page

**GET+POST /dashboard** — A single-page dashboard that shows the form and results side by side

The prediction logic classifies the raw count into crowd levels:

Python:

prediction = int(model.predict(input_df)[0])

if prediction < 3000: level = “Low Crowd 🟢” advice = “Safe day to visit. Enjoy a peaceful trip.” score = “9.5 / 10” elif prediction < 7000: level = “Moderate Crowd 🟡” advice = “Visit early morning for a better experience.” score = “7.5 / 10” else: level = “High Crowd 🔴” advice = “Peak crowd. Authorities should ensure safety measures.” score = “5.5 / 10”

The UI

The frontend was designed with a dark waterfall aesthetic — deep ocean blues, emerald accents, glassmorphism cards with frosted blur effects.

The result page shows:

🔢 Tourist Count KPI — The predicted number with a progress bar on a 0–10K scale

🚦 Crowd Level Badge — Color-coded pill (green/amber/red) with a matching glow effect

Experience Score — A 5-star rating that degrades as crowd density rises

🛡️ Safety Advisory Panel — Actionable advice and best visiting time with a visual crowd meter gauge

📍 Quick Recommendations — Context-aware tips for Parking, Food Stalls, and Best Spots — all changing dynamically based on the predicted crowd level

Key Insights the Model Revealed

After training and analyzing feature importances:

Top 5 most influential features:

  1. festival_event — 28.4% importance
  2. is_holiday — 22.1% importance
  3. season — 18.7% importance
  4. day_of_week — 14.3% importance
  5. rainfall_mm — 9.8% importance

The model confirmed what locals already knew intuitively — festivals and holidays drive crowd behavior far more than weather does. But it also revealed a surprising insight: temperature matters less than rainfall. Tourists will brave heat to see Courtallam, but they come more when it rains.

Challenges I Faced

1. No real-world data existed Building a synthetic but realistic dataset required deep domain knowledge about Courtallam’s actual tourism patterns. I cross-referenced tourism reports, local news, and regional holiday calendars.

2. Categorical encoding at inference time The LabelEncoder must transform inputs in the exact same order as training. Saving and reloading encoders with joblib solved this, but it was a subtle bug that caused wrong predictions during early testing.

3. Making the UI communicate uncertainty A raw number like “8,181 visitors” is meaningless without context. Building the crowd level system, the experience score, and the advisory text transformed a cold number into actionable intelligence.

What’s Next

This project has clear paths forward:

  • Real data integration — Scrape actual footfall data from Tamil Nadu Tourism reports or partner with local authorities
  • 7-day forecast view — Predict the entire upcoming week so tourists can plan ahead
  • Mobile app — A React Native version for on-the-go trip planning
  • Alert system — WhatsApp/SMS notifications when crowd levels cross a threshold
  • Extend to other sites — The same model architecture works for any tourist destination in India

The Bigger Picture

Tourism crowd management is a real public safety issue in India. Stampedes, accidents, and poor visitor experiences cost both lives and livelihoods. A system like this — when fed with real government data and deployed publicly — could help:

  • Tourists plan smarter trips
  • Local authorities pre-deploy police and medical staff
  • Vendors stock up appropriately on high-crowd days
  • The environment by spreading footfall across the week

AI doesn’t have to solve complex research problems to be useful. Sometimes, predicting how many people will show up at a waterfall next Sunday is exactly the right problem to solve.

Try It Yourself

The full project — model, Flask app, dataset, and UI — is available on GitHub.

Github:https://github.com/Rahul-lab826/Tourist-Crowd-Forcasting

To run locally:

git clone https://github.com/Rahul-lab826/Tourist-Crowd-Forcasting cd “tourist crowd server” pip install flask scikit-learn pandas joblib python app.py

Open http://127.0.0.1:5000


메타데이터
post_id
cb47dca68ded
slug
i-built-an-ai-system-that-predicts-tourist-crowds-at-courtallam-waterfalls-cb47dca68ded
url
https://medium.com/@t.r.rahul2006/i-built-an-ai-system-that-predicts-tourist-crowds-at-courtallam-waterfalls-cb47dca68ded
canonical_url
https://medium.com/@t.r.rahul2006/i-built-an-ai-system-that-predicts-tourist-crowds-at-courtallam-waterfalls-cb47dca68ded
author_url
https://medium.com/@t.r.rahul2006
status
ok
fetched_at
2026-06-26 21:52:29