Downloads · 30 days
0
John-Allard/treemble-1
treemble-1 is a keypoint detection model from John-Allard. Use it for the keypoint detection task on the model card, and read the license before you ship it in a product. It is set up for onnx. The card lists the license as mit.
This repository hosts an ONNX-exported heatmap model used by Treemble, a cross-platform desktop tool for digitizing phylogenetic tree figures.
Downloads · 30 days
0
Access
Public
Updated Feb 16, 2026
Repo size
98 MB
Likes
2
Public
Click a slice to open those files.
.onnx98 MB · 100%
From the Hugging Face model README
This repository hosts an ONNX-exported heatmap model used by Treemble, a cross-platform desktop tool for digitizing phylogenetic tree figures.
Treemble lets you load a tree image, mark nodes, and export a machine-readable tree representation (newick file). To learn more about Treemble, download installers, or browse documentation, visit:
[1, 1, H, W] with dynamic H and W (height/width)[1, C, H, W]
C = 1 (internal nodes only)The file model.config.json stored alongside model.onnx encodes key
preprocessing and decoding parameters (e.g. resize/max_side, padding multiple,
and peak-detection thresholds) so downstream applications can reproduce the
training-time inference behavior consistently.
The model repository contains:
model.onnx – ONNX graph for the node detector.model.config.json – JSON configuration with fields such as:
backbone (e.g. "resnet34")in_channels (1 for grayscale)internal_only / no_root_prednormalize_inputmax_side, pad_multipledecode:
threshwindowper_channel_topkmax_peaksfallback_topkassign_root_leftmost_when_two_classesTreemble uses both files together: model.onnx for the network and
model.config.json for the preprocessing / peak-decoding logic.
Primary use case
Non-goals
The model was trained on a collection of tree figures with manually annotated node locations (tip, internal, root). Each training sample consists of:
For this particular checkpoint:
Exact datasets and detailed annotations are not distributed with this model; it is intended primarily for Treemble’s internal node detection workflow.
Below is a minimal example showing how you might call this model from Python
with onnxruntime to obtain approximate internal node locations from a
grayscale crop of a tree image.
import json
import numpy as np
from PIL import Image
import onnxruntime as ort
# Load config
with open("model.config.json", "r") as f:
cfg = json.load(f)
max_side = cfg["max_side"]
pad_multiple = cfg["pad_multiple"]
# Load and preprocess image crop
img = Image.open("tree_crop.png").convert("L")
w, h = img.size
# Resize with aspect ratio preserved
scale = min(1.0, max_side / max(w, h))
new_w = max(1, int(round(w * scale)))
new_h = max(1, int(round(h * scale)))
img_resized = img.resize((new_w, new_h), resample=Image.BILINEAR)
# Pad so dimensions are multiples of pad_multiple
pad_w = (pad_multiple - (new_w % pad_multiple)) % pad_multiple
pad_h = (pad_multiple - (new_h % pad_multiple)) % pad_multiple
canvas = Image.new("L", (new_w + pad_w, new_h + pad_h), 0)
canvas.paste(img_resized, (0, 0))
arr = np.array(canvas, dtype=np.float32) / 255.0
input_tensor = arr[None, None, :, :] # [1,1,H,W]
# Run ONNX inference (CPU)
sess = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
logits, = sess.run(None, {"input": input_tensor})
# logits: [1, C, H, W] where C=1 for internal heatmap
logits = logits[0, 0]
prob = 1.0 / (1.0 + np.exp(-logits))
# Simple thresholding (Treemble uses more advanced NMS/peak limiting)
thresh = cfg["decode"]["thresh"]
ys, xs = np.where(prob > thresh)
# Map back to original crop coordinates
sx = new_w / w
sy = new_h / h
coords = [((x / sx), (y / sy)) for x, y in zip(xs, ys)]
print("Detected internal-node candidates (sample):", coords[:20])
For production use, applications should implement non-maximum suppression and
top-k limiting as encoded in the decode section of the config.
This model is released under the MIT License. If you use it in scientific work or downstream tools, please also acknowledge Treemble and its authors where appropriate.
If you use Treemble in your work, please cite:
Treemble: A Graphical Tool to Generate Newick Strings from Phylogenetic Tree Images.
John B. Allard and Sudhir Kumar (2025).
arXiv: 2508.07081. DOI: 10.48550/arXiv.2508.07081
For more information about Treemble itself, see: