--- title: Protest Segments emoji: 🔍 colorFrom: yellow colorTo: gray sdk: docker suggested_hardware: t4-small pinned: false license: apache-2.0 ---
logo

Protest Segments

Protest segments is a two-level classification method that detects the segments present in images and aggregates them into feature vectors, which are then used in the second level by a standard machine learning classifiers to discriminate between images. It was introduced in the paper "Improving Computer Vision Interpretability: Transparent Two-level Classification for Complex Scenes" and demonstrated in this repository.

Paper · Code · Demo · Data

## Getting Started If you just want to try out our method with a couple of your images, we recommend you to view [the demo](https://huggingface.co/spaces/ciass/protest-segments). The demo allows you to upload an image, define a vocabulary of objects, an aggregation, and returns the segmented image and the respective feature vector. Even if you want to generate these vectors for a larger number of images, you don't have to go through the following installation on your personal computer. Instead, you can use the [demo via API](https://huggingface.co/spaces/ciass/protest-segments?view=api), for which you only need to install the Gradio client for Python and follow the below Python code snippet to obtain the vector for a sample image. ⚠️ If you want to use the same segmentation models as in the paper, then you have to duplicate this space in a space environment with GPU accelerator. Install the Gradio client for Python. ```bash pip install gradio_client ``` Execute the below Python code snippet to obtain the feature vector for a sample image. ```python from gradio_client import Client, file client = Client("https://ciass-protest-segments.hf.space/") result = client.predict( image=file("https://raw.githubusercontent.com/ciass-konstanz/protest-segments/main/docs/demo.jpg"), vocabulary="COCO", feature_aggregation="count", api_name="/predict" ) print(result) ``` ## License The project's code is distributed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0), while its data and model weights are distributed under the [CC-BY-4.0 License](http://creativecommons.org/licenses/by/4.0). ## Citation If you find this project and its materials useful, please cite our paper. ``` @article{ scholz2025improving, title={Improving Computer Vision Interpretability: Transparent Two-Level Classification for Complex Scenes}, volume={33}, DOI={10.1017/pan.2024.18}, number={2}, journal={Political Analysis}, author={Scholz, Stefan and Weidmann, Nils B. and Steinert-Threlkeld, Zachary C. and Keremoğlu, Eda and Goldlücke, Bastian}, year={2025}, pages={107–121} } ```