This repository contains the code to reproduce results from our paper:
"Framing the Canon: A Computational Study of Canonicity in Danish Golden Age Paintings (1750-1870)"
Please cite our paper if you use the code or the embeddings:
Citation instructions will be added upon publication
Dataset is fetched from SMKs digital collection using the SMK-API. The dataset used for this analysis can be found on HuggingFace.
It should be noted that SMK frequently updates their collection, meaning that there could appear changes in the SMK-API that are not in our dataset, for example to the SMK-IDs or the image URLs. Therefore, pay attention if any images fail when downloading the image files from the URLs.
src/analyses_utils.pyandsrc/run_analyses.pycontain the code to run the full analysis on the canon-paintings data. The scripts can be run with set arguments withrun_analyses.shand output is in theresults/foldernbs/canon_analysis.ipynbruns the same functions assrc/run_analyses.pybut in a notebook style with added, descriptive markdown chunks and the option to run each step of the analysis seperately.src/greyscale_embeddings.pyandsrc/smk_embeddings.pycontains the code to extract colored and greyscaled embeddings for the dataset of paintings. These are already in the dataset uploaded to HuggingFace.
All code was run using macOS 15.6.1 in Visual Studio Code with Python 3.13.3.
To run the code, first set up the virtual environment and install required packages with:
bash setup.sh
Next, run analysis with default arguments with:
bash run_analyses.sh
Results are in the /results folder.
canon-paintings-smk/
│
├── nbs/ # Jupyter Notebooks
│ └── canon_analysis.ipynb # Code to analyses in notebook instead of script
│
├── results/ # Output of analysis
│ ├── classification/ # Classification reports from supervised classification
│ └── figs/ # Output visualizations
│
├── src/ # Source code and helper functions
│ ├── analyses_utils.py # Helper functions to run canon analyses
│ ├── greyscale_embeddings.py. # Extracts greyscaled image embeddings
│ ├── run_analyses.py # Run full canon analysis
│ └── smk_embeddings.py # Extract colored image embeddings
│
├── README.md
├── requirements.txt # Python dependencies
├── run_analyses.sh # Run canon analyses with set arguments
└── setup.sh # Set up virtual environment and install required packages
