wikillm

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

arXivPDFMarkdown9 min read

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.

LayerOperationOutput
13conv 1×1, 25619×19×256
14conv 3×3, 51219×19×512
15conv 1×1, see pitfall 119×19×18
16YOLO (stride 32)—
17–18route 13; conv 1×1, 12819×19×128
19upsample 2×238×38×128
20route 19 and 838×38×384
21conv 3×3, 25638×38×256
22conv 1×1, 1838×38×18
23YOLO (stride 16)—
24–25route 21; conv 1×1, 12838×38×128
26upsample 2×276×76×128
27route 26 and 676×76×256
28conv 3×3, 25676×76×256
29conv 1×1, 1876×76×18
30YOLO (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).

Pseudocode
# 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_probs

Post-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}]

Pseudocode
# 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 theta

Evaluation §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

NameValueWhereNotes
Input size608 × 608 (from 416 × 416)§III-CScales 19, 38, 76 for strides 32, 16, 8 tab. 3
Classes1 (apple)§III-COutput channels 3 × (5 + 1) = 18 §III-B
Anchors3 per scale, 9 total§III-CValues not stated; paper mentions k-means in general terms §III-B
OptimizerAdamW§IV-A eq. 5
β1, β2, ε0.89, 0.99, 1e-9§IV-A
Weight decay w_d0.0001§IV-AApplied as in eq. 5
Learning rate ηnot stated§IV-ASchedule, warm-up not stated
Batch sizenot stated—
Epochs100§IV-ATraining took about one hour §IV-A
Training set618 orchard images§II-A §IV-ASplit into train/val/test not stated
Image preprocessingResize 5202×3465 to 1920×1080, then mean subtraction§IV-AInput 608×608 after resizing for the network §III-C
InitialisationPre-trained backbone of the original model§IV-AWeight source not stated beyond "the original model" tab. 2
Label generationDraft labels from YOLOv3-spp (COCO), refined by hand in LabelMe§IV-A
Confidence threshold c0.25§IV-B tab. 4
IoU target0.5 and 0.75§IV-B tab. 4
NMS thresholdnot stated§III-B
Data augmentationnot stated—
Training hardwareRTX 2080 Ti, 64 GB DDR4§II-BTensorFlow, CUDA 10 §IV-A
RegularisationAdamW'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.

SettingMetricBaseline (YOLOv3-tiny retrained)This paperSource
IoU 0.50, c = 0.25mAP77.02%83.64% (+6.62)tab. 4
IoU 0.50, c = 0.25recall / precisionnot stated0.83 / 0.69tab. 4
IoU 0.75, c = 0.25mAP42.50%47.97% (+5.47)tab. 4
IoU 0.75, c = 0.25recall / precisionnot stated0.55 / 0.46tab. 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.

DeviceModeV [V]I [A]P [W]fps
Jetson AGX XavierIdle 30 W190.356.65n/a
Jetson AGX XavierRunning 30 W1911930
Jetson AGX XavierRunning 15 W190.8816.7225
Jetson AGX XavierRunning 10 W190.6612.5413
Jetson NanoIdle 10 W50.321.6n/a
Jetson NanoRunning 10 W52.0410.208
Jetson NanoRunning 5 W51.427.16
Raspberry Pi 3 B+Idle50.613.075n/a
Raspberry Pi 3 B+ + NCSRunning51.264
Raspberry Pi 3 B+ + NCS 2Running51.125.65

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.

DevicePrice [USD]fps (max)Price/fps
Intel Movidius NCS70417.5
Intel NCS 274514.8
Jetson Nano99812.38
Jetson AGX Xavier8003026.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

  1. 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.
  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.
  3. 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".
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.