File size: 2,057 Bytes
4aeca85 9cb5082 ab0f06f 9cb5082 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
---
license: cc-by-nc-2.0
datasets:
- medieval-data/mgh-critical-edition-layout
pipeline_tag: object-detection
---
## MGH Critical Edition YOLO Model
This repository hosts a YOLO model specifically trained to detect and annotate various elements from medieval manuscripts. The model is built and trained using the Ultralytics YOLOv8n architecture.
### Dataset
The model is trained on the dataset available at: [medieval-data/mgh-critical-edition-layout](https://huggingface.co/datasets/medieval-data/mgh-critical-edition-layout). This dataset comprises images from medieval critical editions and their associated annotations.
### Training Details
- Architecture: YOLOv8n
- Pretrained Model: `yolov8n.pt`
- Image Size: 640
- Batch Size: 25
- Augmentation: Enabled
- Epochs: 300
### Evaluation Metrics
Forthcoming...
### Usage
To utilize this model in your projects, you can use the `ultralytics` YOLO library. Here's a simple code snippet to get you started:
```bash
git clone https://huggingface.co/medieval-data/yolov8-mgh
```
```bash
cd clone yolov8-mgh
```
```python
from ultralytics import YOLO
import cv2
from matplotlib import pyplot as plt
model = YOLO("yolo8v-mgh.pt")
# Prediction on an image
image_path = "page_103.jpg"
results = model(image_path)
# Visualize the results
results[0].boxes.data.tolist()
# Load the image
image = cv2.imread(image_path)
threshold = 0.5
# Draw bounding boxes on the image
for result in results[0].boxes.data.tolist():
x1, y1, x2, y2, score, class_id = result
if score > threshold:
cv2.rectangle(image, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 4)
cv2.putText(image, results[0].names[int(class_id)].upper(), (int(x1), int(y1 - 10)),
cv2.FONT_HERSHEY_SIMPLEX, 1.3, (0, 255, 0), 3, cv2.LINE_AA)
# Convert BGR image to RGB for plotting
image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# Display the image in the notebook
plt.figure(figsize=(10, 10))
plt.imshow(image_rgb)
plt.axis('off')
plt.show()
```
### Expected Output
![outout](output.JPG) |