Module 1/5 · Weeks 1–3 · 27 h

Edge-computing architectures and the limits of on-device AI

UAT 462 Edge Artificial Intelligence for UAS

About 100 minDraft, awaiting reviewLast updated 3 October 2026

Lesson

By the end of this module you will be able to

  1. Choose where to compute (on the aircraft, at the ground station or in the cloud) from mission requirements, data volume, link availability and privacy
  2. Compute the minimum frame rate of a mission from GSD, speed and image overlap, and separate it from the camera's maximum frame rate
  3. Count MACs, parameters and intermediate activation memory of a model, and check whether it fits the memory of an MCU
  4. Use the roofline model to bound the time of each layer and to separate memory-bound layers from compute-bound ones
  5. Compare platform families (MCU, Cortex-A, GPU module, NPU and TPU accelerator) using specifications checked at the manufacturer

Prerequisites: UAT 204 Microcontrollers and Embedded Systems (module 5) · UAT 306 Artificial Intelligence for UAS (module 5)

Why this matters

A model that is accurate on a training machine with a strong GPU is usually too slow, too large and too power-hungry for the small computer on a drone. An edge device is a computer that processes data close to where it is produced, such as a board on the aircraft or at the ground station. Running there lets the system decide without internet access, send less data down and respond quickly, at the cost of limited compute, memory, cooling and power. This course is about delivery: making a trained model run reliably on a small board. It does not teach model training (see UAT 306 and UAT 456) and does not repeat MCU architecture and RTOS (see UAT 204).

The course follows one fictional case through all five modules: a university engineering team designs an illegal-dumping detector on a patrol drone for a sub-district municipality. The drone flies 10 km along canals and canal-side roads at dawn and in the evening, looks for fresh waste piles and parked dumping vehicles, and alerts officers with three cropped images, a position and a time, without sending the whole video down. All figures are fictional. The Python code can be downloaded from /downloads/uat-462/. Code that uses onnx and onnxruntime (module 2) and scipy and cryptography (module 5) needs those libraries: pip install numpy scipy onnx onnxruntime cryptography.

The requirements the team agrees with the municipality (assumed) are the thread that every module returns to.

IDRequirementChecked in
R1Detect fresh waste piles and parked dumping vehicles at the accuracy the municipality setsUAT 306 and UAT 456 (not repeated here)
R2Patrol mode detects at 1 fps or more; evidence mode (at most 3 minutes) at 10 fps or more with p95 at most 100 ms1, 4
R3Officers are alerted within 60 seconds of a find; an alert is at most 150 kB1, 5
R4Flight time at least 1.3 times the 20.8-minute sortie, computer included5
R5Works in an equipment bay that reaches 45 °C5
R6Images of people and number plates do not leave the device in an identifiable form1, 5

Where to compute

NIST describes fog computing as a layer between IoT devices and the cloud that cuts latency and speeds up response for time-sensitive work (Iorga et al., 2018). A drone has three places to compute: on the aircraft, at the ground station and in the cloud. Five criteria decide.

CriterionOn the aircraftGround stationCloud
LatencyLowestDepends on the video linkHigh
Bandwidth neededLow (only results)High (images)High (images)
Depends on the linkNoNeeded all the timeNeeded all the time
Mass, power, heat on boardCarriedNoneNone
PrivacyImages stay on boardImages leave the aircraftImages leave the aircraft and reach another organisation

Privacy is not only a feeling. Section 6 of the Personal Data Protection Act B.E. 2562 defines personal data as information about a person that allows that person to be identified, directly or indirectly. A face or a number plate may qualify depending on context. Processing on board and sending only cropped images of the pile, with identifying parts masked, makes requirement R6 easier than sending all the video (legal interpretation needs expert advice; a member’s bill amending the Act was open for comment on the Parliament website until 15 August 2026, and as of early October 2026 no evidence of enactment was found, so check the text in force; Baker McKenzie, 2026).

Before choosing a location, find what the mission really needs, not what the camera can do. Consecutive images must overlap enough that each object is seen once or twice. The footprint along the flight direction is ; a new image is needed every at speed , which gives the minimum frame rate .

Example 1 The frame rate the mission needs, and the data to send

