Teaching pack · UAT 462
A 15-week teaching plan, 5 worksheets, a scoring rubric and a map from the course description to the lessons, for instructors to evaluate and adapt before teaching.
Coverage of the course description
The lessons fully teach 13 of 13 description topics. Each topic lists the modules and lesson sections that teach it, and incomplete topics say what is missing.
| Description topic | Modules | Where it is taught | Status |
|---|---|---|---|
| Edge AI processing for unmanned aircraft systems | M1M4M5 | Module 1: Where to compute (on the aircraft, ground station or cloud; Example 1, the frame rate the mission needs and the data to send) · Module 4: Latency and throughput · Module 5: Fallbacks and safety (the on-board computer is an auxiliary system) | Covered |
| Embedded computers and AI processing units | M1 | Module 1: Platform families (MCU, Cortex-A, GPU modules, NPU and TPU accelerators) · Count the model's cost before buying the board (MACs, parameters, intermediate activations) · The roofline model: what limits the time · Choosing a platform from the constraints | Covered |
| Integration with cameras and sensors | M4 | Module 4: From the camera into memory (MIPI CSI-2, USB, bandwidth and zero-copy) · Sensor interfacing: the time budget of a bus (I2C, SPI, UART) · Time and data synchronisation (time stamps, TIMESYNC and the effect on image position) | Covered |
| Preparation and deployment of AI models | M2M5 | Module 2: From the training machine to the board · ONNX: graph, operators and opset · Unsupported operators and graph partitioning · Module 5: A verifiable release · A/B update and rollback · Monitoring and staged roll-out | Covered |
| Real-time image and data processing | M4 | Module 4: Latency and throughput (Little's law) · Queues, tail latency and dropping frames · Batching | Covered |
| Model optimization for resource-constrained platforms | M2M3 | Module 2: FP16 numeric precision · Stacked acceleration, and measure before tuning · Module 3: Affine quantisation · Quantisation error and SQNR · Per-tensor or per-channel scales · Calibrating activations to the operating conditions · Pure integer arithmetic · Quantisation-aware training · Other ways to shrink: efficient architectures, pruning and distillation | Covered |
| Power and thermal management | M5 | Module 5: Energy of the on-board computer (energy per inference, energy per real frame and the effect of mass on flight time) · Power modes and clock frequency · Heat and throttling | Covered |
| Latency and performance management | M1M4M5 | Module 1: The roofline model: what limits the time · Module 4: Latency and throughput · Queues, tail latency and dropping frames (p50, p95, p99) · Module 5: Monitoring and staged roll-out · Fallbacks and safety (the fallback ladder) | Covered |
| System testing | M5 | Module 5: System testing: test levels and how many samples are enough (five levels, the test card, Example 8 with the number of piles and flights needed) · Module lab and mini-project (the acceptance report) | Covered |
| Edge AI applications to detection | M1M4M5 | The illegal-dumping detection case study across all five modules (training and accuracy of the detector are covered in UAT 306 and UAT 456) · Module 4: From detections to perception, navigation and autonomous missions (Example 8, confirming a pile and the false alarm rate) · Module 5: Monitoring and staged roll-out (Example 6) | Covered |
| Edge AI applications to perception | M4 | Module 4: From detections to perception, navigation and autonomous missions (the pinhole camera model, the ground position of a pile and its error budget, Example 7); the scope is locating detections, not image segmentation or depth estimation | Covered |
| Edge AI applications to navigation | M4 | Module 4: From detections to perception, navigation and autonomous missions (stopping distance versus latency and frame rate, the first half of Example 8, and the idea of PX4 collision prevention) · Visual odometry and SLAM on the edge (what VO, VIO and SLAM compute; front-end, back-end and loop closure; why they run on board; PX4 ODOMETRY and EKF2_EV_DELAY; VIO benchmarks on embedded boards; Example 9, the compute and latency budget and drift per distance) | Covered |
| Edge AI applications to autonomous missions | M4M5 | Module 4: From detections to perception, navigation and autonomous missions (detect, confirm, pause, report and resume; the second half of Example 8) · Module 5: Fallbacks and safety (MAVLink heartbeat, offboard mode and PX4 failsafes) | Covered |
Weekly teaching plan
| Week | Topic | Pre-class | Lecture | Lab | Evidence |
|---|---|---|---|---|---|
| 1 M1 | Mission, requirements and where to compute | Read module 1 'Why this matters' and 'Where to compute'; run Example 1 | Requirements R1 to R6 of the case study; edge, fog and cloud; privacy and the Personal Data Protection Act; the minimum frame rate from mission geometry | Worksheet 1 part A: read the manufacturers' pages of at least three boards the department has and make a specification table with URL and date checked, noting dense or sparse | Specification table with sources |
| 2 M1 | Platform families and the model's cost | Read 'Platform families' and 'Count the model's cost before buying the board'; run Example 2 | MCU, Cortex-A, GPU modules, NPU and TPU; cautions about TOPS; counting MACs, parameters and activations | Worksheet 1 part B: edit the layer table to the group's model; count MACs, parameters and peak activations at int8 and float32; check whether it fits the board's memory | Model-cost table and memory-fit result |
| 3 M1 | Roofline and choosing a platform | Read 'The roofline model' and 'Choosing a platform from the constraints'; run Example 3; take the module 1 quiz | Arithmetic intensity, the ridge, memory-bound layers, and the five-step selection order | Worksheet 1 part C: measure the working machine's bandwidth and compute rate with NumPy; compute the roofline of the available boards; write a one-page platform note | Platform note and module 1 quiz result |
| 4 M2 | The conversion pipeline and ONNX | Read 'From the training machine to the board' and 'ONNX: graph, operators and opset'; run Example 1 | Pipeline steps; ONNX Runtime, TensorRT, OpenVINO and Edge TPU; opsets; fusing Conv, BatchNorm and ReLU | Worksheet 2 part A: export the model to ONNX with an opset that matches the runtime; run onnx.checker and compare with the original; report the maximum difference | A checked ONNX file and the output-difference table |
| 5 M2 | Unsupported operators and graph partitioning | Read 'Unsupported operators and graph partitioning'; run Example 2 | Multi-partition and prefix-only partitioning; boundary-crossing cost; Amdahl's bound; fixing unsupported operators | Worksheet 2 part B: run at different optimisation levels, turn on profiling, find the three most time-consuming nodes and compute Amdahl's bound | Per-node time table and Amdahl's bound |
| 6 M2 | FP16 and stacked acceleration | Read 'FP16 numeric precision' and 'Stacked acceleration, and measure before tuning'; run Examples 3 and 4; take the module 2 quiz | Range and resolution of FP16; accumulation; fusion; stacking acceleration in order of risk to accuracy | Worksheet 2 part C: if an accelerator is available, compile with the vendor's tool and read the log for operators that fall back to the CPU; time before and after fusion and the change to FP16 (20 warm-up runs, 200 measured, report p50 and p95) | Table of method, time, accuracy and CPU-fallback operators, and the module 2 quiz result |
| 7 M3 | Affine quantisation and SQNR | Read 'Affine quantisation' and 'Quantisation error and SQNR'; run Examples 1 and 2 | r = S(q − Z), a zero-point that represents 0.0 exactly, symmetric and asymmetric forms, and SQNR of about 6 dB per bit with the formula's conditions | Worksheet 3 part A: quantise the group's model to static INT8 with ONNX Runtime using at least 100 calibration images covering dawn and evening; compare file size, time and AP with the original | Table of size, time and accuracy before and after quantisation |
| 8 M3 | Per-channel scales, calibration and integer-only arithmetic | Read 'Per-tensor or per-channel scales', 'Calibrating activations' and 'Pure integer arithmetic'; run Examples 3 to 5 | Weights after folding BatchNorm; clipping methods MinMax, Entropy and Percentile; representative calibration sets; the multiplier M = M0 · 2^−n | Worksheet 3 part B: change the range method, calibrate on one condition and test on another, compare per-channel with per-tensor, and compute M and M0 for one layer | Table of the effect of calibration set and range method, and the M and M0 results |
| 9 M3 | QAT, other compression methods; midterm | Read 'Quantisation-aware training' and 'Other ways to shrink'; run Examples 6 to 8; review modules 1 to 3; take the module 3 quiz | Midterm examination (modules 1 to 3) | Worksheet 3 part C: if accuracy after PTQ is below the criterion, enlarge the calibration set, skip sensitive layers, then try QAT, pruning or distillation; record every step | Worksheet 3 report, module 3 quiz result and midterm score |
| 10 M4 | From the camera into memory; latency and throughput | Read 'From the camera into memory' and 'Latency and throughput'; run Examples 1 and 2 | CSI-2 and USB; raw bandwidth; memory traffic per frame; DMABUF and zero-copy; latency and throughput of a pipeline; Little's law | Worksheet 4 part A: compute the group camera's bandwidth, capture continuously for 5 minutes and count dropped frames, then build a pipeline that time-stamps every stage | Table of bandwidth, dropped frames and per-stage times of the pipeline |
| 11 M4 | Queues, tail latency and batching | Read 'Queues, tail latency and dropping frames' and 'Batching'; run Examples 3 and 4 | Load above 1; unbounded against bounded queues that drop old frames; p50, p95, p99 and jitter; MLPerf-style reporting; batch sizes that suit the job | Worksheet 4 part B: compare an unbounded FIFO with a one-slot queue that drops the old frame on the group's pipeline; record p50, p95, p99 and dropped frames; compare zero-copy with copying if the tools support it | Table of latency percentiles and dropped frames for each policy |
| 12 M4 | Sensors, bus time budgets and time | Read 'Sensor interfacing' and 'Time and data synchronisation'; run Examples 5 and 6; take the module 4 quiz | Transaction time of I2C, SPI and UART; share of bus used; V4L2 time stamps; clock offset with TIMESYNC; Δx = vΔt | Worksheet 4 part C: compute the bus time budget of the group's sensors and measure real read times; estimate the clock offset with TIMESYNC, comparing one exchange with short-RTT exchanges; compute the position error | Worksheet 4 report and module 4 quiz result |
| 13 M5 | Energy per frame and power modes | Read 'Energy of the on-board computer' and 'Power modes and clock frequency'; run Examples 1 and 2 | Energy per inference against energy per real frame; the effect of mass on flight power; the clock with the least energy per image; the evidence-mode deadline | Worksheet 5 part A: measure the board's power while idle and while running the model; compute energy per inference and per real frame, and the effect on the department aircraft's flight time | Table of power, energy per frame and remaining flight time |
| 14 M5 | Heat, release and update | Read 'Heat and throttling', 'A verifiable release' and 'A/B update and rollback'; run Examples 3 to 5 | First-order thermal model, R and tau, throttling; manifests, hashes, signatures and rollback of an A/B update | Worksheet 5 part B: log SoC temperature under full load for 10 minutes in a closed enclosure and in airflow; fit R and tau; write and sign a manifest; test the installer with a one-bit-flipped file; simulate two failing updates | Temperature plot with R and tau, a signed manifest, and the update simulation results |
| 15 M5 | Monitoring, fallbacks and mini-project presentations | Read 'Monitoring and staged roll-out' and 'Fallbacks and safety'; run Examples 6 and 7; take the module 5 quiz; prepare the acceptance report and deployment plan of at most 4 pages | Course wrap-up and project criteria (KS test, staged roll-out, fallback ladder and hysteresis) | Worksheet 5 part C: design a fallback ladder with hysteresis and test it with the real temperature log; then present the acceptance report and deployment plan to the municipality (role-play) and revise the plan from feedback | Mini-project report and presentation, scored with the rubric, and the module 5 quiz result |
Worksheets and instructor guide
One worksheet per module. Students open it on the web, print it or download the .docx. The instructor guide under each worksheet gives the class timing, expected results, discussion questions and notes for students with different backgrounds.
1Worksheet 1 Mission requirements and platform shortlist
Analysis activity · About 12 h of class time · CLO1
Objective: Set measurable mission requirements, compute the minimum frame rate, count the model's cost, use the roofline and shortlist platforms with figures checked at the manufacturers and by measurement
Equipment
- Manufacturers' specification pages for at least three boards the department has
- A computer with Python and NumPy and the example code at /downloads/uat-462/
- The layer table of the model the group chose
Safety
- Desk work, no flying
- Record figures from the manufacturer's page with URL and date checked; do not use figures from sources that cannot be checked
- Use only image data that is permitted and shows no identifiable person
Steps
- Read the manufacturers' pages and make a specification table, noting dense or sparse and the numeric precision of the TOPS
- Compute the mission's minimum frame rate with Example 1 from the group's GSD, speed and overlap, then write measurable requirements
- Edit the layer table in Example 2 to the group's model and count MACs, parameters and peak activations at int8 and float32
- Check whether it fits each board's memory and find the largest input that fits
- Write a NumPy script that measures the working machine's memory bandwidth and compute rate, then compute its ridge
- Compute the roofline of each board (Example 3), name the memory-bound layers, then write a one-page platform note
Deliverables
- Specification table with sources and dates checked
- Measurable mission requirements with the minimum frame rate
- Model-cost table and memory-fit result
- A one-page platform note with what still has to be measured
Checklist
- Table 1 has at least three boards, and every row has a URL, date checked, dense or sparse and the numeric precision
- Table 2 shows the minimum frame rate, MACs, parameters and peak activation at both int8 and float32, every value with a unit, and the runnable script is attached
- Table 2 states the conditions of the machine measurement (CPU model, array size, number of repeats) and does not use manufacturer figures in place of measurements
- The platform note drops options in the order of the criteria (memory, time, operators, power, cost) and lists what still has to be measured
Instructor guide
Class timing
- Brief the case study and requirements R1 to R6; review the frame-rate, MAC and roofline formulas60 min
- Read the manufacturers' pages and fill in Table 1120 min
- Compute the minimum frame rate, write measurable requirements and count the model's cost180 min
- Write the NumPy script that measures the machine's bandwidth and compute rate120 min
- Compute the layer-by-layer roofline and fill in Table 3150 min
- Write the platform note, answer the questions and run the hand-in checklist90 min
Expected results
- Table 1 (figures depend on the department's boards and must match the manufacturers' pages). Examples the lesson checked: Jetson Orin Nano Super INT8 67 TOPS sparse and 33 TOPS dense, 8 GB at 102 GB/s, 7, 15 and 25 W modes; Raspberry Pi Pico 2, 520 KB SRAM and 4 MB flash; Hailo-8L 13 TOPS and Hailo-8 26 TOPS INT8; Coral Edge TPU 4 TOPS int8; RK3588 NPU 6 TOPS. A strong table separates sparse from dense (sparse is twice as high and applies only when weights are pruned to the 2:4 pattern).
- Table 2 with the lesson's example values (GSD 3 cm, 1,080 rows, 60% overlap, 8 m/s, WasteNet-S at input 640): footprint along track 32.4 m, spacing 12.96 m (1.62 s), minimum 0.62 fps, designed at 1 fps; 1.462 GMAC per image, 1.182 M parameters (int8 1.18 MB, float32 4.73 MB), peak activation int8 2,867 kB and float32 11,469 kB; the largest input within 70% of the 520 KB SRAM (364 kB) is 224 (351 kB). The machine measurement depends on the machine and has no fixed answer; check that the ridge is compute rate divided by bandwidth, in ops/byte. Accept rounding differences in the last digit.
- Table 3 with the GPU module's manufacturer figures (33 TOPS dense, 102 GB/s): ridge 324 ops/byte; intensity conv1 31, conv2 96, conv3 286, conv4 189, conv5 551, conv6 343, conv7 847, conv8 392, conv9 594, head 37. The memory-bound layers are conv1 to conv4 and head, taking 59% of the time; the lower bound is 0.14 ms per image (64% of peak). For the assumed Cortex-A board (0.2 TOPS, 12 GB/s) the ridge is 17 ops/byte, no layer is memory-bound and the lower bound is 14.62 ms.
- With the example values 30 fps is about 48.6 times the 0.62 fps needed (and 30 times the 1 fps design). Following the camera would need a stronger, heavier, hotter and more power-hungry board and would cut flight time. A strong answer says the requirement comes from the mission geometry, not the camera's ability, and keeps the 10 fps evidence mode as a separate requirement.
- Because the first layer must hold its input and output together, 2,867 kB at int8, more than five times the 520 KB SRAM. Shrinking the input to 224 brings it to 351 kB, but a 1.5 m pile is then only 5.8 pixels wide, too small for the detector to see well, and 0.179 GMAC is still slow on a 150 MHz MCU. A strong answer suggests the MCU may suit a much smaller helper task.
- With the example values conv1 to conv4 and head are memory-bound (intensity below the 324 ridge). Their time is bytes divided by bandwidth, so doubling TOPS does not speed them up; the bytes moved must be reduced instead, for example by fusion and fewer bits (modules 2 and 3). A strong answer notes that more TOPS moves the ridge to the right, so even more layers become memory-bound.
- No. The roofline value is a lower bound that excludes unsupported operators falling back to the CPU, accelerator start-up, image reading, resizing and post-processing, so the real time is always longer. To measure next: time on the real board after warm-up (p50, p95), unsupported operators, and accuracy after reducing numeric precision.
Discussion questions
- If a vendor says their board has the highest TOPS, what three questions should we ask before believing it?
- Why does processing on the aircraft help privacy requirement R6 more than sending all the video down?
- If the mission changed to avoiding obstacles, would the frame-rate requirement still come only from image geometry?
Adapting to student background
- Upper secondary (M.6)
- Have them derive the convolution MAC formula by hand-counting a tiny layer before running the code, and pair them with a tool-confident peer for reading datasheets and setting up Python.
- Vocational certificate
- Give a fill-in table for the minimum frame rate step by step (footprint, spacing, then divide the speed), and let them edit only the numbers in the example's layer table rather than write new code.
- Diploma
- Extension: time the sample model on one real board and compare with the roofline lower bound; report how many times slower it is and which work likely makes up the difference.
2Worksheet 2 Convert, check and accelerate a model on the board
Lab · About 12 h of class time · CLO2, CLO3
Objective: Export a model to ONNX, check that the output matches the original, see the effects of fusion and partitioning, time before and after acceleration on the real board, and summarise the operators that fall back to the CPU
Equipment
- At least one target board the department has (SBC, GPU module or accelerator)
- The sample model the instructor sets, or the group's model
- Python with onnx and onnxruntime, and the vendor's compile tool if available
Safety
- A board under full load is hot; do not touch the heat sink while it runs
- Take anti-static precautions when handling boards, and power off before connecting cables or accessories
- Desk work, no flying
Steps
- Export the model to ONNX with an opset matching the board's runtime, run onnx.checker and compare with the original
- Run ONNX Runtime at different optimisation levels, save the optimised files and compare the node lists with Example 1
- Turn on profiling, sum time by operator name, find the three most time-consuming nodes and compute Amdahl's bound
- If an accelerator is available, compile with the vendor's tool, read the log for operators that fall back to the CPU and make a table with a fix plan following Example 2
- Time before and after fusion and the change to FP16 (20 warm-up runs, 200 measured, report p50 and p95)
- Summarise as a table: method, time, accuracy and CPU-fallback operators
Deliverables
- A checked ONNX file and the output-difference table
- Per-node time table and Amdahl's bound
- Table of unsupported operators with a fix plan
- Table of time before and after acceleration with the measurement conditions
Checklist
- Table 1 states the opset, the onnx.checker result and the maximum difference from the original on the same input, with the node list at each optimisation level
- Every row of Table 3 was measured after 20 warm-up runs over 200 measured runs, and states the board, runtime, image size and power mode
- Every acceleration method in Table 3 has a validation accuracy, not only a time
- There is a table of CPU-fallback operators with a fix plan for each (or a note that no accelerator was available)
Instructor guide
Class timing
- Safety briefing (heat, static, power off before connecting) and review of the pipeline from training machine to board45 min
- Export to ONNX, check it and compare with the original120 min
- Run the optimisation levels and profiling; fill in Table 2150 min
- Compile for the accelerator, read the log and build the unsupported-operator table150 min
- Time before and after fusion and FP16; fill in Table 3165 min
- Wrap-up, questions and hand-in checklist90 min
Expected results
- Table 1: an opset matching the board's runtime, onnx.checker passes, and the maximum float32 output difference about 1e-5 or less (Example 1 passes at 1e-5 at every level). The basic level folds BatchNorm into Conv, leaving Conv and Relu; the extended level leaves one node, com.microsoft.FusedConv, which is not a standard operator. The example's memory traffic falls from 320 to 192 and 64 KiB.
- Table 2: values depend on the model and machine. For a convolutional model the top three are usually Conv or FusedConv. The shares should add up to close to 100%, and the times come from the dur field (microseconds) of the profiling file, summed by operator name.
- Table 3: values depend on the board; use the proportions of Example 4 as a reference (assumed device): fp32 with BN and ReLU separate 4.29 ms, fp32 fused 3.03 ms (1.4 times), fp16 0.83 ms (5.2 times), int8 0.42 ms (10.3 times). If real results stray far from these proportions, look for CPU-fallback operators. The partition plans of Example 2: all on CPU 140.5 ms, prefix only 22.4 ms (6.3 times), multi-partition 17.9 ms (7.8 times), resize rewritten 12.8 ms (11.0 times).
- It depends on the three nodes' share p, with S = 1/((1-p)+p/4): for example p = 50% gives 1.60 times, 70% gives 2.11 times and 90% gives 3.08 times; if infinitely fast the limit is 1/(1-p), that is 2.0, 3.3 and 10.0 times. A strong answer concludes that you profile first and that the part not accelerated is the limit.
- Unsupported operators force data across the CPU/accelerator boundary, and everything after them may stay on the CPU if the compiler partitions only once (Edge TPU style). In Example 2 the prefix-only plan gives only 6.3 times although the accelerated part is 25.7 times faster than the CPU, because the CPU still runs 14.5 ms (Amdahl caps it at 7.2 times). The best fix in the example is rewriting the resize to a supported mode (11.0 times), then re-checking accuracy. Other options: move it into post-processing, accept it if its time share is small, change the model, or change the target.
- An optimised file saved offline is usable only on hardware compatible with the machine it was saved on, and the extended level may contain vendor-extension operators (such as com.microsoft.FusedConv) that other runtimes do not know. So deliver the original and let each target optimise it.
- A large accuracy drop usually comes from accumulating in FP16 or from values out of range. Example 3: FP16 storage with FP32 accumulation is off by 0.0010 from the exact -30.9021, while FP16 accumulation is off by 0.7927; the sum of squares of 4,096 values of 12 should be 589,824 but overflows to inf because the FP16 maximum is 65,504, and 1e-8 becomes 0. Check the precision the runtime accumulates at and whether BatchNorm has been folded.
- The first run includes loading and memory allocation, so it is slower than normal; warm-up removes this. p95 shows the occasional slow frames the mean hides, and requirement R2 is set at p95 of at most 100 ms. A strong answer states the measurement conditions every time.
Discussion questions
- Is a conversion that passes with no error enough evidence that the model is ready on the board? What more evidence is needed?
- Between multi-partitioning and rewriting the operator, which is riskier for accuracy, and how would you prove it?
- If two boards are equally fast but one falls back to the CPU on several operators, which is easier to maintain in the long run?
Adapting to student background
- Upper secondary (M.6)
- Have them fold BatchNorm into Conv by hand for one channel (practice question 2) and compute Amdahl's bound before touching the board, predicting results before measuring, with a hands-on peer helping connect the board.
- Vocational certificate
- Provide a ready timing script (warm-up, measure, print p50 and p95) so they focus on connecting the board, running commands and reading the log for CPU entries; explain Amdahl with the group's own times rather than the formula.
- Diploma
- Extension: actually fix one unsupported operator (for example change the resize mode or move nms into post-processing), recompile, and measure time and accuracy against the version before the fix.
3Worksheet 3 Quantise the model and measure the effect on accuracy
Lab · About 12 h of class time · CLO2
Objective: Quantise the group's model to INT8 with a representative calibration set, compare range methods and per-channel with per-tensor scales, and decide whether QAT or another compression method is needed
Equipment
- The group's ONNX model
- A calibration set of at least 100 images covering dawn and evening, and a labelled validation set
- Python with onnxruntime, the example code at /downloads/uat-462/, and a target board for timing
Safety
- Desk work, no flying
- Use permitted images with no identifiable person, and store the data set according to personal-data guidance
- A board under full load is hot; do not touch the heat sink
Steps
- Quantise the model to static INT8 with at least 100 calibration images, then compare size, time and AP with the original
- Change the range method (MinMax, Entropy, Percentile) and compare accuracy
- Calibrate on one condition and test on another; report the accuracy lost
- Compare per-channel with per-tensor scales if the tool supports it
- Use Example 5 to compute M and M0 for one layer and check that the fixed-point multiply matches the floating one
- If accuracy is below the criterion, reduce what can be reduced first, then try QAT, pruning or distillation; record every step
Deliverables
- Table of size, time and accuracy before and after quantisation
- Table of the effect of range method and calibration set
- M and M0 results with the fixed-point check
- A conclusion on whether QAT or another method is needed, with reasons
Checklist
- Table 1 has every column for both the original and INT8 models, timed after warm-up on the same board, with the board named
- Table 2 has at least three range methods and one cross-condition test, and every row reports AP, not only SQNR or file size
- The calibration set has at least 100 images covering dawn and evening, with no identifiable person
- Box 3 shows S_x, S_w, S_y, M, n, M0 and the int32 value of M0, with the difference between the fixed-point and floating multiplies
Instructor guide
Class timing
- Briefing on image-data privacy and board heat; review r = S(q - Z) and SQNR45 min
- Prepare the calibration and validation sets, quantise statically and fill in Table 1165 min
- Change the range method and test across conditions; fill in Table 2180 min
- Compare per-channel with per-tensor scales and compute M and M0150 min
- Try the reductions or QAT if accuracy is still below the criterion120 min
- Wrap-up, questions and hand-in checklist60 min
Expected results
- Table 1: the INT8 file is about a quarter of FP32, for example WasteNet-S with 1.182 M parameters goes from 4.73 MB to 1.18 MB (real files differ slightly because of the graph, scales and zero-points). Time drops depending on the board. AP after 8-bit PTQ should be close to FP32 (Nagel et al. conclude 8-bit PTQ is mostly enough); if it falls below the group's criterion, check the calibration set first.
- Table 2: values depend on the group's data; use Example 4 as a guide (simulated data, measured as SQNR): calibrated on dawn with min-max, clip 14.31, 35.7 dB on dawn but 27.1 dB on noon; calibrated on noon, clip 27.62, 34.3 dB on noon but 30.2 dB on dawn; percentile 99.9 clips at 3.35 and falls to 21.7 and 15.3 dB because it cuts glare that is signal. Per-channel scales in Example 3 cut the mean weight error from 18.53% to 0.68%. The group must report AP.
- Box 3 with the layer of Example 5: M = 0.002620 = 0.670753 x 2^-8, so n = 8 and M0 as int32 = 1,440,430,618; the fixed-point multiply differs from the floating one by 0 codes; the maximum error against the floating layer is 0.0386 (1.12 steps of S_y). Check the method with practice question 5: S_x = 0.02, S_w = 0.004, S_y = 0.1 gives M = 0.0008, n = 10, M0 = 0.8192 (int32 about 1,759,218,604).
- If it is not exactly a quarter, the file holds parts that are not weights (the graph, scales, zero-points, int32 biases) or some layers stay in floating point. Time falls because four times fewer bytes move, so the memory-bound layers of module 1 (conv1 to conv4 and head in the example) should gain most. A strong answer links this to the roofline.
- AP drops because the other condition's real values exceed the clip set by the calibration set and are cut off, or in the other direction the step is coarser than needed. A good calibration set includes every operating condition (dawn, daytime, evening, season), and is judged by the real task metric, AP, not SQNR alone.
- Percentile assumes rare high values are noise. If they are real signal (like the glare off plastic bags in Example 4), clipping them ruins the result. Decide by looking at the images that cause the high values and comparing the AP of the two methods; no single rule is always right.
- After folding BatchNorm each channel is multiplied by its own factor, so channel widths differ a lot, and a single tensor scale is set by the widest channel. From practice question 4, with a tensor maximum of 0.5 the step is 0.003937, so a channel with maximum 0.04 uses only about 21 levels (-10 to +10), while per-channel it uses about 255 levels, at the cost of one extra scale per channel.
- Always start with PTQ. If AP after PTQ is still below the criterion, first reduce what can be reduced (enlarge the calibration set, skip quantisation-sensitive layers), then use QAT, which needs extra training and labelled data. In Example 6 QAT helps clearly at 2 bits (92.8% to 97.2%) but is equal at 8 bits (98.0%). A strong answer cites the group's own numbers.
Discussion questions
- If a customer asks for the smallest possible model, how would you choose between 4 bits, pruning and distillation, and what must you know about the hardware first?
- Why does unstructured pruning not speed things up on a dense kernel?
- How should calibration images be collected so that they represent real conditions while still protecting privacy?
Adapting to student background
- Upper secondary (M.6)
- Have them compute scale and zero-point by hand (practice question 1) and find n and M0 by repeated doubling before running the code, linking it to binary numbers from school, paired with a tool-confident peer for board timing.
- Vocational certificate
- Provide a quantisation script where the range method is one variable, so they focus on preparing the image sets, running each row and filling in the table; explain scale with the lesson's code-strip figure rather than the formula.
- Diploma
- Extension: skip quantising the first layer or the head (keep it in floating point), then measure both AP and board time to find which layer is most sensitive to quantisation.
4Worksheet 4 A real-time pipeline and sensors
Lab · About 12 h of class time · CLO3, CLO1
Objective: Measure the camera bandwidth, build a capture-to-result pipeline that time-stamps every stage, compare queue policies, compute the bus time budget of the sensors and estimate the clock offset to the flight controller
Equipment
- A USB or CSI camera and a target board
- Sensors on at least two of the I2C, SPI or UART buses, and a logic analyser if available
- A flight controller with propellers removed, or a simulator, and Python with the example code at /downloads/uat-462/
Safety
- Test on the bench only; remove the propellers and make connections with no battery power
- Take anti-static precautions when handling boards and camera cables; never plug or unplug a CSI camera cable while the board is powered
- Do not record identifiable people
Steps
- Fix the camera mode, compute the bandwidth B = W H b f, then capture continuously for 5 minutes and count dropped frames
- Build a pipeline of capture, pre-process, inference and post-process with a time stamp at every stage
- Compare an unbounded FIFO with a one-slot queue that drops the old frame; record p50, p95, p99 and dropped frames; start measuring after warm-up
- If the tools support it, compare copying with zero-copy at the camera's highest resolution
- Compute the bus time budget of the group's sensors following Example 5 and compare real read times with the calculation
- Estimate the clock offset to the flight controller with TIMESYNC, compare one exchange with short-RTT exchanges, and compute the position error
Deliverables
- Table of bandwidth and dropped frames
- Table of p50, p95 and p99 latency for each queue policy
- Table of the share of bus used, calculated and measured
- Clock-offset estimate and position error
Checklist
- Table 1 shows the calculation B = W H b f with units and a full 5-minute capture
- Table 2 was measured after warm-up and has p50, p95, p99 and dropped frames for at least two policies, stating the board, model, image size and power mode
- Table 3 pairs a calculated and a measured value for every sensor, and no bus exceeds 50% without a fix plan
- Connections were made with no battery power, propellers were removed, and the recorded video has no identifiable people
Instructor guide
Class timing
- Safety briefing (propellers off, no battery power, static, CSI cables) and review of latency and throughput45 min
- Compute the bandwidth and capture for 5 minutes; fill in Table 190 min
- Build the time-stamped pipeline and compare queue policies; fill in Table 2210 min
- Compute and measure the sensor bus budget150 min
- Estimate the clock offset with TIMESYNC and compute the position error150 min
- Wrap-up, questions and hand-in checklist75 min
Expected results
- Table 1: B = W x H x 1.5 x f for NV12, for example 1920 x 1080 at 30 fps gives 93.3 MB/s (0.75 Gbit/s), within the usable USB 5 Gbit/s capacity of about 438 MB/s (70% efficiency as in Example 1); 4K30 gives 373.2 MB/s and 2560 x 1440 gives 165.9 MB/s. In 5 minutes at 30 fps there should be 9,000 frames; dropped frames should be near 0, and above about 1% check the link and camera mode.
- Table 2: values depend on the board; use Example 3 as a guide (simulated, load 1.14): unbounded FIFO drops nothing but p50 is 6,762 ms and p95 12,992 ms; a queue of 2 dropping the newest drops 12.2% with p95 159.3 ms; a queue of 1 dropping the oldest drops 11.8% with p50 52.5 ms, p95 71.4 ms and p99 129.3 ms, which meets R2. If the group's load is below 1, all policies will be close and the answer should say so.
- Table 3 with the sensor set of Example 5: a 1 kHz IMU on I2C at 400 kHz takes 390.0 us per transaction, 39.00% of the bus, and on SPI at 8 MHz 17.0 us, 1.70%; barometer, magnetometer, laser altimeter and power monitor together 6.71%, or 45.70% with the IMU; GNSS at 120 bytes 10 Hz on 115200 uses 10.42%, raw data at 1,600 bytes 5 Hz uses 69.44% (over the limit) and 17.36% at 460800. Clock offset (Example 6): one exchange is off by 0.52 ms on average, the four shortest-RTT exchanges by 0.06 ms; 20 ppm drift moves it 6.0 ms in 5 minutes. Measured read times can be longer than calculated because of Linux software time.
- In the example 26.5 fps x 53.6 ms = 1.42 frames, matching the direct count of 1.42. The group's values should agree within about 5%; if not, check the time stamps. The value is the average number of frames in the system, used to size memory and the latency to allow for.
- When the load exceeds 1 (in the example 37.9 ms per frame divided by 33.3 ms gives 1.14), frames arrive faster than they can be processed, so an unbounded queue grows without stopping and the result is an image from seconds ago. Dropping frames in the detection pipeline loses no evidence if video is recorded on a separate path from the detection pipeline; a strong answer mentions this.
- Move high-rate sensors such as the 1 kHz IMU to SPI (39% down to 1.70%), and if GNSS raw data is on, raise the baud rate (115200 uses 69.44%, over the 50% limit; 460800 leaves 17.36%). Measured times are longer because the calculation is a lower bound that excludes software, driver time and jitter, which is why the flight controller with its RTOS looks after the real-time buses.
- dx = v dt: for example at 8 m/s a 1 ms error is 0.8 cm, less than the 3 cm GSD, but a stamp taken after a 50 ms software queue gives 40.0 cm, and EOF instead of SOE (10 ms exposure, 20 ms readout) is 30 ms, 24.0 cm, eight times the GSD. The group computes it at its own real speed.
- From Example 4 (batch time 9 + 2.5b ms): batch 1 worst case 11.5 ms, batch 2 47.3 ms passes, batch 4 119.0 ms exceeds 100 ms because the first frame waits for the others. So use batch 1 for the live camera, and batches for images that are ready together, such as the 12 crops of one frame (3.25 ms per image instead of 11.5 ms).
Discussion questions
- A system that is fast on average but sometimes very slow, or one slightly slower but steady: which suits obstacle avoidance better, and why?
- Dropping 12% of frames is acceptable for which jobs, and unacceptable for which?
- Why is choosing the short-RTT TIMESYNC exchanges better than averaging all of them when the outbound and return delays differ?
Adapting to student background
- Upper secondary (M.6)
- Have them explain Little's law and dx = v dt with a restaurant queue and a moving car, compute the bus budget on paper first, and get extra time wiring sensors and using the logic analyser with a peer.
- Vocational certificate
- Focus them on wiring, time stamping and reading the logic analyser; for the calculation use a fill-in table of clock periods per byte (I2C 9, SPI 8, UART 10 bits) multiplied by the rate.
- Diploma
- Extension: actually move the IMU or a high-rate sensor from I2C to SPI on the test board and measure the bus share before and after, or compare copying with zero-copy using GStreamer.
5Worksheet 5 Power, heat, release and the mini-project
Lab · About 12 h of class time · CLO3, CLO1
Objective: Measure the energy and heat of the on-board computer, compute the effect on flight time, make a signed release, test update and rollback, design a fallback ladder, and summarise it as an acceptance report and deployment plan
Equipment
- A power meter for the board and a tool to read SoC temperature (vcgencmd or tegrastats)
- A closed mock equipment enclosure and a fan or airflow source
- Python with scipy and cryptography, the example code at /downloads/uat-462/, and the department aircraft's data
Safety
- A board under full load is hot; do not touch the heat sink, and limit full-load ground tests to the time calculated
- Test installation and updates on the bench only; never on an aircraft with propellers fitted and the battery connected
- Any real flying follows CAAT conditions in visual line of sight with people kept clear; check lithium batteries and propellers before every flight
- Log only metrics; do not store images of people
Steps
- Measure the board's power while idle and while running the model; compute energy per inference and per real frame at the frame rates of both modes
- Compute the effect on the department aircraft's flight time including added mass, and compare with the 1.3-times criterion
- Log SoC temperature for 10 minutes under full load in the closed enclosure and in airflow, fit R and tau, and predict when throttling starts
- Write the release manifest, sign it and test the installer with a one-bit-flipped file
- Simulate two failing A/B updates (does not boot, and over the time budget) and design a fallback ladder with hysteresis
- Write an acceptance report and deployment plan of at most 4 pages checking each requirement, with a model card, then present it
Deliverables
- Table of power, energy per frame and remaining flight time
- Temperature plot with R and tau and the time throttling starts
- Signed manifest and the installer and update test results
- Acceptance report and deployment plan with a model card and a staged roll-out plan
Checklist
- Table 1 separates energy per inference, average power and energy per real frame, includes the mass power in the flight time, and gives every value a unit
- Table 2 comes from real 10-minute temperature logs in both the closed enclosure and airflow, stating room temperature, power mode and the temperature tool
- Table 3 has the one-bit-flipped file, both failing updates with rollback, and the fallback ladder with hysteresis
- The acceptance report checks each requirement with measured numbers, includes a model card, and logs only metrics with no images of people
- The final power mode or platform is chosen by energy per real frame and the time budget, not TOPS per watt
Instructor guide
Class timing
- Safety briefing (heat, no updates on an aircraft with propellers and battery, CAAT conditions if flying) and review of the energy and thermal formulas45 min
- Measure power, compute energy and flight time; fill in Table 1150 min
- Log temperature in the closed enclosure and airflow, fit R and tau; fill in Table 2150 min
- Make the signed release, test the installer, the A/B updates and the fallback ladder165 min
- Write the test cards and the acceptance report150 min
- Presentations, questions and hand-in checklist60 min
Expected results
- Table 1 with the values of Example 1 (5.2 kg aircraft, 6S 16 Ah battery, 80% usable = 284 Wh, 560 W cruise): baseline endurance 30.4 min, needed 27.1 min (1.3 x 20.8). SBC with NPU: 0.28 J per inference, 4.66 J per real frame at 1 fps, mass costs 26.0 W, 28.9 min of flight, 0.61 J per frame in evidence mode; GPU module 0.21 J, 5.13 J, 40.9 W, 28.1 min; CPU-only SBC 1.16 J, 3.73 J, 19.5 W, 29.2 min but cannot do 10 fps (at most 6.9 fps). Real values depend on the department's meter and aircraft.
- Table 2 with the values of Example 3 (9 W, 45 C air, C = 25 J/C, 80 C threshold): closed enclosure R = 7, tau 175 s, steady state 108 C, reaches 80 C in 142 s and then sustains only 5.0 W, about 33% of the full work; in airflow R = 3.5, tau 87.5 s, steady state 76.5 C, never reaches the threshold. The fit to the simulated log gives R = 6.97 and tau 174 s. For the group, accept the fitted R when the curve passes through the measured points and the log lasts several times tau.
- Table 3: intact files accepted; one bit flipped in the model rejected, naming the file whose hash does not match; manifest edited after signing rejected because the signature fails; the release that does not boot is tried 3 times then rolled back; the release with p95 134 ms over the 100 ms budget is rolled back; in both cases the old release still runs. The fallback ladder without hysteresis switched 246 times in 30 minutes and with 4 C hysteresis only 6 times (simulated, Example 7); the group's run should show a clear drop in switching.
- Not necessarily. At 1 fps the board is idle almost all the time, so idle energy dominates. In the example the GPU module has the lowest energy per inference, 0.21 J, but the highest energy per real frame, 5.13 J, and its 250 g needs 40.9 W more, about eight times the board's average electrical power. The right measure is energy per real frame at the job's frame rate, including the effect of mass.
- With the example values all three meet 27.1 min (28.1 to 29.2 min), and the mass power (19.5 to 40.9 W) exceeds the board's electrical power (3.7 to 5.1 W) for every candidate. The group uses its real mass with dP = P0[((m+dm)/m)^1.5 - 1] and its measured power.
- With the example values the closed enclosure reaches 80 C in 142 s, so a full-load ground test should not last longer. With the propellers still there is no airflow, so R is higher than in the air and the board runs hotter on the ground; concluding from the ground may wrongly suggest it overheats, or the reverse if tested in a room cooler than the 45 C bay.
- A release that boots but is too slow (Example v1.3, p95 134 ms because the accelerator was left off) would pass a boot-only check and make R2 fail, so the health check must include the time budget and the job's metrics. A strong answer cites the group's tests and notes the old release in the other slot was never touched.
- No failure in 20 flights only supports a per-flight failure rate below 0.139 at 95% confidence (rule of three 0.150). Showing below 5% needs 59 flights with no failure, and below 1% needs 299. Flights therefore cannot practically prove that rare failures are rare; they must be sought by fault injection on the bench and in SITL or HITL, with the computer designed as an auxiliary system, while flights confirm the whole chain works together.
Discussion questions
- If the municipality wanted detection at 10 fps all the time to be safe, how would you explain the cost in energy, heat and flight time?
- The record-only level of the fallback ladder must alert the operator. What would happen in real use if it stayed silent?
- Why does monitoring the confidence distribution protect privacy better than storing images, and what are its limits?
Adapting to student background
- Upper secondary (M.6)
- Have them derive P proportional to m^1.5 and the first-order thermal model from school physics, then predict the time to 80 C before measuring, paired with a hands-on peer for wiring the power meter.
- Vocational certificate
- Focus them on wiring the meter, reading temperature and testing the installer with prepared steps; use a fill-in table for the calculations (average power, energy per frame, mass power) and the supplied fitting code, changing only the log file name.
- Diploma
- Extension: test three real power modes of the board, measure time per image and power, find the mode with the lowest energy per image that still meets a 45 ms budget, and compare with the pattern of Example 2.
Scoring rubric
For worksheets and the mini-project. Each criterion scores level (1–4) ÷ 4 × weight.
| Criterion | Weight | Excellent (4) | Good (3) | Fair (2) | Needs work (1) |
|---|---|---|---|---|---|
| Accuracy of calculations and code | 30% | MACs, roofline, scale and zero-point, SQNR, queues, energy and temperature all correct, with reproducible code and units checked | Nearly all correct, method shown, with small slips that do not change the conclusions | Some errors or missing steps, or code that cannot be reproduced | Many errors or no method |
| Measurement on real hardware and transparency of conditions | 25% | Measures after warm-up; reports p50, p95 and the maximum with the machine, runtime, image size and power mode; separates model time from whole-system time and bench results from board results | Measured correctly, with nearly all conditions reported | Incomplete measurement: missing warm-up or percentiles, or unclear conditions | No real measurement, or manufacturer figures quoted as the model's result |
| Choosing methods and platform to meet requirements, with accuracy checked | 25% | Chooses the platform and the acceleration or compression methods from measurable requirements, checks accuracy after every step, uses a representative calibration set and explains trade-offs with numbers | A reasonable choice, with accuracy checked at nearly every step | Chooses from a single figure such as TOPS, or does not check accuracy after changes | No reasoning from the requirements |
| Delivery, safety, privacy and communicating results | 20% | The release has a manifest, hashes and a signature, with a rollback plan, monitoring, a fallback ladder with hysteresis and a model card; privacy is kept and the assisting computer is separated from flight control; the report is clear and states limits | Mostly complete, with some details missing | Missing a rollback plan or monitoring, or an unclear report | No attention to safety or privacy |
Assessment map: CLOs and how they are assessed Draft
The CLOs are a web-team draft; the course owner sets the final ones (curriculum book, part 4). This table is built from the worksheet and module-quiz data, so it follows any change to the CLOs.
| CLO | Worksheets | Module quizzes |
|---|---|---|
| CLO1 Explain the memory, bandwidth, latency and energy limits of edge AI and select a platform to match the mission | W 1W 4W 5 | M1M4M5 |
| CLO2 Convert, accelerate, compress and quantise models for edge devices and check the effect on accuracy | W 2W 3 | M2M3 |
| CLO3 Measure and report time, energy and temperature on real hardware, interface sensors, and plan safe deployment | W 2W 4W 5 | M4M5 |