This project uses a deep learning approach to predict the geographic location of an image. By using convolutional neural networks (CNNs), it identifies patterns in visual data that
correlate with specific regions. The model, designed with a hierarchical structure predicts the coordinates and region (continent).
The dataset for training is collected using Mapillary API. The model's architecture combines pre-trained layers from EfficientNetV2S backbone with custom dense layers.
Outputs are weighted for a focus on regional and coordinate predictions.
Data Handling:
- Uses the Mapillary API to gather equal amount of diverse images per region for training
- Splits data for training, validation and testing.
Deep Learning Model:
- Employs EfficientNetV2S as the backbone, with additional layers for hierarchical predictions.
- Estimates latitude and longitude coordinate and predicts region.
- Haversine Loss for coordinate accuracy and Categorical Crossentropy for regions.
Training and Evaluation:
- Tracks multiple metrics like regional accuracy and coordinate based location accuracy.
- Saves
best_location_model.keras
as the best validation coordinates accuracy from training. - Saves
best_overall_model.keras
as the best overall model based on validation loss from training.
Frontend UI:
- Uses NextJS for the frontend, with TypeScript and TailwindCSS.
- Python 3.10 or higher: Install from python.org.
- pip: Python package manager (comes with Python installations).
Install the required Python packages from requirements.txt
found in the root folder.
pip install -r requirements.txt
- Clone the repository
https://github.com/markbakos/geo-guesser.git
cd geo-guesser
- Set up enviromental variables
- In the root folder (geo-guesser), in your .env file:
MAPILLARY_KEY=[Your API key]
- Install dependencies:
pip install -r requirements.txt
- Set up the dataset
- Collect images using
mapillary_collection.py
- Recommended amount of images: 25-50k or more
- Use the trained model
- From console:
python -m predict path/to/saved/image
Using the UI -- Either:
- Use the deployed website: https://locationguesser.vercel.app
- Start the development server:
Start the FastAPI server
uvicorn server:app
Feel free to fork this repository, make changes, and submit a pull request.
For any inquiries, feel free to reach out:
Email: markbakosss@gmail.com
GitHub: markbakos