README.md

November 21, 2025 · View on GitHub

Sketch Scape

arXiv BMVC Python PyTorch License

Official implementation of Back To The Drawing Board: Rethinking Scene-Level Sketch-Based Image Retrieval, BMVC2025 :fire:. A simple and effective scene-level sketch-based image retrieval (SBIR) model achieving state of the art results.

ONLINE DEMO

:bar_chart: Main Results

Comparison of results on the FS-COCO dataset.

MethodR@1 (Normal)R@5 (Normal)R@10 (Normal)R@1 (Unseen)R@5 (Unseen)R@10 (Unseen)
Siam-VGG23.3-52.610.6-32.5
HOLEF-VGG22.8-53.110.9-33.1
SceneTrilogy24.1-53.9---
SceneDiff (w Sketch)25.245.955.9---
FreestyleRet29.6-56.1---
Ours61.981.487.260.080.286.1

:microscope: Methodology

Overview of the proposed method
Overview of the proposed method

Our encoder model is trained in a Siamese manner, accepting both images and sketches. During training, the embeddings are matched on a batch level, aligning the similarity matrix with a target one, using an ICon based loss function. In the inference stage, the encoder is simply generating embeddings that are then compared using cosine distance.

:recycle: Replicating the results

FSCOCO dataset model weights

You can download the dataset from the official FS-COCO website. Extract the dataset into the project folder.

Pretrained models

You can download the pretrained model for both train/test splits of FS-COCO:

Place the downloaded model files in the models folder.

:open_file_folder: Example folder structure:

    SketchScape
    ├── models
    │   ├── model_normal.pth
    │   ├── model_unseen.pth
    │   └── ...
    ├── fscoco
    │   ├── raster_sketches
    │   ├── images
    │   └── ...
    ├── train.py
    ├── eval.py
    ...

Installation

To install required libraries run:

pip install -r requirements.txt

The default installation includes the cpu version of torch. To use CUDA, replace it with the appropriate torch version. Tested on Python 3.10.

Running the code

You can train the model using train.py and evaluate the trained models using eval.py.

Available eval command line arguments

ArgumentDescriptionDefault
--no_cudaDisables CUDA.False
--saveSave generated embeddings for sketches and images.False
--visualizeGenerate an HTML file with visualization of results.True
--val_unseenUse unseen user train/val split.False
--batch_sizeNumber of samples in each batch.60
--seedSeed for reproducibility.42
--data_dirDirectory for the dataset.fscoco
--modelsPaths to the model files.''

Running the evaluation

To replicate results on the FS-COCO dataset from the paper, run the code with the following arguments.

python3 eval.py --models models/model_normal.pth

python3 eval.py --unseen --models models/model_unseen.pth

On completion, you will find a result.html file inside the folder which contains the visualized results.
When opened, it will display the 10 most similar images to the sketch according to model predictions.
The correct image will have a red outline. If no image in a row has a red outline, the correct image was not among
the first 10 most similar results.

Available train command line arguments

ArgumentDescriptionDefault
--no_cudaDisables CUDA.False
--savePath to save the trained model.model_XXX
--val_unseenUse unseen user train/val split.False
--epochsNumber of epochs to train.10
--lrInitial learning rate.0.0001
--batch_sizeNumber of samples in each batch.60
--model_pathpath to saved model to load or specifications of a model to load.CLIP;convnext_base
--seedSeed for reproducibility.42
--data_dirDirectory for the dataset.'fscoco'
--lossLoss function to use. Options: InfoNCE, ICon, Triplet. Add ; to separate loss parameters.'ICon'

:chart_with_upwards_trend: Training the model

Default vales of the parameters are set to match those used in the paper. You can train a new model with different arguments with train.py

python3 train.py <options>

:pencil2: Citing

If you find our paper and code useful, please consider giving a star :star: and citing:

@inproceedings{demic2025back,
  title={Back To The Drawing Board: Rethinking Scene-Level Sketch-Based Image Retrieval},
  author={Demić, Emil and Čehovin Zajc, Luka},
  booktitle={British Machine Vision Conference (BMVC2025)},
  year={2025}
}

:+1: Acknowledgments

This research was in part supported by ARIS (Slovenian Research Agency) research programme Computer Vision (P2-0214).