Paper · 2020-04-28 · cs.CV, eess.IV
Real-Time Apple Detection System Using Embedded Systems With Hardware Accelerators: An Edge AI Application
Adapts YOLOv3-tiny for small apple detection: a third, finer detection scale at 608x608 input, trained on 618 orchard images with AdamW. Reports 83.64% mAP at IoU 0.5 on OIDv4 apples, against 77.02% for retrained YOLOv3-tiny, and up to 30 fps on a Jetson AGX Xavier at 30 W. Author-reported.
Object detectionOn-device inferenceMulti-scale feature fusionWeight decayobject-detectionedge-aiembedded-inferenceagriculture
AI-compiled by claude-haiku-5-5 on 2026-11-12, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Counting apples by hand in an orchard is slow, and the usual detectors need a big computer that cannot be carried through the rows. This paper asks whether a small, fast object detector can run on cheap embedded boards, some with a plug-in accelerator, and still find apples in real photos.
The starting point is a small, fast detector called YOLOv3-tiny. It is good at large objects but misses small ones, and apples far away in a tree are small. The authors add a third, finer detection layer that looks at a higher-resolution version of the image, and they train the model on their own orchard photos. They then run it on several cheap embedded boards and measure both accuracy and power use. The most powerful board reaches about 30 frames per second; the cheaper ones run slower.
TL;DR
- Modified YOLOv3-tiny with detection at three scales (19×19, 38×38, 76×76) for a 608×608 input, one class (apple) §III-C tab. 3.
- Trained on 618 orchard images with AdamW for 100 epochs, transfer-learned from a pre-trained backbone §IV-A.
- Reports 83.64% mAP at IoU 0.5 on the OIDv4 apple test set, versus 77.02% for YOLOv3-tiny retrained on the same data tab. 4.
- Runs on Raspberry Pi 3 B+ with Movidius NCS (4–5 fps), Jetson Nano (6–8 fps) and Jetson AGX Xavier (up to 30 fps) tab. 5. All numbers are author-reported.
Problem
Fruit in orchards is often occluded by leaves and branches, under variable light, and sometimes small at a distance. Detectors that are accurate enough are too heavy for an embedded platform on a ground vehicle, and the original YOLOv3-tiny loses low-level detail that small objects need §I §III-C. The paper also assumes the detector must run in real time on power-limited hardware §II-B tab. 1.
Method
Overview. The network is YOLOv3-tiny with a modified head. The backbone (Darknet-19 style, layers 0–12) is kept as in the original, with spatial sizes scaled to the 608×608 input §III-A §IV-A tab. 2. The head adds an FPN-style path: features from layer 13 are upsampled and concatenated with backbone features from layers 8 and 6, producing predictions at strides 32, 16 and 8 §III-C fig. 3 tab. 3.
Head layers tab. 3. Output shapes are for the 608×608 input, one class.
| Layer | Operation | Output |
|---|---|---|
| 13 | conv 1×1, 256 | 19×19×256 |
| 14 | conv 3×3, 512 | 19×19×512 |
| 15 | conv 1×1, see pitfall 1 | 19×19×18 |
| 16 | YOLO (stride 32) | — |
| 17–18 | route 13; conv 1×1, 128 | 19×19×128 |
| 19 | upsample 2×2 | 38×38×128 |
| 20 | route 19 and 8 | 38×38×384 |
| 21 | conv 3×3, 256 | 38×38×256 |
| 22 | conv 1×1, 18 | 38×38×18 |
| 23 | YOLO (stride 16) | — |
| 24–25 | route 21; conv 1×1, 128 | 38×38×128 |
| 26 | upsample 2×2 | 76×76×128 |
| 27 | route 26 and 6 | 76×76×256 |
| 28 | conv 3×3, 256 | 76×76×256 |
| 29 | conv 1×1, 18 | 76×76×18 |
| 30 | YOLO (stride 8) | — |
The output layer width is 3 × (5 + C) = 18 for one class: three anchors per cell, each with four box values, one objectness value and C class values §III-B tab. 3. The 38×38 output for layer 20 (384 channels) follows from concatenating layer 19 (128) and layer 8 (256); the paper does not print this number, so it is derived.
Box decoding §III-B eq. 1–4. Each prediction is one anchor in one cell. The centre is a sigmoid offset inside the cell plus the cell's grid position; width and height are the anchor's prior size scaled by an exponential of the raw output.
b_x = \sigma(t_x + c_x) \quad [\text{eq. 1}] b_y = \sigma(t_y + c_y) \quad [\text{eq. 2}] b_w = p_w e^{t_w} \quad [\text{eq. 3}] b_h = p_h e^{t_h} \quad [\text{eq. 4}]
Here t are raw outputs, (c_x, c_y) the cell's top-left grid coordinates and (p_w, p_h) the anchor size §III-B. Eq. 1 and 2 are reproduced as printed (see pitfall 2).
Decoding procedure (the paper describes it in prose; this is our implementation of it, not a quote).
# Decode one detection scale [§III-B] [eq. 1-4]
# Input: raw (B, S, S, 18) for S in {19, 38, 76}, anchors (3, 2)
# Output: boxes (B, S, S, 3, 4), objectness, class probabilities
def decode_scale(raw, anchors, grid):
# Split the 18 channels into 3 anchors of 6 values each [§III-B]
per_anchor = reshape(raw, (B, S, S, 3, 6))
# Box centre: sigmoid offset from the cell origin [eq. 1-2]
centre = sigmoid(per_anchor[..., 0:2] + grid)
# Box size: anchor prior times the exponential [eq. 3-4]
size = anchors * exp(per_anchor[..., 2:4])
# Objectness and class probabilities use sigmoid, not softmax [§III-B]
objectness = sigmoid(per_anchor[..., 4])
class_probs = sigmoid(per_anchor[..., 5:])
return centre, size, objectness, class_probsPost-processing §III-B §IV-B. Predictions are kept when confidence exceeds c = 0.25, then non-maximum suppression removes duplicates. The NMS threshold is not stated. The three scales give 22,743 candidate boxes in total §III-C.
Training §IV-A eq. 5. The paper applies AdamW with decoupled weight decay, written as a step that subtracts the normalised gradient and a fraction of the weights:
\theta_{t+1} = \theta_t - \frac{\eta}{\sqrt{\hat v_t} + \epsilon} m_t - \eta w_d \theta_t \quad [\text{eq. 5}]
# One AdamW step [§IV-A] [eq. 5]
# Learning rate eta: not stated
def adamw_step(theta, m, v_hat, eta):
# Adaptive gradient step from the first and second moments [eq. 5]
step = eta * m / (sqrt(v_hat) + eps)
# Decoupled weight decay, applied to the weights directly [eq. 5]
theta = theta - step - eta * wd * theta
return thetaEvaluation §IV-B. Precision and recall are computed per confidence threshold c with TP, FP and FN counts at a target IoU eq. 6. Average precision is the area under the monotone precision-recall curve eq. 7. For apples only, mAP equals AP.
p(c) = \frac{TP(c)}{TP(c) + FP(c)}, \qquad r(c) = \frac{TP(c)}{TP(c) + FN(c)} \quad [\text{eq. 6}] AP = \int_0^1 p(r)\,dr \quad [\text{eq. 7}]
Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| Input size | 608 × 608 (from 416 × 416) | §III-C | Scales 19, 38, 76 for strides 32, 16, 8 tab. 3 |
| Classes | 1 (apple) | §III-C | Output channels 3 × (5 + 1) = 18 §III-B |
| Anchors | 3 per scale, 9 total | §III-C | Values not stated; paper mentions k-means in general terms §III-B |
| Optimizer | AdamW | §IV-A eq. 5 | |
| β1, β2, ε | 0.89, 0.99, 1e-9 | §IV-A | |
| Weight decay w_d | 0.0001 | §IV-A | Applied as in eq. 5 |
| Learning rate η | not stated | §IV-A | Schedule, warm-up not stated |
| Batch size | not stated | — | |
| Epochs | 100 | §IV-A | Training took about one hour §IV-A |
| Training set | 618 orchard images | §II-A §IV-A | Split into train/val/test not stated |
| Image preprocessing | Resize 5202×3465 to 1920×1080, then mean subtraction | §IV-A | Input 608×608 after resizing for the network §III-C |
| Initialisation | Pre-trained backbone of the original model | §IV-A | Weight source not stated beyond "the original model" tab. 2 |
| Label generation | Draft labels from YOLOv3-spp (COCO), refined by hand in LabelMe | §IV-A | |
| Confidence threshold c | 0.25 | §IV-B tab. 4 | |
| IoU target | 0.5 and 0.75 | §IV-B tab. 4 | |
| NMS threshold | not stated | §III-B | |
| Data augmentation | not stated | — | |
| Training hardware | RTX 2080 Ti, 64 GB DDR4 | §II-B | TensorFlow, CUDA 10 §IV-A |
| Regularisation | AdamW's decoupled decay was reported to beat classical L2 regularisation | §IV-A [ref. 54] | Author-reported comparison |
Results
Author-reported. Setup: OIDv4 apple test set, model at 608×608 input, retrained YOLOv3-tiny as baseline §IV-B tab. 4.
| Setting | Metric | Baseline (YOLOv3-tiny retrained) | This paper | Source |
|---|---|---|---|---|
| IoU 0.50, c = 0.25 | mAP | 77.02% | 83.64% (+6.62) | tab. 4 |
| IoU 0.50, c = 0.25 | recall / precision | not stated | 0.83 / 0.69 | tab. 4 |
| IoU 0.75, c = 0.25 | mAP | 42.50% | 47.97% (+5.47) | tab. 4 |
| IoU 0.75, c = 0.25 | recall / precision | not stated | 0.55 / 0.46 | tab. 4 |
Power and speed on embedded boards tab. 5. Voltage and mean current are measured on the supply; the fps column is the measured frame rate.
| Device | Mode | V [V] | I [A] | P [W] | fps |
|---|---|---|---|---|---|
| Jetson AGX Xavier | Idle 30 W | 19 | 0.35 | 6.65 | n/a |
| Jetson AGX Xavier | Running 30 W | 19 | 1 | 19 | 30 |
| Jetson AGX Xavier | Running 15 W | 19 | 0.88 | 16.72 | 25 |
| Jetson AGX Xavier | Running 10 W | 19 | 0.66 | 12.54 | 13 |
| Jetson Nano | Idle 10 W | 5 | 0.32 | 1.6 | n/a |
| Jetson Nano | Running 10 W | 5 | 2.04 | 10.20 | 8 |
| Jetson Nano | Running 5 W | 5 | 1.42 | 7.1 | 6 |
| Raspberry Pi 3 B+ | Idle | 5 | 0.61 | 3.075 | n/a |
| Raspberry Pi 3 B+ + NCS | Running | 5 | 1.2 | 6 | 4 |
| Raspberry Pi 3 B+ + NCS 2 | Running | 5 | 1.12 | 5.6 | 5 |
Price per frame per second tab. 6. Lower is better; the paper highlights the Jetson Nano (12.38) as the best ratio. It calls the AGX Xavier the highest-quality board but not suited to low-cost use §IV-C §IV-D.
| Device | Price [USD] | fps (max) | Price/fps |
|---|---|---|---|
| Intel Movidius NCS | 70 | 4 | 17.5 |
| Intel NCS 2 | 74 | 5 | 14.8 |
| Jetson Nano | 99 | 8 | 12.38 |
| Jetson AGX Xavier | 800 | 30 | 26.67 |
Per-image examples, two test images excluded from training fig. 6: the original model scores (a) mAP 9.9% and (c) 32.73%; the modified model scores (b) 59.33% and (d) 60.86%. These are single images, not dataset results.
Platform specifications tab. 1: Movidius NCS (Myriad 2 VPU, 100 GFLOPS, FP16, 1 W, $70); NCS 2 (Myriad X VPU, 150 GFLOPS, FP16, 1.5 W, $74); Jetson Nano (128-core Maxwell GPU, 472 GFLOPS, FP16/FP32, 5 or 10 W, $99); Jetson AGX Xavier (512-core Volta GPU, 64 Tensor Cores, 2 NVDLA, 16 TFLOPS, 10/15/30 W, $800).
Paper vs code
No official code. Searched: the paper and abstract give no repository link.
GitHub searches for apple detection yolov3-tiny, Mazzia apple,
Chiaberge yolo and PIC4SeR in org:PIC4SeR returned no repository from
the authors. Two hits were unrelated third-party repositories and were not used.
Pitfalls
- Filter count in layer 15. Table 3 lists 255 filters for layer 15 but an output of 19×19×18 tab. 3. The 18-channel output matches 3 × (5 + 1) §III-B. Use 18 filters, not 255; 255 is the COCO width from the original model tab. 2.
- Eq. 1 and 2 typesetting. The PDF prints σ over (t + c). Original YOLOv3 applies σ to t only and adds c. The paper does not say which form was implemented, and no code is released to check. Verify against the implementer's chosen convention.
- Test-set scope. Section II says the model was benchmarked on all OIDv4 apple images (training, validation and test) §II §II-A. Table 4 says it was run on the test set tab. 4. The number of OIDv4 test images is not stated. Treat the 83.64% figure as "OIDv4 test split, size not stated".
- Labels from another detector. Draft labels came from YOLOv3-spp pre-trained on COCO, then reviewed by hand §IV-A. Labelling errors and the draft model's biases carry into the 618-image training set. Whether the dataset is released is not stated.
- Anchors. The paper cites k-means clustering of ground-truth boxes as YOLO's recipe §III-B, but the anchor values for this model are not stated. Derive them from your own labels if you reimplement.
- Sigmoid, not softmax. Class probabilities are sigmoids so that categories can overlap §III-B. With one class the choice matters little, but it changes how scores combine.
- Speed numbers. The fps values in tab. 5 do not state the input size, the embedded toolchain (OpenVINO, TensorRT, or other) or whether batch size 1 was used. Expect different results on other tools.
- Power accounting. Pi 3 B+ idle is 3.075 W in tab. 5 while 5 V × 0.61 A = 3.05 W. The difference is rounding in the measurement. Power counts the board, not an attached host, and the USB sticks need a host computer §IV-C tab. 6. Table 6 price excludes that host.
- Price/fps ranking. Lower price/fps is better. Table 6 highlights the Nano (12.38), but the AGX Xavier has the highest throughput. These rankings depend on the chosen use case.
- Small-object gain depends on the dataset. The paper notes that the gain is smaller on OIDv4 because those apples are larger on average than the orchard training set §IV-B. Expect different gains on your own data.
- Compute cost of the 76×76 scale. It adds 17,328 candidate boxes, which is most of the 22,743 total §III-C. Post-processing cost grows with it.
- Unstated training details. Learning rate, schedule, batch size, augmentation, NMS threshold and pre-trained weight source are not stated. Do not fill them from other YOLO papers without marking them as assumptions.
Lineage
- Builds on: YOLO (one-stage detection, [ref. 19]) and YOLOv3 with the tiny variant [ref. 20]; FPN-style multi-scale fusion [ref. 44]; transfer learning [ref. 47]; AdamW [ref. 53].
- Compared against: YOLOv3-tiny retrained on the same data tab. 4. Faster R-CNN and RetinaNet are discussed as slower alternatives §III.
- Superseded by: not stated in this paper.
Source and license
Adapted from “Real-Time Apple Detection System Using Embedded Systems With Hardware Accelerators: An Edge AI Application” by Vittorio Mazzia, Francesco Salvetti, Aleem Khaliq, Marcello Chiaberge (arXiv:2004.13410), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.