A C++ port of CLIPascene / SceneSketch with the long-term goal of running on Android.
This project was created as part of my bachelor's thesis.
! This project was not finished. Below is a demonstration of what my implementation can do. !
Input Image
![]() Attention Map (CLIP) |
![]() Edge Map (XDoG) |
![]() Distribution Map (Attention + Edge) |
![]() Strokes Initialization (rasterized with diffvg) |
clipascene.cpp— main executable entry pointCMakeLists.txt— build configurationdownload_model.py— helper fetching the CLIP modelCLIP/- CLIP implementationdiffvg/- diffvg implementationlibdiffvg.so— shared library of diffvgtinyxml2/- tinyxml implementationhelper/— My C++ implementation of CLIPasceneinput_images/— inputsoutput/— outputstests/— tests
Hint: This implementation currently requires CUDA.
git clone https://github.com/peterschenk01/CLIPascene-in-cpp.git
cd CLIPascene-in-cpp-
Go to the official PyTorch download page and select:
- Package: LibTorch
- Language: C++
- Compute platform: CUDA (check which version you have installed)
-
Download the archive (e.g.
libtorch-shared-with-deps-2.9.1%2Bcu128.zip) into this directory
curl -O https://download.pytorch.org/libtorch/cu128/libtorch-shared-with-deps-2.9.1%2Bcu128.zip- Extract the archive
unzip libtorch-shared-with-deps-2.9.1%2Bcu128.zip- Remove archive
rm libtorch-shared-with-deps-2.9.1%2Bcu128.zipsudo apt-get update
sudo apt-get install -y libopencv-devsudo apt-get update
sudo apt-get install -y cmakepython -m venv .venv
source ./.venv/bin/activate
pip install -r requirements.txtpython download_model.pymkdir build
cd build
cmake ..
make./clipasceneThis will create following files in the output/ directory:
attention_map.pngdistribution_map.pngedge_map.pngstrokes_init.pngstrokes_init.svg




