areflesh commited on
Commit
e0054e4
ยท
verified ยท
1 Parent(s): 402a60d

Update README.md

Browse files

# ๐Ÿ–ผ๏ธ Saint George on a Bike โ€“ Mask R-CNN for Iconographic Object Detection

## Model Summary

This model uses the [Matterport Mask R-CNN](https://github.com/matterport/Mask_RCNN) implementation fine-tuned for detecting iconographic and symbolic elements in religious artworks. It is developed as part of the **Saint George on a Bike** project to enable semantic enrichment and understanding of historical imagery.

---

## ๐Ÿง  Model Details

- **Architecture**: Mask R-CNN with ResNet backbone
- **Framework**: TensorFlow 1.14.0 + Keras 2.2.5
- **Source**: https://github.com/matterport/Mask_RCNN
- **Configuration**:
- `NUM_CLASSES`: 69+1 (background)
- `DETECTION_MIN_CONFIDENCE`: 0.76

---

## ๐ŸŽฏ Use Cases

- Iconography detection in religious paintings
- Digital humanities and art historical research
- Training multimodal models for cultural heritage
- Enriching metadata in museum and archive collections

---

## ๐Ÿท๏ธ Labels (Selected)

The model detects over 40 iconographic concepts including:

- `crucifixion`
- `angel`
- `crown of thorns`
- `monk`
- `sword`
- `chalice`
- `dove`
- `lion`, `shepherd`, `scroll`, `key of heaven`, `mitre`, and more

> Full class list is available in the source notebook.

---

## ๐Ÿ“Š Training Data

- The model was trained on a dataset curated for the **Saint George on a Bike** project.
- Dataset contains annotated religious artworks with rich symbolic content.
- Format and exact size unspecified; annotations assumed to follow COCO-like structure.

---

## ๐Ÿงช Example Usage

```python
from mrcnn.config import Config
from mrcnn.model import MaskRCNN
from mrcnn.model import mold_image
from keras.preprocessing.image import load_img, img_to_array
from numpy import expand_dims
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle

# Define class labels (shortened list)
classids=["BG","crucifixion","angel","person","crown of thorns", "horse", "dragon","bird","dog","boat","cat","book",
"sheep","shepherd","elephant","zebra","crown","tiara","camauro","zucchetto","mitre","saturno","skull",
"orange","apple","banana","nude","monk","lance","key of heaven", "banner","chalice","palm","sword","rooster",
"knight","scroll","lily","horn","prayer","tree","arrow","crozier","deer","devil","dove","eagle","hands",
"head","lion","serpent","stole","trumpet","judith","halo","helmet","shield","jug","holy shroud","god the father",
"swan", "butterfly", "bear", "centaur","pegasus","donkey","mouse","monkey","cow","unicorn"]

# Define the inference config
class PredictionConfig(Config):
NAME = "PREDICTION_cfg"
NUM_CLASSES = len(classids)
GPU_COUNT = 1
IMAGES_PER_GPU = 1
DETECTION_MIN_CONFIDENCE = 0.76

# Initialize model
cfg = PredictionConfig()
model = MaskRCNN(mode='inference', model_dir='./', config=cfg)
model.load_weights('/content/Mask_RCNN/mask_rcnn_sgoab.h5', by_name=True)

# Load and process image
img = load_img("example.jpg")
image = img_to_array(img)
scaled_image = mold_image(image, cfg)
sample = expand_dims(scaled_image, 0)

# Run detection
yhat = model.detect(sample, verbose=0)[0]

# Visualize detections
fig = plt.figure(figsize=(12, 12))
ax = fig.add_subplot(111)
ax.imshow(img)
for i in range(len(yhat['rois'])):
y1, x1, y2, x2 = yhat['rois'][i]
width, height = x2 - x1, y2 - y1
rect = Rectangle((x1, y1), width, height, fill=False, color='red')
ax.add_patch(rect)
ax.text(x1 + 5, y1 + 10, classids[yhat['class_ids'][i]], fontsize=12, color='white')
plt.show()
```

---

## ๐Ÿ“Œ Limitations

- Accuracy on modern images or non-religious art is not guaranteed
- Evaluation metrics (e.g., mAP) are not provided
- Not benchmarked against standard datasets like COCO
- Requires legacy versions of TensorFlow and Keras

---

## ๐Ÿ“š Citation

If you use this model, please cite:

- The Matterport Mask R-CNN repository: https://github.com/matterport/Mask_RCNN
- DEArt Dataset
```


@misc
{reshetnikov2022deartdataseteuropeanart,
title={DEArt: Dataset of European Art},
author={Artem Reshetnikov and Maria-Cristina Marinescu and Joaquim More Lopez},
year={2022},
eprint={2211.01226},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2211.01226},
}


```

---

## ๐Ÿ™ Acknowledgements

This research has been supported by the Saint George on a Bike project 2018-EU-IA-0104, co-financed by the Connecting Europe Facility
of the European Union.

Files changed (1) hide show
  1. README.md +9 -7
README.md CHANGED
@@ -1,8 +1,10 @@
1
- ---
2
- license: cc0-1.0
3
- datasets:
4
- - biglam/european_art
5
- base_model:
6
- - blesot/Mask-RCNN
7
- pipeline_tag: object-detection
 
 
8
  ---
 
1
+ ---
2
+ license: cc0-1.0
3
+ datasets:
4
+ - biglam/european_art
5
+ base_model:
6
+ - blesot/Mask-RCNN
7
+ pipeline_tag: object-detection
8
+ tags:
9
+ - cultural
10
  ---