VitageReality Model

Purpose

This model can be used to seperate the left and right half image from a stereograph card. The have been historically used with a stereoscope.

Keep in mind that there have been several simila systems in the 19th and 20th century, currently this model is anly trained to work with the Underwood & Underwood sterescope (sometimes also known as Holmes sterescope). Other types aren't handled yet.

Description and use case

Hve a look at these two blog posts for a introduction and use case:

Basic usage

The Model can be used with Python

Required dependencies

pip install ultralytics

Usage

from ultralytics import YOLO
from PIL import Image

pil_image = Image.open(args.image)
model = YOLO(model_path)
results = model(pil_image, verbose=False, retina_masks=True)

left_img = None
right_img = None

r = results[0]

if not r.boxes or len(r.boxes) != 2:
    raise Exception(f"YOLO detected {len(r.boxes) if r.boxes else 0} regions, expected exactly 2.")
    boxes = r.boxes.xyxy.cpu().numpy()

    # This is needed to get the order right
    indexed_boxes = sorted(enumerate(boxes), key=lambda x: x[1][0])

    left_idx, left_box = indexed_boxes[0]
    right_idx, right_box = indexed_boxes[1]
    masks = r.masks.data.cpu().numpy()

Afterwars you can either use left_box and right_box to extract the half images. You can also use the masks to extract the half image only, without the arch at the top.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for cmahnke/vintagereality

Base model

Ultralytics/YOLO11
Quantized
(43)
this model