Skip to main content

Diffusion Geolocalization package for PLONK models

Project description

Around the World in 80 Timesteps:
A Generative Approach to Global Visual Geolocation

PLONK

Nicolas Dufour, David Picard, Vicky Kalogeiton, Loic Landrieu

Introducing the first generative geolocation method based on diffusion and flow matching! We learn the relationship between visual content and location by denoising random locations conditionally to images.

➜ New SOTA for visual geolocation on OpenStreetView-5M, YFCC-100M, and iNat-21

➜ Generate global probability density maps and quantify localizability

➜ Introduce the problem of probabilistic visual geolocation

This repository contains the code for the paper "Around the World in 80 Timesteps: A Generative Approach to Global Visual Geolocation"



Project website: https://nicolas-dufour.github.io/plonk

Arxiv: https://arxiv.org/abs/2412.06781

HuggingFace Collection: https://huggingface.co/collections/nicolas-dufour/around-the-world-in-80-timesteps-6758595d634129e6fc63dad9

Demo: https://huggingface.co/spaces/nicolas-dufour/PLONK

Installation

If you want to use our models, you can directly install the diff-plonk package:

conda create -n plonk python=3.10
conda activate plonk
pip install diff-plonk

For a local installation, if you want to train the model or use the demo, you can clone the repository and install the dependencies:

From the github repository:

git clone https://github.com/nicolas-dufour/plonk.git
cd plonk
conda create -n plonk python=3.10
conda activate plonk
pip install -e .

From pip:

conda create -n plonk python=3.10
conda activate plonk
pip install diff-plonk

Models

We provide pre-trained models for the OSV-5M, YFCC-100M, and iNat-21 datasets. You can download them from the huggingface hub.

Demo

We provide a demo of the model hosted on the following HuggingFace Space.

Running the demo locally

pip install -e ".[demo]"

And then run the following command:

streamlit run plonk/demo/demo.py 

Usage

To use the models, you can use our pipeline:

from plonk import PlonkPipeline

pipeline = PlonkPipeline("nicolas-dufour/PLONK_YFCC")

gps_coords = pipeline(images, batch_size=1024)

With images being a list of PIL images or a PIL image.

3 different models are provided for each dataset:

  • nicolas-dufour/PLONK_OSV_5M: OSV-5M
  • nicolas-dufour/PLONK_YFCC: YFCC-100M
  • nicolas-dufour/PLONK_iNat: iNat-21

Baselines models

We also provide the baseline models for the OSV-5M, YFCC-100M, and iNat-21 datasets for the carthesian flow matching and diffusion models. You can download them from the huggingface hub.

Flow matching models:

  • nicolas-dufour/PLONK_OSV_5M_flow: OSV-5M
  • nicolas-dufour/PLONK_YFCC_flow: YFCC-100M
  • nicolas-dufour/PLONK_iNat_flow: iNat-21

Diffusion models:

  • nicolas-dufour/PLONK_OSV_5M_diffusion: OSV-5M
  • nicolas-dufour/PLONK_YFCC_diffusion: YFCC-100M
  • nicolas-dufour/PLONK_iNat_diffusion: iNat-21

Training

Install training dependencies

You will need to install the training dependencies:

pip install -e ".[train]"

Downloading the dataset

You will need to download the OSV5M webdataset from the https://huggingface.co/datasets/osv5m/osv5m-wds in the plonk/datasets/osv5m folder.

Training the model

To train the model, you can use the following command:

python plonk/train.py exp=osv_5m_geoadalnmlp_r3_small_sigmoid_flow_riemann mode=traineval experiment_name=My_OSV_5M_Experiment

Evaluating the model

To evaluate the model, you can use the following command:

python plonk/train.py exp=osv_5m_geoadalnmlp_r3_small_sigmoid_flow_riemann mode=eval experiment_name=My_OSV_5M_Experiment

YFCC and iNAturalist

For YFCC and iNat, script to preprocess the dataset are provided in the plonk/data/extract_embeddings and plonk/data/to_webdataset folders.

Citation

If you find this work useful for your research or use our code, please cite our paper:

@article{dufour2024around,
  title={Around the World in 80 Timesteps: A Generative Approach to Global Visual Geolocation},
  author={Dufour, Nicolas and Picard, David and Kalogeiton, Vicky and Landrieu, Loic},
  journal={arXiv preprint arXiv:2412.06781},
  year={2024}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diff_plonk-0.4.tar.gz (54.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diff_plonk-0.4-py3-none-any.whl (72.2 kB view details)

Uploaded Python 3

File details

Details for the file diff_plonk-0.4.tar.gz.

File metadata

  • Download URL: diff_plonk-0.4.tar.gz
  • Upload date:
  • Size: 54.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for diff_plonk-0.4.tar.gz
Algorithm Hash digest
SHA256 5b59c9f707d71d445f4ccd3a9807e48539b9f4d5ed5a02d312b0f3a3aa1ee960
MD5 816f9eb1711bf7639b721ebcc41f6a03
BLAKE2b-256 f1eddacb610a67d0a3a7fb2031a88cf9069a2408af38c758d02d5a1fe8820f64

See more details on using hashes here.

File details

Details for the file diff_plonk-0.4-py3-none-any.whl.

File metadata

  • Download URL: diff_plonk-0.4-py3-none-any.whl
  • Upload date:
  • Size: 72.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for diff_plonk-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5d229d146e465957f887ff95f94ce614f9a37b13c6670dcfd3a352794014fe3e
MD5 58af1f16cf26b66b7809cd0b89c9a99c
BLAKE2b-256 bb7d3a7e94c713962002eaf95870113d9551a10c5ac809317b9914ef4d5271a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page