Work for Part 2 of HisVis Project. In this project, we developed a scene detection dataset and trained models for predicting the labels. The input data for this project are press photographs from the De Boer collection.
This project includes software to: - automatically resize and crop the images - automatically rotate them to the correct orientation - training a rotation model - updating a pre-trained Places-365 model to our data - training a logistic classifier on top of a CLIP model - making predictions for the scene categories using the places-365, CLIP model or both - making predictions for the categories (indoor / outdoor) - preparing output generated by the annotation software (VeleHanden) - analyzing the annotations - checking whether the algorithm can also be applied to uncropped images
Python 3.7.11
See requirements.txt
to set up a Conda environment.
conda create --name <envname> --file requirements.txt
Issue Tracker: https://github.com/melvinwevers/HisVis2/issues
CC-NY
Dr. Melvin Wevers (melvin.wevers(at)uva.nl)
extra_training_labels.csv
- labels for which additional samples were need in annotation step 3.
annotation_data_step1.csv
- processed database exportannotation_data_step21.csv
- processed database exportannotation_data_step3.csv
- processed database export
all_labels.txt
- list of all labels used
Place training data from Zenodo here.
Contains example test file
data_sheet.md
- data sheet for HisVis datasetlabel_sheet.md
- label sheet documenting used labelsmodel_card_indoor_outdoor_clip
- model card for indoor-outdoor detection using CLIPmodel_card_indoor_outdoor_places
- model card for indoor-outdoor detection using Places-365model_card_rotation
- model card for correct rotation detectionmodel_card_scene_detection_clip
- model card for scene detection using CLIPmodel_card_scene_detection_places
- model card for scene detection using Places-365
0.install_packages.ipynb
- install required packages that could not be installed using pip / conda1.prepare_rotation_training_data.ipynb
- creating training data for the rotation model using correctly rotated data2.train_model_rotation.ipynb
- training model for identifying correct rotation3.make_predictions_in_out.ipynb
- predicting whether an image is taken indoor or outdoor using CLIP.4.prepare_output_picturae.ipynb
- preparing data exported from Vele Handen provided by Picturae.5.analyze_annotations.ipynb
- analysis of annotation effort and code to prepare new training data6.check_prediction_crop_or_not.ipynb
- evaluation of model performance on cropped and non-cropped images.
finding_learningrate.out
- output from learning rate finder used to estimate optimal learning rateslurm-9991191.out
stack trace for training modelsslurm-9992781.out
stack trace for training models
Place models.tar.gz from Zenodo here
Models and evaluation of models for indoor-outdoor detection
rotation.pkl
model used to predict correct rotation of images
Models and evaluation for models for scene detection
find_correct_rotation.py
- Python script to rotate images until they are correctly oriented. This makes use of therotation.pkl
model. This model has been trained using the notebooktrain_model_rotation.ipynb
helper.py
- script with different helper functionsmake_predictions_in_out.py
- script to make indoor / outdoor predictions using standard clipmake_predictions.py
- script to make scene detection predictions using fine-tuned clip, places365, or bothremove_border.py
- script to resize images and crop them out of the photo negative sheetstrain_clip.py
- script to finetune CLIPtrain_places_model.py
script to finetune places-365
run prepare_images.sh
We can train the model using a Jupyter Notebook or a Python Script that can be called using the run.sh
bash script.
Run run_prediction.sh