Ariad Golf Tee Box Detector
Finds the tee box at a known approximate tee location on 0.3 m four-band aerial imagery. It is Ariad's v4 golf-course segmentation model fine-tuned at 0.3 ground metres per pixel with extra tee labels, plus a fixed acceptance rule (tee_rule.py) that throws away doubtful boxes.
The two parts are meant to be used together. The network on its own is not reliable: without the rule, 63% of the boxes it found were tees. With the rule, on imagery whose native resolution is 0.3 m, 98.4% of accepted boxes were judged to be the tee of the intended hole in a pre-registered test (details and limits below). The rule accepts about a third of the locations it is given.
Ariad uses it to place tee boxes and start hole routes for the free course maps and yardage books at www.ariad.golf. This repository contains the weights, the rule and inference utilities. It does not contain imagery, training data or review records.
Model details
| Property | Value |
|---|---|
| Architecture | U-Net, ResNet-34 encoder (Segmentation Models PyTorch) |
| Input | Four bands, red, green, blue, near-infrared, in that order |
| Imagery scale | 0.3 ground metres per pixel |
| Tile size | 512 ร 512 pixels at inference (trained on 384 ร 384) |
| Raw values | uint8, 0โ255 |
| Outputs | Six unnormalized logits per pixel; class 2 is tee |
| Stored weights | FP32 Safetensors, tensor values unchanged from the tested checkpoint |
| Training | Warm start from v4; 7,221 training and 835 validation tiles from 2,610 courses; 8 epochs |
The class list is the same as v4: 0 background, 1 green, 2 tee, 3 fairway, 4 bunker, 5 water. Only the tee class was the target of this fine-tune. Use v4 for greens, fairways and bunkers.
Load and run
Install requirements.txt for the environment used to verify this export. The model loads through the library's standard Hub integration and does not need trust_remote_code.
import json
import numpy as np
import rasterio
import segmentation_models_pytorch as smp
import torch
from huggingface_hub import hf_hub_download
repo_id = "ariadgolf/golf-tee-box-detector"
model = smp.from_pretrained(repo_id).float().eval()
with open(hf_hub_download(repo_id, "preprocessor_config.json")) as handle:
config = json.load(handle)
with rasterio.open("tile.tif") as source:
image = source.read()
assert image.shape == (4, 512, 512) and image.dtype == np.uint8
mean = np.asarray(config["image_mean"], dtype=np.float32)[:, None, None]
std = np.asarray(config["image_std"], dtype=np.float32)[:, None, None]
x = torch.from_numpy((image.astype(np.float32) - mean) / std).unsqueeze(0)
with torch.inference_mode():
tee_probability = model(x).softmax(dim=1)[0, 2].numpy()
Normalization is (raw_pixel - mean) / std with the means and standard deviations in preprocessor_config.json. Do not divide by 255 first. The fourth band must be near-infrared, not alpha.
To test for a tee box at a location, cut a 512 ร 512 tile centred on it in Web Mercator at 0.3 true ground metres per pixel (tee_rule.tile_bounds gives the bounds), then:
python inference.py tile.tif tee_probability.tif --point LON LAT --native-cm 30
This writes the tee probability raster and prints the rule's answer: accepted or not, the reason, the box outline and its measurements. --native-cm is the native resolution of the source imagery; the rule rejects anything coarser than 30 cm, and a 0.6 m image resampled to 0.3 m still counts as 60. From Python, tee_rule.accept_tee_box also takes the hole's green, other holes' greens and playing lines, and scorecard lengths. Those can only rule a box out.
The acceptance rule
The box is the connected region of tee probability above 0.5 that contains the location or lies within 6 m of it. It is rejected unless all of these hold:
- native imagery resolution of 0.3 m or finer;
- area between 80 and 1,500 mยฒ;
- pad-like shape: fills at least 60% of its minimum rectangle, short side at least 3 m, long side at most 60 m, aspect at most 4.5;
- mean tee probability inside the box of at least 0.75;
- at most 10% of its pixels darker than 0.72 ร the tile's mown-turf brightness, and texture at most 2.5 ร the mown turf (tree canopy and shade);
- no overlap with the hole's own green or with another hole's green or playing line, when those are supplied;
- when scorecard lengths are supplied, the straight distance to the green is not more than the longest length plus 30 m and not less than half the shortest minus 30 m.
The thresholds were tuned on validation locations only. The resolution test was added after the first development test showed boxes on 0.6 m imagery were often wrong.
Measured results
All verdicts below come from blind reviews of aerial renders by an AI vision model (the reviewer saw the box and the hole's green, not the scorecard or any earlier verdict). They are not surveyed ground truth. Full aggregates are in evaluation.json.
Development test. 200 held-out candidate tee locations in AZ, CO, GA, IA and OR, half previously reviewed as tees and half as not tees.
| Detector | Boxes | Judged a tee, excluding unsure |
|---|---|---|
| v4 segmentation model | 153 | 69% |
| This network, every box, no rule | 157 | 63% |
| This network + rule, any resolution | 58 | 91% |
| This network + rule, native 0.3 m only | 45 | 97.4% (38 of 39) |
| This network + rule, 0.6 m imagery only | 13 | 57% |
Confirmation test. Because the resolution test was chosen after seeing the development results, the final rule was tested again on fresh locations. Code, weights, rule, sample and pass bar were written down before any location was run. Locations came from 21 states whose newest NAIP year is 0.3 m, more than 1 km from any training tile, at most three holes per course. 987 locations were run and 348 boxes were accepted. Every accepted box was judged in two independent blind passes, with a third pass on the 43 disagreements.
| Boxes | This hole's tee | Another hole's tee | Not a tee | Unsure | Precision excluding unsure | |
|---|---|---|---|---|---|---|
| Final (majority) | 348 | 305 | 5 | 0 | 38 | 98.4% (95% interval 96.3โ99.5%) |
| Both passes agree | 283 | 280 | 3 | 0 | โ | 98.9% |
| Pass 1 alone | 348 | 302 | 4 | 1 | 41 | 98.4% |
| Pass 2 alone | 348 | 295 | 9 | 1 | 43 | 96.7% |
How to read this:
- 11% of accepted boxes were left undecided by the reviewers and are not counted in the 98.4%. If every undecided box were wrong, precision would be 87.6%.
- The two passes agreed on the exact verdict for 87.6% of boxes.
- All five errors were real tee pads belonging to a different hole. No accepted box was judged to be something other than a tee.
- The rule accepted 37% of fresh locations and 32% of the reviewed held-out ones. Among held-out locations an earlier review had called tees, 54% ended with a box judged a tee. Most rejections were for tree canopy or shade, no box at the location, or low confidence.
- In later production use, a blind sample of 105 routes started from accepted boxes (after Ariad's other publication checks) had 1 wrong and 1 unsure. The wrong one was a practice putting green beside a car park.
Validation pixel IoU at the released epoch was tee 0.39 and green 0.67, on a mixed validation set where most tiles carry point labels only.
Limits
- Native 0.3 m imagery only. On 0.6 m NAIP years, accepted boxes were right about 57% of the time. Resampling coarser imagery does not help.
- It needs a location. The test measured boxes at candidate tee locations for a specific hole. Running the network over a whole course and keeping every tee-coloured region was not tested and will be much less precise.
- It does not know which hole a tee belongs to. A correct pad for the wrong hole is the main failure. Check the result against the hole's green and neighbours.
- Tree-lined and shaded tees are mostly rejected, as are very small or irregular pads. Low recall is by design.
- Tested on United States NAIP imagery in 21 states, with errors only in FL, IA and NJ. Other countries, sensors, seasons and colour-only imagery were not tested. The network needs a real near-infrared band.
- It gives no hole numbering, tee names, ratings or surveyed boundaries.
Training data
8,056 tiles on a 0.3 m grid, 384 pixels square:
- 2,896 tee-centred tiles on 800 courses whose OpenStreetMap tee labels are complete, with all OpenStreetMap golf classes labelled;
- 2,075 tiles around locations reviewed as tees (a 2.5 m disc labelled tee, the rest ignored);
- 3,085 tiles around locations reviewed as not tees (an 8 m disc labelled "anything but tee", used as hard negatives). OpenStreetMap tee outlines override the disc.
The point labels come from Ariad's own AI-assisted review of course imagery and are not released. Imagery is the newest USDA NAIP year for each state, read from the Microsoft Planetary Computer mirror. About a third of the tiles were native 0.3 m; the rest were 0.6 m years resampled to the 0.3 m grid. Courses in AZ, CO, GA, IA and OR, the New York City metro area and Canada were never trained on.
Training: warm start from v4, tee class weight 8 in the cross-entropy term, one-cycle schedule with peak learning rate 2e-4, batch 12, 8 epochs, last epoch released.
Provenance and licensing
provenance.json records the checkpoint hash. The Safetensors file holds the tested checkpoint's tensors unchanged, and tee_rule.py gives the same answers as the code used in the tests (checked on 300 synthetic cases and 7 recorded detections).
Imagery source: USDA NAIP (public domain), read from the Microsoft Planetary Computer. Labels: ยฉ OpenStreetMap contributors, under ODbL 1.0. Library: Segmentation Models PyTorch.
No additional license grant for the model weights is specified in this release. Public download availability does not by itself assign a model license; upstream imagery, label, and software terms remain separate.
- Downloads last month
- 27
Model tree for ariadgolf/golf-tee-box-detector
Base model
ariadgolf/golf-course-segmentation