Image understanding, generation, and 3D reconstruction · Object detection · VIS005 · Architecture
YOLO detection family
YOLO denotes a broad family of one-pass object detectors. The original model jointly predicted boxes and classes over an image grid; subsequent versions materially changed heads, matching, losses and postprocessing.
In CodeSplash
Documented in the Academy only. There's no Set up button.
- Availability
- Explained here
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
YOLO denotes a broad family of one-pass object detectors. The original model jointly predicted boxes and classes over an image grid; subsequent versions materially changed heads, matching, losses and postprocessing. The family is counted once rather than as dozens of checkpoints.
Question / hypotheses
Does a precisely specified YOLO variant meet the target accuracy, crowding and latency requirements? This is a modeling/evaluation question, not a formal null-hypothesis test.
Architecture / computational structure
A visual backbone and detection feature aggregation feed dense prediction heads. Original YOLO uses grid-associated box/confidence outputs; later releases may use anchors, anchor-free predictions or different assignment and decoding schemes.
Assumptions
Dense grids can struggle with crowded or small objects depending on design. Training labels, image preprocessing and class mapping must match the selected checkpoint. Real-time claims depend on hardware, batch size and end-to-end processing.
Formula / computational definition
Original YOLO predicts per-box confidence and per-cell conditional class probabilities. Its multi-part squared-error objective weights coordinates, object/no-object confidence and classes. This original confidence definition is not universal across later YOLO versions.
Parameters and notation
Notation: P(object) is the original box-level object-presence term and IoU its overlap with ground truth; conditional class probability is multiplied by the box confidence for original-style class scoring. Later family members require their own documented output interpretation.
Learned or estimated: Backbone, aggregation and class/objectness/localization-head weights; any learned assignment or auxiliary components depend on the selected version.
Hyperparameters and effects: Exact version/configuration, image size, augmentation, assignment rules, loss weights, confidence threshold and postprocessing. Architecture family names alone do not determine anchor usage, output parameterization or loss.
Fitting, fine-tuning, and adaptation
Choose a pinned implementation and compatible checkpoint, replace label heads if necessary, and train those heads before low-rate backbone adaptation. Tune augmentations and input scale using target validation data. Check source retention and class calibration after fine-tuning; exporting or changing postprocessing requires a separate accuracy check.
How to use and calibrate
Split by independent image source, scene, subject or capture sequence before augmentation; keep near-duplicate frames and crops in the same split. Report box AP over IoU thresholds, small/crowded-object recall, false-positive tradeoffs and actual deployment latency. State release, checkpoint, preprocessing and postprocessing to make comparisons reproducible.
Example application
Deploy a one-pass detector under an explicit accuracy and latency budget while documenting the exact family member. This is a proposed use case, not a claim of validated performance on supplied real data.
Interpretation / pitfalls
Watch out
A training loss, confidence score or attention map is not a p-value or causal explanation. Confidence calibration, annotation quality and distribution-shift performance need separate assessment. A correct component calculation does not validate the full architecture, checkpoint or deployment pipeline.
Python and R code examples
Scope: Original-YOLO-style conditional class probability multiplied by box confidence, followed by single-class NMS; later family heads differ. Use the shared setup. Dependencies: NumPy / base R. Validation: Python executed; R unexecuted.
Full-model route: Python: the official implementation for the chosen YOLO release; R: explicit bridge or custom version-specific implementation. The example illustrates original-style confidence/class scoring and NMS, not every modern YOLO head.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — Original-YOLO-style conditional class probability multiplied by box confidence, followed by single-class NMS; later family heads differ. Use the shared setup.
Shared setup for this chapter
import numpy as np
from itertools import permutations
def softmax(x):
x=np.asarray(x,dtype=float)
e=np.exp(x-x.max(axis=-1,keepdims=True))
return e/e.sum(axis=-1,keepdims=True)
def bilinear(a,y,x):
y=float(np.clip(y,0,a.shape[0]-1)); x=float(np.clip(x,0,a.shape[1]-1))
y0=int(np.floor(y)); x0=int(np.floor(x))
y1=min(y0+1,a.shape[0]-1); x1=min(x0+1,a.shape[1]-1)
dy=y-y0; dx=x-x0
return (1-dy)*((1-dx)*a[y0,x0]+dx*a[y0,x1])+dy*((1-dx)*a[y1,x0]+dx*a[y1,x1])
boxes=np.array([[0,0,2,2],[.1,.1,2.1,2.1],[4,4,6,6]],float)
scores=np.array([.9,.8,.7])*np.array([.9,.9,.8])
order=list(np.argsort(scores)[::-1]); keep=[]
while order:
i=order.pop(0); keep.append(i); remaining=[]
for j in order:
inter=np.maximum(np.minimum(boxes[i,2:],boxes[j,2:])-np.maximum(boxes[i,:2],boxes[j,:2]),0).prod()
union=np.prod(boxes[i,2:]-boxes[i,:2])+np.prod(boxes[j,2:]-boxes[j,:2])-inter
if inter/union<=.5: remaining.append(j)
order=remaining
assert keep==[0,2]
print('class scores:',scores,'NMS kept (zero-based):',keep)
Component demo, not a trained model — Original-YOLO-style conditional class probability multiplied by box confidence, followed by single-class NMS; later family heads differ. Use the shared setup.
Shared setup for this chapter
softmax <- function(x) {
if(is.null(dim(x))) {e<-exp(x-max(x)); return(e/sum(e))}
t(apply(x,1,function(v) {e<-exp(v-max(v)); e/sum(e)}))
}
bilinear <- function(a,y,x) {
y<-min(max(y,0),nrow(a)-1); x<-min(max(x,0),ncol(a)-1)
y0<-floor(y); x0<-floor(x); y1<-min(y0+1,nrow(a)-1); x1<-min(x0+1,ncol(a)-1)
dy<-y-y0; dx<-x-x0
(1-dy)*((1-dx)*a[y0+1,x0+1]+dx*a[y0+1,x1+1])+dy*((1-dx)*a[y1+1,x0+1]+dx*a[y1+1,x1+1])
}
boxes<-matrix(c(0,0,2,2,.1,.1,2.1,2.1,4,4,6,6),ncol=4,byrow=TRUE)
scores<-c(.9,.8,.7)*c(.9,.9,.8); ord<-order(scores,decreasing=TRUE); keep<-integer()
while(length(ord)>0) {
i<-ord[1]; ord<-ord[-1]; keep<-c(keep,i); remaining<-integer()
for(j in ord) {
inter<-prod(pmax(pmin(boxes[i,3:4],boxes[j,3:4])-pmax(boxes[i,1:2],boxes[j,1:2]),0))
union<-prod(boxes[i,3:4]-boxes[i,1:2])+prod(boxes[j,3:4]-boxes[j,1:2])-inter
if(inter/union<=.5) remaining<-c(remaining,j)
}; ord<-remaining
}
stopifnot(all(keep==c(1,3)))
print(list(class_scores=scores,NMS_kept_zero_based=keep-1))
Sources
- Source 1arxiv.org
- Source 2arxiv.org
- Source 3github.com
From the CodeSplash reference, entry VIS005.