Fork of the codebase for "Surveilling Surveillance: Estimating the Prevalence of Surveillance Cameras with Street View Data" - https://github.com/stanford-policylab/surveilling-surveillance/
Find a file
2024-02-29 14:55:02 +01:00
.github/image init 2021-05-20 13:22:04 -07:00
analysis init 2021-05-20 13:22:04 -07:00
data init 2021-05-20 13:22:04 -07:00
detection Enable running train.py from project root, fix nested output dirs 2024-02-29 14:39:11 +01:00
plot init 2021-05-20 13:22:04 -07:00
streetview init 2021-05-20 13:22:04 -07:00
util init 2021-05-20 13:22:04 -07:00
.gitignore Use poetry, make compatible newer lightning version 2024-02-29 14:38:18 +01:00
01-dataset-tools.py Create filtered dataset 2024-02-29 14:55:02 +01:00
LICENSE init 2021-05-20 13:22:04 -07:00
main.py typo fixed 2021-07-15 09:10:41 -07:00
poetry.lock Use poetry, make compatible newer lightning version 2024-02-29 14:38:18 +01:00
pyproject.toml Use poetry, make compatible newer lightning version 2024-02-29 14:38:18 +01:00
README.md Create filtered dataset 2024-02-29 14:55:02 +01:00
requirements.txt init 2021-05-20 13:22:04 -07:00

Surveilling Surveillance: Estimating the Prevalence of Surveillance Cameras with Street View Data

Project page | Paper

detections Locations of verified cameras in 10 large U.S. cities for the period 20162020. Densely clustered areas of points indicate regions with high camera density in each city. Camera density varies widely between neighborhoods. Note: Scale varies between cities.

This is the code base of our Surveilling Surveillance paper:

@article{sheng2021surveilling,
  title={Surveilling Surveillance: Estimating the Prevalence of Surveillance Cameras with Street View Data},
  author={Sheng, Hao and Yao, Keniel and Goel, Sharad},
  journal={Artificial Intelligence, Ethics, and Society},
  year={2021}
}

Camera Detection

Requirements

  • Linux or macOS with Python ≥ 3.6
  • PyTorch ≥ 1.6 and torchvision that matches the PyTorch installation. Install them together at pytorch.org to make sure of this
  • Detection2. The installation instruction of Detection2 can be found here

Install Python dependencies by running (being a bit illegal with the detectron2 dependency due to it not supporting poetry):

poetry install
git clone https://github.com/facebookresearch/detectron2.git
poetry run python -m pip install  -e detectron2

Download street-view images

python main.py download_streetview_image --key GOOGLE_API_KEY --sec GOOGLE_API_SECRET

By now, lots of Steetview images from the original dataset have become unavailable. We can filter these by scanning for duplicates (as these now downloaded as to the same error image)

find data/ ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD > data/duplicates.txt
poetry run python 01-dataset-tools.py save_non_empty

Model training

poetry run python detection/main.py train --exp_name EXPERIMENT_NAME --[hyparameter] [value]

Model inference

poetry run python detection/main.py test CHECKPOINT 

[For now --deploy-meta-path is broken] , where DEPLOY_META_PATH is a path to a csv file of the following format:

save_path panoid heading downloaded
/dY/5I/l8/4NW89-ChFSP71GiA/344.png dY5Il84NW89-ChFSP71GiA -105.55188877562128 True
...

Here, panoid and heading refer to the ID and heading of each street-view image.

Analysis

To reproduce the figures and tables in our paper, run the analysis/results.Rmd script.

You'll need to download our camera and road network data available here into a data directory in the root of this repository.

Artifacts

Annotations

Our collected camera annotations can be downloaded as follows:

#images # cameras link md5
3,155 1,696 download b2340143c6af2d1e6bfefd5001fd94c1
  • 2021-5-20: This dataset is larger than the one reported in the paper as we include verified examples from our pilot.
  • 2021-5-18: The metadata can also be found in this repo as ./data/meta.csv.

Pre-trained Models

Our pre-trained camera detection model can be downloaded as follows:

architecture Size link md5
FasterRCNN 472 Mb download dba44ad36340d3291102e72b340568a0
  • 2021-5-20: We updated the model architecture (FasterRCNN).

Detection and Road Network Data

Size link md5
97 Mb download 6ceab577c53ba8dbe60b0ff1c8d5069a