The camera gives 1,920 × 1,080 pixel images at 3 cm GSD, flying at 8 m/s with 60% forward overlap along a 10 km sortie. The team compares sending every image away for analysis with detecting on board and sending only alerts (all data-volume figures assumed).

# the real mission requirement: minimum frame rate from geometry, and the data that must be sent
gsd, v = 0.03, 8.0                                # GSD (m/px) and speed (m/s) (assumed)
rows = 1080                                       # pixel rows along the flight direction
overlap = 0.60                                    # at least 60 % forward overlap
along = rows * gsd
step = along * (1 - overlap)
print(f"footprint along track {along:.1f} m, a new frame every {step:.2f} m = {step / v:.2f} s -> minimum {v / step:.2f} fps")

design_fps, sortie_m = 1.0, 10_000                # design at 1 fps, 10 km per sortie
sortie_s = sortie_m / v
frames = design_fps * sortie_s
jpeg_mb = 0.45                                    # one JPEG frame (MB) (assumed)
link_mbps, availability = 1.5, 0.70               # average mobile uplink and share of time with coverage (assumed)
print(f"sortie {sortie_s / 60:.1f} min, {frames:.0f} frames, {frames * jpeg_mb / 1000:.2f} GB of video")
print(f"streaming needs {jpeg_mb * 8 * design_fps:.1f} Mbit/s; the link gives {link_mbps * availability:.2f} Mbit/s on average")
alerts, alert_kb = 8, 150                         # events per sortie and alert size (three crops, position, time) (assumed)
edge_mb = alerts * alert_kb / 1000
print(f"on-board detection sends {edge_mb:.2f} MB = {edge_mb / (frames * jpeg_mb) * 100:.2f} % of the video volume")
print(f"cloud analysis without buffering sees only {availability * 100:.0f} % of the frames")
footprint along track 32.4 m, a new frame every 12.96 m = 1.62 s -> minimum 0.62 fps
sortie 20.8 min, 1250 frames, 0.56 GB of video
streaming needs 3.6 Mbit/s; the link gives 1.05 Mbit/s on average
on-board detection sends 1.20 MB = 0.21 % of the video volume
cloud analysis without buffering sees only 70 % of the frames

The mission needs only 0.62 fps. The team designs for 1 fps to leave margin, not for the 30 fps the camera can do, which is the key lesson of the whole course: the camera’s maximum frame rate is not the requirement. Sending every image needs 3.6 Mbit/s while the link averages only 1.05 Mbit/s and has gaps; without buffering, remote analysis would see only 70% of the frames. On-board detection sends just 1.20 MB per sortie, 0.21% of the video volume, and the images never leave the aircraft. The team chooses on-board processing. Evidence mode at 10 fps lasts at most 3 minutes and is the harder requirement (R2).

Diagram of three images in sequence along the flight direction. Each is 32.4 metres long along the track and they start 12.96 metres apart, which is 0, 1.62 and 3.24 seconds. The first and second images overlap by 19.44 metres, 60 percent
Figure 1 Footprint, spacing between images and overlap at 3 cm GSD and 8 m/s

Platform families

Edge platforms fall into four families by the way they compute. The figures in the table were checked on the manufacturers’ pages (see the bibliography). They are specifications, not measurements of our model.

FamilyChecked exampleManufacturer figuresWhat usually limits first
MCU and TinyMLRaspberry Pi Pico 2Two Arm Cortex-M33 cores at 150 MHz, 520 KB SRAM, 4 MB on-board flashSRAM. LiteRT for Microcontrollers has a core runtime of about 16 KB on a Cortex-M3, needs no operating system and supports only some operators
Cortex-A board (SBC)Raspberry Pi 5Four Cortex-A76 cores at 2.4 GHz, LPDDR4X-4267, 1 to 16 GB RAMMemory bandwidth, CPU compute and heat (the maker recommends active cooling)
GPU moduleJetson Orin Nano SuperINT8 67 TOPS (sparse) and 33 TOPS (dense), 8 GB 128-bit LPDDR5 at 102 GB/s, 7, 15 and 25 W power modesPower, heat, mass and memory bandwidth
NPU and TPU acceleratorHailo-8L and Hailo-8 on the Raspberry Pi AI HAT+ (13 and 26 TOPS INT8 over the PCIe port of a Raspberry Pi 5; the newer AI HAT+ 2 uses a Hailo-10H with 40 TOPS INT4 and 8 GB of its own memory and is aimed at language models); Google Coral Edge TPU (4 TOPS int8, 2 TOPS per watt, USB 3.0 Type-C); Rockchip RK3588 (6 TOPS triple-core NPU supporting int4 to TF32, with four Cortex-A76 and four Cortex-A55 cores)Operators the accelerator supports, and numeric precision; for example the Edge TPU needs 8-bit tensors of constant size and only supported operators

