Back to project
Tool · runs in your browser

Species Classifier

Classify forest species from macroscopic wood images using pre-trained YOLO models. Run directly in your browser or download the models to use locally.

Classify in your browser
  1. 01
    Macroscopic image
  2. 02
    448 px patches
  3. 03
    One vote per patch
  4. 04
    The species
What happens to your image: sliding window, patches, votes, species.
01Online classifier

Classify in your browser

Select a model, upload a macroscopic wood image, and get results instantly. All processing runs on your device — no data is sent to any server.

  • Runs on your device
  • 448×448 px patches
  • 15 models
Species classifier
448×448 px · sliding window · majority voting
Select a model to begin
Click "Select model" above to choose one of the 15 available architectures
02Local usage

Run with Python

Request the .pt models above and run the full pipeline locally. Extract 448×448 patches via sliding window, classify each patch, then use majority voting for the final result.

  1. 1. Install dependencies

    terminal
    $ pip install ultralytics opencv-python numpy
  2. 2. Extract 448×448 patches (sliding window)

    extract_patches.py
    import cv2
    
    def extract_patches(image_path, size=448, overlap=0.0):
        img = cv2.imread(image_path)
        h, w = img.shape[:2]
        step = int(size * (1.0 - overlap))
        patches = []
        for y in range(0, h - size + 1, step):
            for x in range(0, w - size + 1, step):
                patches.append(img[y:y+size, x:x+size])
        return patches
  3. 3. Classify each patch and majority vote

    classify_and_vote.py
    from ultralytics import YOLO
    from collections import Counter
    
    model = YOLO("yolo26m-cls.pt")
    
    votes = []
    for patch in patches:
        r = model.predict(patch, verbose=False)[0]
        votes.append(r.names[r.probs.top1])
    
    species, n = Counter(votes).most_common(1)[0]
    print(f"Result: {species} ({n}/{len(votes)} patches)")