Training an object detection model for a paid service
Field: Computer vision / Object detection / Open source licences
Period: August to September 2026
Client: Internal project — DataTerra, my geospatial platform
Context
DataTerra, the satellite and drone platform I am building, works with aerial images: orthophotos of land, inspection photos. One question comes up quickly: can we automatically count the trees or cars on an orthophoto, or spot a crack or a rust patch on a façade? That means you have to train an object detection model, or reuse one. Before any technical choice, I had a business question to settle: which model licence allows commercial use?
One clarification, because I am often asked: no, I do not use YOLO. It is the name everyone thinks of, and it is precisely the one I ruled out at the design stage. Here is why, and what I use instead.
Problem
- The best-known model is not free for a paid service. Ultralytics YOLO is released under the AGPL-3.0 licence. This licence requires anyone who modifies the software and lets people use it remotely, over a network, to offer them the source code. Ultralytics says so plainly: for a commercial product, a SaaS platform or an API, without open-sourcing your whole project, you need its Enterprise licence, priced on request.
- Training data has a licence too. A dataset marked "NC" (non-commercial) forbids commercial use. A "CC BY" dataset allows it, provided you credit the author. A model trained on non-commercial data carries the problem with it.
- A generic model gets your images wrong. Seen from above, an air-conditioning unit can look like a car, a shadow like a tree crown.
- A model that runs is not a model that tells the truth. It always produces a number. You still need to know whether that number is right before it goes into a report.
Solution
1. Write the licence rule into the code
An instruction gets forgotten; a coded rule does not. The model catalogue refuses, at start-up, any component under an AGPL or GPL licence, and a model that does not declare its licence does not start. Nobody, neither a developer in a hurry nor an AI agent, can slip in a model that would force you to publish your code or buy a licence.
2. Reuse what exists when the licence allows it
For trees on orthophotos, I use DeepForest, published by the weecology team under the MIT licence, code and weights included. For vehicles, OmDet-Turbo, an "open-vocabulary" detector: you tell it in words what you are looking for. It is under the Apache 2.0 licence and I use it as is, without retraining. The same model can look for people, but that module stays greyed out: it has not been measured enough yet.
3. Train a small specialised model when nothing fits
For cracks on façade photos, no ready-made model was suitable. So I trained my own in August 2026: a small segmentation network that marks, pixel by pixel, what is a crack, built with an MIT-licensed library. The data: the Concrete Crack Segmentation Dataset, published by Çağlar Fırat Özgenel (Middle East Technical University, METU) under CC BY 4.0. Commercial use permitted, attribution required: his name appears in the reports. Corrosion follows the same recipe, with public inspection datasets under CC0 or CC BY.
4. Find the wall first
A façade photo contains sky, trees, cables: plenty of chances to see cracks everywhere. A first small model, which I trained myself, therefore isolates the area to analyse. Its images come from COCO, a large public dataset in which each photo keeps its own licence. I kept only photos under plain attribution (CC BY) or with no known restrictions (Flickr Commons), and discarded all those marked NC, SA or ND.
5. A second opinion
On several modules, the detector proposes and a broader vision model reviews each retained detection: Gemma, by Google, released under Apache 2.0 for the version used. It confirms or rejects the presence of the object. What it cannot read, it keeps rather than deletes.
6. Measure before you sell
The rule is simple: a module only enters the catalogue once it has been measured on a test bench, meaning images whose correct answer is known. And it is the bench, not the training validation curve, that picks the best version of the model among those produced along the way.
Under the hood: for your IT person
Every component is under a permissive licence, checked at the source (repository or Hugging Face card) on 15 November 2026.
- Trees: DeepForest (RetinaNet), weecology package and weights, MIT. Exported from PyTorch to ONNX, with a parity check on a real tile before replacing the original.
- Vehicles, people: OmDet-Turbo Swin-tiny (Om AI Lab), Apache-2.0, text prompt. Public weights pinned to a fixed revision, run on PyTorch CPU. Pitfall: the loader may attempt a network call while reading its config; force offline mode.
- Cracks, corrosion, wall area: U-Net with a MobileNetV3-small encoder via segmentation_models.pytorch (MIT), exported to ONNX. The threshold applied after the sigmoid is not in the graph: changing it breaks nothing, but takes you out of the measured operating point.
- Inference: ONNX Runtime (MIT) on CPU, no GPU. Large orthophotos are sliced into tiles with SAHI (MIT), then boxes are merged by duplicate suppression across the whole image.
- Integrity: versioned weights with a SHA-256 fingerprint checked at load time, never downloaded at run time.
- Ruled out: Ultralytics YOLO (AGPL-3.0); RT-DETR, although Apache-2.0, tried then withdrawn because it saw nothing in top-down views; a drone dataset restricted to research.
- Bench: ground-truth images, run through the real production engine rather than a re-implementation. The registry refuses the "measured" label without a description of the bench.
Result
- No AGPL or GPL component in the chain: no code to publish, no commercial licence to negotiate, and a rule that checks it at every start-up.
- Models that run on an ordinary processor, from versioned and verified files.
- In-house models (cracks, corrosion, wall area) trained on data whose licence allows commercial use, with the required attributions.
- An honest catalogue: what is not measured stays greyed out, like people detection.
What I take away
- Read the licence before the leaderboard. The best model of the moment is worthless to you if its licence forces you to publish your code or buy a licence to sell your service.
- Data matters as much as code. NC: forbidden for commercial use. CC BY: credit the author. Keep a register: model, version, licence, source, date checked.
- Small and specialised rather than big and rented. A small model trained on your problem runs on your premises and depends on no service and no price change. I cover this in my article on specialised models and in the one on AI running on small machines.
- Measure before you sell. A module that runs is not a module that tells the truth. No bench, no catalogue.
- This is not legal advice. For a borderline case, have a lawyer review the licence.
Going further
Want to detect something in your images without depending on a service or a licence trap? See my approach to sovereign AI and the business applications I set up, or book a 20-minute discovery call.
Sources
- GNU Affero General Public License, version 3 (section 13), Free Software Foundation, 19.11.2007, accessed 15 November 2026
- Ultralytics Licensing (AGPL-3.0 and Enterprise License), Ultralytics, accessed 15 November 2026
- ultralytics/ultralytics: repository (AGPL-3.0 licence), GitHub, accessed 15 November 2026
- DeepForest: repository (MIT licence), weecology, GitHub, accessed 15 November 2026
- weecology/deepforest-tree: model card (MIT), Hugging Face, accessed 15 November 2026
- omlab/omdet-turbo-swin-tiny-hf: model card (Apache-2.0), Om AI Lab, Hugging Face, accessed 15 November 2026
- segmentation_models.pytorch: repository (MIT licence), GitHub, accessed 15 November 2026
- Concrete Crack Segmentation Dataset, v1 (CC BY 4.0), Ç. F. Özgenel, METU, Mendeley Data, 03.04.2019, DOI 10.17632/jwsn7tfbrp.1, accessed 15 November 2026
- COCO: Terms of Use, COCO Consortium, accessed 15 November 2026
- google/gemma-4-31B-it: model card (Apache 2.0), Google DeepMind, Hugging Face, accessed 15 November 2026
- ONNX Runtime: repository (MIT licence), Microsoft, GitHub, accessed 15 November 2026
- SAHI (Slicing Aided Hyper Inference): repository (MIT licence), OBSS, GitHub, accessed 15 November 2026
- Attribution-NonCommercial 4.0 International (deed), Creative Commons, accessed 15 November 2026
Cover photo: JonRichfield / Wikimedia Commons, CC BY-SA 3.0 licence.
Tags: object detection, computer vision, open source licence, AGPL, YOLO, DataTerra, drone, sovereign AI