Three cautions when reading the table. First, TOPS need their conditions. Jetson states both sparse and dense; the sparse figure is twice the dense one, the same ratio Mishra et al. (2021) report for the 2:4 structured-sparsity pattern that doubles the math throughput. Read it as: the high number applies when the model’s weights are pruned to that pattern (module 3); otherwise use the dense figure. Second, an accelerator’s TOPS are not the system’s TOPS. An operator that is not supported must fall back to the CPU (module 2). Third, these figures exclude the time to read the image, resize it and send the result (module 4).

Count the model’s cost before buying the board

Before asking which board is fast enough, count what the model needs. There are three quantities. MAC (multiply-accumulate) is the number of multiply-accumulates per image. A convolution layer of size produces positions, each needing MACs. Parameters are the weights to store (). Activation memory is the data each layer reads and writes, which must be held at the same time while that layer runs (Sze et al., 2017). MCUs usually die of the last one, not of the weights.

Example 2 Does the waste detector fit on an MCU?

The team designs a small model, WasteNet-S (assumed), taking a 640 × 640 image, with nine 3 × 3 convolution layers and a 1 × 1 prediction layer. It counts the cost and compares with the Pico 2 board (520 KB SRAM, 4 MB flash), then finds what input size would fit and how small the objects become. A 1.5 m waste pile at 3 cm GSD is 50 pixels wide in the full 1,920-pixel image.

# a small detector, WasteNet-S (assumed), taking a 640 x 640 image, mostly 3 x 3 convolutions
layers = [("conv1", 3, 16, 3, 2), ("conv2", 16, 32, 3, 2), ("conv3", 32, 32, 3, 1), ("conv4", 32, 64, 3, 2),
          ("conv5", 64, 64, 3, 1), ("conv6", 64, 128, 3, 2), ("conv7", 128, 128, 3, 1), ("conv8", 128, 256, 3, 2),
          ("conv9", 256, 256, 3, 1), ("head", 256, 21, 1, 1)]   # (name, in channels, out channels, kernel, stride)

def profile(size):
    rows, n = [], size
    for name, cin, cout, k, s in layers:
        out = n // s
        rows.append(dict(name=name, macs=out * out * k * k * cin * cout, params=k * k * cin * cout + cout,
                         act_in=n * n * cin, act_out=out * out * cout))
        n = out
    return rows

rows = profile(640)
macs, params = sum(r["macs"] for r in rows), sum(r["params"] for r in rows)
print(f"{macs / 1e9:.3f} GMAC per image, {params / 1e6:.3f} M parameters")
peak = max(r["act_in"] + r["act_out"] for r in rows)       # the layer that must hold its input and output together
print(f"peak activation: int8 {peak / 1000:.0f} kB, float32 {4 * peak / 1000:.0f} kB; weights int8 {params / 1e6:.2f} MB")
sram, flash = 520_000, 4_000_000                           # Pico 2: 520 KB SRAM, 4 MB flash
print(f"RP2350 board: weights fit in flash: {params <= flash}; int8 activations fit in SRAM: {peak <= sram}")
for size in (640, 448, 320, 224):
    p = max(r["act_in"] + r["act_out"] for r in profile(size))
    m = sum(r["macs"] for r in profile(size))
    print(f"input {size}: peak int8 {p / 1000:5.0f} kB, fits 70 % of SRAM: {p <= 0.7 * sram}, {m / 1e9:.3f} GMAC, pile 1.5 m wide = {1.5 / 0.03 * size / 1920:.1f} px")
