MCF-Endface / README.md
OCEAN-Lab's picture
Update README.md
caea0b3 verified
|
Raw History Blame Contribute Delete
4.66 kB
---
license: cc-by-sa-4.0
pretty_name: 'MCF-Endface: Annotated 4-core multi-core fiber end-face images'
language:
- en
tags:
- mcf
- splicer
- optical-fiber
- endface
size_categories:
- n<1K
configs:
- config_name: default
data_files:
- split: train
path: images/**
---
# MCF-Endface
End-face images of **4-core multi-core fibers (MCF)** captured on a fusion splicer, annotated with the position and radius of each core and the position of the orientation marker. The dataset is intended for training and evaluating models that locate cores and markers, which is the input needed to rotationally align two MCFs before splicing.
## At a glance
| | |
|---|---|
| Images | 216 (108 X/Y pairs) |
| Image size | 806 × 802 px, cropped and centred on the fiber cladding |
| Cores | 864 (4 per image) |
| Markers | 216 (1 per image) |
| Fiber types | Normal: 209 · Trenched: 7 |
| Capture period | 2026-03-05 → 2026-10-16 (27 capture days) |
| Split | `train` only |
## Repository layout
```
annotations.json # all annotations, COCO-style (single file)
images/
├── metadata.jsonl # same annotations, one line per image (used by load_dataset)
├── 000001.jpg
├── 000002.jpg
└── ...
MCFDataset.py # small loader for annotations.json + images (no `datasets` needed)
```
`annotations.json` and `images/metadata.jsonl` contain the same annotations in two layouts.
## Annotation fields
Each image has one record:
| Field | Type | Description |
|---|---|---|
| `id` | int | Unique image id (images are numbered in capture order) |
| `file_name` | string | Image file in `images/`, e.g. `000001.jpg` |
| `width`, `height` | int | Image size in pixels (806 × 802) |
| `date_captured` | string | Capture time, ISO 8601 |
| `side` | string | `X` or `Y`, the two fiber end-faces imaged for one splice |
| `pair_image_id` | int | `id` of the other side of the same splice |
| `type` | string | Fiber type: `Normal` or `Trenched` |
| `cores` | list | 4 cores, each `{"position_x", "position_y", "radius"}` in pixels |
| `marker` | object | Orientation marker `{"position_x", "position_y"}` in pixels |
**Coordinates:** the origin is the top-left corner of the image, x increases to the right and y increases downwards. The fiber centre is at about (403, 401).
Example record:
```json
{
"id": 1, "file_name": "000001.jpg", "width": 806, "height": 802,
"date_captured": "2026-03-05T18:17:22.145948", "side": "X", "pair_image_id": 2, "type": "Normal",
"cores": [
{"position_x": 205, "position_y": 395, "radius": 26},
{"position_x": 405, "position_y": 199, "radius": 25},
{"position_x": 596, "position_y": 397, "radius": 23},
{"position_x": 401, "position_y": 592, "radius": 23}
],
"marker": {"position_x": 668, "position_y": 256}
}
```
## Usage
### With 🤗 `datasets`
```python
from datasets import load_dataset
ds = load_dataset("OCEAN-Lab/MCF-Endface", split="train")
sample = ds[0]
sample["image"] # PIL image
sample["cores"] # [{"position_x", "position_y", "radius"}, ...]
sample["marker"] # {"position_x", "position_y"}
```
### With the raw files and `MCFDataset`
```python
from huggingface_hub import snapshot_download
root = snapshot_download("OCEAN-Lab/MCF-Endface", repo_type="dataset",
allow_patterns=["annotations.json", "images/*.jpg", "MCFDataset.py"])
import sys; sys.path.insert(0, root)
from MCFDataset import MCFDataset
ds = MCFDataset(root)
item = ds[0]
item["image"] # BGR numpy array (cv2.imread, IMREAD_UNCHANGED)
item["cores"], item["marker"] # same lists/dicts as annotations.json
x_item, y_item = ds.get_pair(0) # both sides of one splice
ds.get_by_id(5) # look up by image id
```
`MCFDataset` needs `opencv-python`. It also needs `huggingface_hub` if you create it without a path, in which case it downloads the dataset itself.
### With plain Python
```python
import json
from pathlib import Path
from PIL import Image
data = json.load(open(Path(root) / "annotations.json"))
for record in data["images"]:
image = Image.open(Path(root) / "images" / record["file_name"])
cores, marker = record["cores"], record["marker"]
```
## How the data was collected
The images were captured on a fusion splicer as part of an automated MCF splicing setup. The images were taken from a Fujikura FSM 100P+ PM splicer. Each raw end-face image was cropped around the fiber cladding and resized to 806 × 802. Cores and markers were marked by an operator in a custom Python GUI before being saved.
## License
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)