areflesh commited on
Commit
402a60d
·
verified ·
1 Parent(s): 0caeff2

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

<img src="cruc.png" alt="Example of usage" width="200"/>
---

## 🏷️ 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 aDEArt dataset for the **Saint George on a Bike** project.
- Dataset contains annotated religious artworks with rich symbolic content.
---

## 🧪 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('<path to model weights>', 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()
```

## 📚 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 +6 -1
README.md CHANGED
@@ -1,3 +1,8 @@
1
  ---
2
  license: cc0-1.0
3
- ---
 
 
 
 
 
 
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
+ ---