1.462 GMAC per image, 1.182 M parameters
peak activation: int8 2867 kB, float32 11469 kB; weights int8 1.18 MB
RP2350 board: weights fit in flash: True; int8 activations fit in SRAM: False
input 640: peak int8  2867 kB, fits 70 % of SRAM: False, 1.462 GMAC, pile 1.5 m wide = 16.7 px
input 448: peak int8  1405 kB, fits 70 % of SRAM: False, 0.716 GMAC, pile 1.5 m wide = 11.7 px
input 320: peak int8   717 kB, fits 70 % of SRAM: False, 0.365 GMAC, pile 1.5 m wide = 8.3 px
input 224: peak int8   351 kB, fits 70 % of SRAM: True, 0.179 GMAC, pile 1.5 m wide = 5.8 px

The int8 weights take 1.18 MB and fit the 4 MB flash, but the first layer must hold its 1.23 MB input and 1.64 MB output together, 2,867 kB, more than five times the SRAM (11,469 kB in float32). The input must shrink to 224, where the activation memory is 351 kB and meets the 70% limit (leaving room for other code), but a 1.5 m pile is then only 5.8 pixels wide, too small for a detector to see well, and 0.179 GMAC still takes long on a 150 MHz MCU. Conclusion: an MCU is not suitable for this detector, though it may suit a much smaller helper task such as screening whether a small crop contains a pile.

Horizontal bars of peak int8 activation memory: input 640 is 2867 kilobytes, input 448 is 1405 and input 320 is 717, in pink; input 224 is 351 in green. A dashed pink line marks 364 kilobytes, 70 percent of the SRAM
Figure 2 Peak int8 activation memory by input size against 70% of 520 kB SRAM

The roofline model: what limits the time

A board has two limits: peak compute (operations per second) and memory bandwidth (bytes per second). The roofline model of Williams et al. (2009) puts both on one graph. A piece of work has an arithmetic intensity , the number of operations per byte read or written, and the best performance it can reach is . At low the work is memory-bound (the sloped roof); at high it is compute-bound (the flat roof). The ridge is . The minimum time of a layer is .

Sze et al. (2017) point out why data movement matters: energy. A DRAM access costs about 200 times the energy of one MAC, while an on-chip buffer of a few hundred kilobytes costs about 6 times (these figures are from a research architecture, not from any particular board, but the orders of magnitude explain the trend). Module 3 uses this to explain why using fewer bits saves both time and energy.

Example 3 Which layers of WasteNet-S are memory-bound?

Use the layer table from Example 2 and compute each layer’s arithmetic intensity (int8, one byte per value, reading the input, writing the output and reading the weights once) against two devices. The GPU module uses the manufacturer’s figures (33 TOPS dense, 102 GB/s); the Cortex-A board is an assumed value that does not refer to any model.

# roofline: an upper bound on each layer from peak compute and memory bandwidth (uses layers and profile from Example 2)
work = []
for r in profile(640):
    ops = 2 * r["macs"]                                    # 1 MAC = 2 operations
    traffic = r["act_in"] + r["act_out"] + r["params"]     # bytes read and written (int8, 1 byte per value)
    work.append((r["name"], ops, traffic))
devices = {"edge GPU module (vendor: 33 TOPS dense INT8, 102 GB/s)": (33e12, 102e9),
           "Cortex-A SBC (assumed: 0.2 TOPS, 12 GB/s)": (0.2e12, 12e9)}
for label, (peak_ops, bandwidth) in devices.items():
    ridge = peak_ops / bandwidth                           # arithmetic intensity where the two roofs meet (ops/byte)
    times = {n: ops / min(peak_ops, ops / b * bandwidth) for n, ops, b in work}
    bound = [n for n, ops, b in work if ops / b < ridge]
    total = sum(times.values())
    share = sum(times[n] for n in bound) / total * 100
    print(f"{label}\n  ridge {ridge:.0f} ops/byte, memory-bound layers: {', '.join(bound) or 'none'}")
    print(f"  bound on one image {total * 1e3:.2f} ms = {sum(o for _, o, _ in work) / total / peak_ops * 100:.0f} % of peak; memory-bound layers take {share:.0f} % of the time")
