Spaces:
Sleeping
Sleeping
|
Download README.md from ciass/protest-segments: direct link, hf CLI and curl.
- Browser
- Download file 3.48 kB
-
https://huggingface.co/spaces/ciass/protest-segments/resolve/main/README.md
- Command line
-
hf download hf://spaces/ciass/protest-segments/README.md
-
curl -L -o README.md https://huggingface.co/spaces/ciass/protest-segments/resolve/main/README.md
3.48 kB
| title: Protest Segments | |
| emoji: 🔍 | |
| colorFrom: yellow | |
| colorTo: gray | |
| sdk: docker | |
| suggested_hardware: t4-small | |
| pinned: false | |
| license: apache-2.0 | |
| <div> | |
| <div align="center"> | |
| <img src="docs/method.jpg" alt="logo" width="500" height="auto" /> | |
| </div> | |
| <div align="left"> | |
| <h1>Protest Segments</h1> | |
| <p> | |
| 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. | |
| </p> | |
| <h4> | |
| <a target="_blank" href="https://doi.org/10.1017/pan.2024.18">Paper</a> | |
| <span> · </span> | |
| <a target="_blank" href="https://github.com/ciass-konstanz/protest-segments/">Code</a> | |
| <span> · </span> | |
| <a target="_blank" href="https://huggingface.co/spaces/ciass/protest-segments">Demo</a> | |
| <span> · </span> | |
| <a target="_blank" href="https://doi.org/10.7910/DVN/TFTEF2">Data</a> | |
| </h4> | |
| </div> | |
| </div> | |
| <!-- Getting Started --> | |
| ## 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 --> | |
| ## 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 --> | |
| ## 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} | |
| } | |
| ``` | |