print("intensity (ops/byte):", {n: round(o / b) for n, o, b in work})
edge GPU module (vendor: 33 TOPS dense INT8, 102 GB/s)
  ridge 324 ops/byte, memory-bound layers: conv1, conv2, conv3, conv4, head
  bound on one image 0.14 ms = 64 % of peak; memory-bound layers take 59 % of the time
Cortex-A SBC (assumed: 0.2 TOPS, 12 GB/s)
  ridge 17 ops/byte, memory-bound layers: none
  bound on one image 14.62 ms = 100 % of peak; memory-bound layers take 0 % of the time
intensity (ops/byte): {'conv1': 31, 'conv2': 96, 'conv3': 286, 'conv4': 189, 'conv5': 551, 'conv6': 343, 'conv7': 847, 'conv8': 392, 'conv9': 594, 'head': 37}

On the GPU module the ridge is at 324 ops/byte. The first layers (conv1 to conv4) and the head have lower intensity, so they are memory-bound and take 59% of the time although they hold only part of the MACs. The deep layers have many weights but small images, so their intensity is high and they are compute-bound. As a result the model reaches only 64% of the 33 TOPS roof, and doubling the TOPS would not speed up the early layers; the bytes that move must be reduced instead (fusion and fewer bits: modules 2 and 3). For the assumed Cortex-A board the ridge is 17 ops/byte and every layer is compute-bound. The 14.62 ms is a lower bound only and must never be quoted as the real time. The real time is always longer because of work outside the model, such as unsupported operators, accelerator start-up, image reading and post-processing. Always measure on the real board.

Log-scale roofline graph. The horizontal axis is arithmetic intensity from 10 to 1000 ops per byte and the vertical axis is performance from 1 to 100 TOPS. The sloped roof rises from 1 TOPS at 10 to the ridge at 324, then is flat at 33 TOPS. Pink points for conv1, conv2, conv3, conv4 and head lie on the sloped roof; green points for conv5 to conv9 lie on the flat roof
Figure 3 Roofline of the GPU module (33 TOPS, 102 GB/s) and the position of each WasteNet-S layer

Choosing a platform from the constraints

The selection order used in this course drops options with the easiest test first.

  1. Does the memory suffice? Weights in flash or RAM, and activations in SRAM or RAM (Example 2).
  2. Is the lower bound on time fast enough? Use the roofline (Example 3) against requirement R2.
  3. Does the target support the model’s operators, and at what numeric precision (modules 2 and 3)?
  4. Are power, heat and mass within budget? They change the flight time (module 5).
  5. Cost, availability and upkeep over the service life, including how software is updated (module 5).

For our case the MCU fails at step 1. The rest are the SBC with CPU only, the SBC with an NPU accelerator and the GPU module, which modules 2 to 5 decide with real measurement and calculation.

Module lab

Lab: mission requirements and choosing the shortlist

  1. Specification table: read the manufacturers’ pages of at least three boards the department has. Record the figures with URL and date checked, and note whether TOPS are dense or sparse and at which numeric precision.
  2. Measure the working machine: write a NumPy script that measures memory bandwidth (copy an array several times larger than the cache) and compute rate (multiply large matrices), then compute that machine’s ridge. The result depends on the machine, so there is no fixed answer; report the measurement conditions.
  3. The group’s mission requirements: compute the minimum frame rate with Example 1 using the group’s own GSD, speed and overlap, then write measurable requirements (frame rate, latency, flight time, temperature, privacy).
  4. Cost of the model: edit the layer table in Example 2 to the model the group chose. Count MACs, parameters and peak activation memory at int8 and float32.
  5. Roofline of the board: compute each layer’s arithmetic intensity (Example 3) with the figures of the department’s board and name the memory-bound layers.
  6. One-page platform note: the options, the criteria, the numeric evidence for each, and what is still unknown and must be measured in the next module.

The work of this module is desk work, with no flying.

Common mistakes

Watch out

  • Choosing a board by one TOPS figure without checking sparse or dense, numeric precision and bandwidth
  • Setting a 30 fps requirement because the camera can, when the mission needs far less, ending with a board that is more expensive and heavier than needed
  • Counting only the model’s weights and forgetting the activations an MCU must hold at the same time
  • Sending all images to the cloud without checking link capacity, coverage gaps and privacy
  • Treating the roofline value as real time, when it is a lower bound that excludes unsupported operators and surrounding work
  • Comparing boards with figures for different models or different numeric precisions

Summary

  • The mission sets a minimum frame rate ; the camera’s maximum frame rate is not the requirement
  • Choose where to compute from latency, bandwidth, link availability, mass and power, and privacy; on-board detection sends hundreds of times less data than video
  • Count the model’s MACs, parameters and activations first; an MCU usually dies at the activations of the first layers
  • The roofline gives a lower bound on time, ; low-intensity layers are memory-bound, so reduce bytes, do not add TOPS
  • TOPS figures need their conditions (sparse or dense, numeric precision) and are not the speed of the system

Check your understanding

  1. GSD 2 cm, 1,080 image rows along the flight direction, 70% overlap, 10 m/s. What frame rate is needed at least?
  2. A 3 × 3 convolution takes 48 channels and gives 96 channels with an 80 × 80 output. How many MACs and parameters?
  3. A device has 8 TOPS peak and 25 GB/s bandwidth. A layer has 2.0 × 10⁸ operations and moves 1.0 MB. What are the ridge, the attainable performance and the minimum time?
  4. The first layer takes 3 channels and gives 16 channels with stride 2 (int8). Input and output together must not exceed 364 kB. What is the largest square input that is a multiple of 32?
  5. Why can the TOPS figure on a datasheet not tell us the processing time of our model?
Answers
  1. m; the spacing is m, so fps is needed
  2. MACs (about 265.4 M); parameters
  3. Ridge ops/byte. The layer’s intensity is , below the ridge, so it is memory-bound. Performance TOPS; minimum time µs
  4. Input , output , together gives ; the largest multiple of 32 is 224
  5. Because the figure depends on conditions (sparse or dense, numeric precision), memory-bound layers cannot use the compute roof, unsupported operators fall back to the CPU, and the figure excludes image reading, resizing and post-processing

Key formulas

MACs of a convolution layer
Minimum frame rate of a mission
Roofline upper bound

Key references

  1. Williams, S., Waterman, A., & Patterson, D. (2009). Roofline: An insightful visual performance model for multicore architectures. Communications of the ACM, 52(4), 65–76. link
  2. Sze, V., Chen, Y.-H., Yang, T.-J., & Emer, J. S. (2017). Efficient processing of deep neural networks: A tutorial and survey. Proceedings of the IEEE, 105(12), 2295–2329 (arXiv:1703.09039). link
  3. Iorga, M., Feldman, L., Barton, R., Martin, M. J., Goren, N., & Mahmoudi, C. (2018). Fog computing conceptual model (NIST SP 500-325). National Institute of Standards and Technology. link
  4. พระราชบัญญัติคุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562. ราชกิจจานุเบกษา, 136(69 ก), 52–95. link
  5. NVIDIA. (2024). NVIDIA Jetson Orin Nano developer kit gets a "super" boost. NVIDIA Technical Blog. link
  6. Raspberry Pi Ltd. AI HATs (AI HAT+ and AI HAT+ 2). Raspberry Pi documentation. link
  7. Rockchip Electronics. RK3588. Rockchip products. link
  8. Coral. USB Accelerator. Coral products. link
  9. Coral. TensorFlow models on the Edge TPU (model requirements and compilation). Coral documentation. link
  10. Raspberry Pi Ltd. Raspberry Pi Pico 2. link
  11. Raspberry Pi Ltd. Raspberry Pi 5 product specifications. link
  12. Google. LiteRT for Microcontrollers (TensorFlow Lite for Microcontrollers). link
  13. Mishra, A., Latorre, J. A., Pool, J., Stosic, D., Stosic, D., Venkatesh, G., Yu, C., & Micikevicius, P. (2021). Accelerating sparse deep neural networks. arXiv:2104.08378. link
  14. Baker McKenzie. (2026, July 30). Thailand: New draft amendment to the PDPA [Insight]. link

Further reading

Study the assigned knowledge units in advance, review media and take the module quiz

In class / field

Lab or field practice from worksheets with a safety checklist

Learning evidence: Checked worksheets and quiz results

Module quiz

This is a formative self-check, not a graded exam

Knowledge domain: Artificial intelligence and computer vision · Sensors and embedded systems · Automation, robotics and swarms