Teaching pack · UAT 306
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 10 of 10 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 |
|---|---|---|---|
| Artificial intelligence fundamentals | M1 | Module 1: Types and approaches of AI (Example 1, a hand-written rule versus a threshold learned from data), Framing a measurable problem, and AI supports decisions; it does not make them | Covered |
| Machine learning | M1M2 | Module 1: Types and approaches of AI (supervised, unsupervised and reinforcement learning) · Module 2: logistic regression trained with gradient descent, overfitting and cross-validation | Covered |
| Data preparation | M3 | Module 3: labelling guidelines, splitting by flight while keeping class proportions, and checking the dataset before training | Covered |
| Classification | M1M2 | Module 1: choosing classification, detection or segmentation, and rare targets · Module 2: separating cracks from stains with logistic regression | Covered |
| Regression | M2 | Module 2: Regression with drone flight data (Example 3, hover current and endurance from mass, RMSE, R² and extrapolation) and Overfitting and cross-validation (Example 2) | Covered |
| Neural networks | M2M4 | Module 4: Neurons, layers and backpropagation (Example 1, one step by hand and a hidden-layer network with hand-written backpropagation) and Convolution layers · Module 2: logistic regression as a single neuron | Covered |
| Deep learning | M4 | Module 4: convolution layers, removing duplicates with NMS, and transfer-learning a detector in the lab | Covered |
| Model evaluation | M1M2M4M5 | Module 1: precision for rare targets and cost-based thresholds · Module 2: cross-validation · Module 4: precision, recall and AP · Module 5: measuring time correctly | Covered |
| Use of sensor and image data | M3M4 | Module 3: Sensor and telemetry data (Example 3, detecting a chipped propeller from IMU vibration, and lab step 6) and the image datasets · Module 4: object detection in images | Covered |
| Deployment of models in unmanned aircraft systems | M5 | Module 5: shrinking the model with INT8 and the deployment plan for the drone | Covered |
Weekly teaching plan
| Week | Topic | Pre-class | Lecture | Lab | Evidence |
|---|---|---|---|---|---|
| 1 M1 | Types of AI and framing a measurable AI problem | Read module 1 on types and approaches of AI and framing a measurable problem; run Example 1 | Approaches of AI (rules, search, probability, machine learning), EASA AI levels, what users do with AI output, and choosing classification, detection or segmentation | In class: choose an inspection job as a group, write what users will do with the AI output and pick the problem type · Self-study: Worksheet 1 part A, write the one-page problem statement | One-page problem statement |
| 2 M1 | When the target is rare | Read the rare-target section; run Example 2 | Prevalence, precision and why a good detector can raise many false alarms | In class: estimate real prevalence and compute expected precision with Example 2 · Self-study: Worksheet 1 part B, write the precision calculation for the chosen job with its assumptions | Precision calculation with assumptions |
| 3 M1 | Cost-based thresholds and the limits of AI decisions | Read the threshold and decision-support sections; run Example 3; take the module 1 quiz | Cost of misses versus false alarms, and what humans must check | In class: agree the cost ratio of misses to false alarms and pick the lowest-cost threshold with Example 3 · Self-study: Worksheet 1 part C, write the AI's decision boundary and finish the Worksheet 1 report | Worksheet 1 report and quiz result |
| 4 M2 | Logistic regression | Read module 2 on logistic regression; run Example 1 | Sigmoid, cross-entropy loss and gradient descent | In class: run Example 1 with learning rates 0.01, 0.5 and 100 and watch the loss · Self-study: Worksheet 2 part A, plot the three loss curves and explain the differences | Three loss curves |
| 5 M2 | Hand-written model versus a library | Review Example 1; read the scikit-learn LogisticRegression docs | Accuracy and weight direction of the hand-written model compared with the library | In class: train the same data with scikit-learn LogisticRegression and compare accuracy and the direction of the weights · Self-study: Worksheet 2 part B, make the comparison table against the hand-written model | Weights and accuracy comparison |
| 6 M2 | Overfitting, cross-validation and regression | Read the overfitting and flight-data regression sections; run Examples 2 and 3; take the module 2 quiz | Training versus validation error, choosing complexity, linear regression, RMSE and R², and the danger of predicting outside the data range | In class: run Example 2 with degrees 1 to 12, then reduce the data to 15 points · Self-study: Worksheet 2 part C, build the hover-current model from flight logs supplied by the lecturer (or your own) and report RMSE and mass range | Worksheet 2 short report with the regression RMSE and mass range, and quiz result |
| 7 M3 | Labelling guidelines and annotator agreement | Read module 3 on labelling guidelines; run Example 1 | Kappa and IoU; guidelines with positive and negative examples | In class: write a one-page crack guideline in pairs and each person labels the same first 10 images in CVAT to test it · Self-study: Worksheet 3 part A, complete labelling to 50 images and compute first-round kappa and IoU | Guideline and first-round kappa and IoU |
| 8 M3 | Splitting by flight with class balance | Read the splitting section; run Example 2 | Leakage from random image splits and StratifiedGroupKFold | In class: revise the guideline where annotators disagree and split by flight with Example 2 · Self-study: Worksheet 3 part B, relabel, remeasure and make the class-proportion table | Second-round agreement and class-proportion table |
| 9 M3 | Checking the dataset; midterm | Read the sensor and telemetry section; run Example 3; review modules 1–3; take the module 3 quiz | IMU and telemetry data: windows, physics-based features and splitting by flight (first hour), then the midterm examination (modules 1–3) | The midterm takes the class period, so there is no in-class practice · Self-study: Worksheet 3 part C, check the dataset against the minimum list, write the dataset documentation and compute vibration features from an IMU log supplied by the lecturer (or your own) | Dataset documentation, vibration-feature table and midterm score |
| 10 M4 | Neurons, backpropagation and convolution layers | Read module 4 on neurons, layers and backpropagation and on convolution layers; run Examples 1 and 2 | Neurons and activations, the forward and backward passes of backpropagation, feature-map size, parameter count and transfer learning | In class: compute the first three layer sizes with Example 2 and start training a small YOLO on the module 3 data on a GPU or a cloud notebook · Self-study: Worksheet 4 part A, finish training and keep the training log | Layer-size table and training log |
| 11 M4 | NMS, precision, recall and AP | Read the NMS and AP sections; run Example 3 | Matching boxes by IoU, the precision-recall curve and AP@0.5 | In class: export validation predictions and compute AP@0.5 yourself with Example 3 · Self-study: Worksheet 4 part B, compare with the value the tool reports and explain the difference | AP from both sources with explanation of differences |
| 12 M4 | Error analysis of the detector | Review module 4; take the module 4 quiz | Effects of NMS IoU and confidence threshold | In class: vary NMS IoU and confidence threshold and observe precision and recall · Self-study: Worksheet 4 part C, review wrong predictions one by one, group their causes and write the short report | Worksheet 4 short report and quiz result |
| 13 M5 | Measuring inference time correctly | Read module 5 on timing; run Example 1 | Warm-up, percentiles and end-to-end time | In class: time the model on a PC at least 200 runs after warm-up with Example 1 and watch the lecturer demonstrate the same measurement on the lab's onboard computer · Self-study: Worksheet 5 part A, make the table of p50, p95 and maximum for at least two machines | Table of p50, p95 and maximum |
| 14 M5 | INT8 quantisation and the deployment plan | Read the INT8 and deployment sections; run Example 2; take the module 5 quiz | Outliers and INT8 error; acceptance criteria for deployment | In class: export to ONNX and quantise to INT8 as in Example 2, comparing size and time · Self-study: Worksheet 5 part B, compare AP of FP32 and INT8, measure end-to-end time and write the drone deployment plan with acceptance criteria | FP32 versus INT8 table |
| 15 M5 | Mini-project presentations | Prepare the drone deployment plan with acceptance criteria | Course wrap-up and project criteria | The class period is used to present the AI system from problem framing, dataset and evaluation to the onboard deployment plan · Self-study: revise the report after the comments | Mini-project report and presentation, scored with the rubric |
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 Framing an AI problem for a real job
Analysis activity · About 3 h of class time · CLO1
Objective: Frame a drone inspection AI problem measurably, estimate precision from prevalence and choose a cost-based threshold
Equipment
- Computer with Python
- Example code at /downloads/uat-306/
Safety
- Desk work only; no flying
Steps
- In class: choose an inspection job; write what users will do with the AI output
- In class: choose classification, detection or segmentation with reasons
- In class: estimate the prevalence and compute expected precision with Example 2
- In class: agree the cost ratio of misses to false alarms; choose a threshold with Example 3
- Self-study: write the one-page problem statement and the precision calculation with assumptions
- Self-study: write what the AI may decide and what a person must check
Deliverables
- One-page problem statement
- Precision and threshold calculations
- Decision boundary of the AI
Checklist
- Table 1 has at least 4 prevalence levels, including the real job's prevalence with its source
- Table 2 covers all 5 thresholds, states the cost ratio used and circles the threshold with the lowest total cost
- The threshold is chosen on the validation set, not the default 0.5 without a reason
- The one-page framing states clearly that the AI is a screening tool and the structural safety decision belongs to the engineer
Instructor guide
Class timing
- Objectives and review of the bridge-crack case15 min
- Choose the job, write what the user does with the result, choose the problem type40 min
- Estimate prevalence and compute precision with Example 2 (Table 1)35 min
- Agree the cost ratio and choose a threshold with Example 3 (Table 2)40 min
- Write the framing and the AI decision boundary35 min
- Wrap-up, questions and hand-in checklist15 min
Expected results
- Table 1 (using Example 2 values, sensitivity 0.95, specificity 0.98, per 1,000 images): prevalence 20% gives TP 190.0, FP 16.0, precision 0.92; 10% gives 95.0, 18.0, 0.84; 5% gives 47.5, 19.0, 0.71; 2% gives 19.0, 19.6, 0.49; 1% gives 9.5, 19.8, 0.32. The group's real-job prevalence must fall on the same curve; accept ±0.01 from rounding. The source of the prevalence must be stated (user experience, past inspection reports or a written assumption).
- Table 2 (Example 3 simulated scores, 1,000 validation images with 60 cracks, ratio 50:1): threshold 0.3 gives 0 missed, 607 false alarms, cost 607; 0.4 gives 0, 363, 363; 0.5 gives 2, 155, 255; 0.6 gives 9, 45, 495; 0.7 gives 26, 11, 1311. The best threshold is 0.5 (recall 0.97, precision 0.27). If the group agreed another ratio, the costs must be recomputed from the same FN and FP counts.
- A strong framing has: a clear job and user (for example, screening images for an engineer), the problem type with reasons, the prevalence with its source, the cost ratio the user accepts, the threshold chosen on the validation set, and a boundary saying the AI screens while the engineer decides safety, with what the system must show (confidence, location in the image, model version).
- It depends on the job's prevalence: at 2% about 49 of 100 alerts are real cracks, at 1% about 32, so most alerts are false. The engineer must look at every image the AI flags, but that is still fewer than looking at all images. A strong answer says the detector must be evaluated at the real job's prevalence, not the vendor dataset's.
- At 10:1 the costs are 607, 363, 175, 135, 271, so the best threshold moves up from 0.5 to 0.6 (135 is below 175): misses are now cheaper, so accepting more misses (9 images) to cut false alarms from 155 to 45 pays off. At 100:1 the threshold stays at 0.5 (cost 355).
- A strong answer links the type to the use: if the user only needs to know which images to look at, whole-image classification has the cheapest labels; if the engineer needs the location pointed out, use detection (boxes); if the crack length or area must be measured, use segmentation, which has the most expensive labels.
- Deciding whether the structure is safe or needs repair always belongs to a qualified engineer; the AI is at the level of assisting a human. The system should show its confidence, mark locations in the image and record the model version used, so that questions can be traced back.
Discussion questions
- A vendor claims its detector is 99% accurate. What should we ask before believing it?
- Which drone inspection tasks are better served by hand-written rules than by machine learning, and why?
- Who should set the cost ratio of misses to false alarms: the AI team or the user?
Adapting to student background
- Upper secondary (M.6)
- Have them compute one row of PPV by formula on paper before running the code, then explain with a 2×2 table why low prevalence gives low precision.
- Vocational certificate
- Start by counting real images (for example 1,000 images with 10 cracks: how many caught, how many false alarms) instead of proportions, and fill Table 2 with a calculator alongside the code.
- Diploma
- Extension: use an inspection job from their own workplace experience, estimate prevalence from that experience and interview one user to find the cost ratio.
2Worksheet 2 Training by hand and comparing with a library
Analysis activity · About 3 h of class time · CLO1, CLO3
Objective: Understand gradient-descent training against a library and use cross-validation to detect underfitting and overfitting, and build a regression model from flight data
Equipment
- Computer with Python, numpy, scikit-learn and matplotlib
- Module 2 example code
- Flight logs with battery current (from the lecturer, or your own if available)
Safety
- Desk work only; no flying
Steps
- In class: run Example 1 with learning rates 0.01, 0.5 and 100; observe the loss
- Self-study: plot the three loss curves and explain the differences
- In class: train the same data with scikit-learn LogisticRegression; compare accuracy and the direction of the weights
- In class: run Example 2 for degrees 1 to 12; plot both error curves
- In class: reduce the data to 15 points; see whether the best degree changes
- Self-study: replace the data in Example 3 with hover current from flight logs; fit the line and report the leave-one-flight-out RMSE and the mass range
- Self-study: summarise how to tell whether a model underfits or overfits
Deliverables
- Loss curves by learning rate
- Comparison with scikit-learn
- Error-by-degree plots for both cases
- Conclusion on underfitting and overfitting
- Hover-current model with its RMSE and valid mass range
Checklist
- Table 1 has all three learning rates and the scikit-learn row, with three labelled loss curves
- Table 2 covers degrees 1 to 12 for both cases and circles the degree with the lowest validation RMSE, not training RMSE
- Table 3 gives the line equation, R², leave-one-flight-out RMSE and the mass range of the data, all with units
- The underfitting and overfitting summary quotes numbers from your own tables and states the source of the flight logs used
Instructor guide
Class timing
- Review of logistic regression and gradient descent10 min
- Run Example 1 with three learning rates and plot40 min
- Train with scikit-learn and compare weights25 min
- Run Example 2 for degrees 1 to 12 with 30 and 15 points45 min
- Build the hover-current model from flight logs45 min
- Wrap-up, questions and hand-in checklist15 min
Expected results
- Table 1 (Example 1 simulated data, 500 iterations): rate 0.01 gives loss 0.665 (iteration 10) and 0.237 (iteration 500), very slow; rate 0.5 gives 0.241 and 0.083 with weights (0.09, 4.25, 3.11); rate 100 gives 0.308 and 0.094 with weights (1.22, 6.18, 4.27). Accuracy is 0.98, 0.98 and 0.975 respectively. Rate 100 is above the ceiling of about 85 (2 divided by the largest curvature, 0.0236), so the loss alternates between 0.092 and 0.094 on every iteration and never falls to the 0.080 that rate 5 reaches (if students also try rate 5 they get 0.096 and 0.080, converging normally). For the scikit-learn row, compare only accuracy, which is the same 0.98, and the direction of the weights: both features positive, with elongation larger than edge strength. The weight sizes need not match the hand-written model (the library's default settings give about 0.06, 2.92, 2.23). The lecturer does not need to ask students to explain the size difference.
- Table 2 (Example 2 data): with 30 points, degree 1 gives 1.09/1.22, degree 3 gives 0.55/0.61 (lowest validation), degree 9 gives 0.46/0.74, degree 12 gives 0.41/1.69. Reducing to 15 points by keeping every second point, the best degree becomes 2 (0.61/0.78) and the validation RMSE of degree 9 jumps to about 75. The 15-point numbers depend on which points are kept and the random folds; accept them if the best degree stays the same or drops and high degrees clearly get worse.
- Table 3 (if the lesson's Example 3 data is used because no lab flight logs are available yet): current = -13.2 + 15.52 × mass (A, kg), R² 0.994, training RMSE 0.55 A, leave-one-flight-out RMSE 0.73 A, mass range 2.0 to 3.4 kg; at 3.3 kg it predicts 38.0 A and 12.6 min of hover with 8 Ah usable. With real logs the numbers differ, but the leave-one-flight-out RMSE should exceed the training RMSE and the mass range must be stated.
- Rate 0.5 suits best: it falls fast and settles. Rate 0.01 is very slow (loss still 0.237 after 500 iterations). Rate 100 is above the ceiling of about 85, so the loss alternates between 0.092 and 0.094 and does not converge; far above it (for example 300) the loss shoots up to 4.9 instead of falling. If students try rate 5 they find it converges, faster than 0.5, because it is below the ceiling. A strong answer also mentions standardising the features.
- Degree 3 with 30 points (validation RMSE 0.61), and the same or a lower degree with 15 points (for example 2 at 0.78), because with less data a complex model memorises noise easily: the training RMSE of high degrees approaches 0 while the validation RMSE explodes. So do not increase complexity when data is scarce.
- Only within the mass range of the training data (2.0 to 3.4 kg in the lesson). Outside it, at 4.0 kg, the line predicts 48.8 A and 9.8 min, but the measured current is 50.9 A and 9.4 min, an underestimate of 2.1 A, because hover power grows faster than linearly according to momentum theory. The team must fly hover tests at the new mass and refit the model first.
- Underfitting is wrong on both sets, for example degree 1 with 1.09 and 1.22; overfitting has low training but high validation error, for example degree 12 with 0.41 and 1.69; a good fit has the lowest validation error close to the training error, for example degree 3 with 0.55 and 0.61. A strong answer uses its own numbers and never uses the test set to choose complexity.
Discussion questions
- If a library trains a model in a few lines, why must an engineer still understand gradient descent?
- How does leave-one-flight-out RMSE differ from RMSE on the training data, and which should be reported to a flight planner?
- Besides hover current, what other quantities in flight logs could be predicted by regression, and how should the data range be handled?
Adapting to student background
- Upper secondary (M.6)
- Have them compute one weight update by hand from w ← w − η∇L before running the code, and link it to the derivatives they learned at school.
- Vocational certificate
- Focus on reading graphs before formulas: plot training and validation RMSE on graph paper and point to the minimum, and use real logs from drones they have built or flown.
- Diploma
- Extension: collect one extra hover log at a mass outside the original range (supervised by the lecturer and following flying rules) and show how far the straight line is off.
3Worksheet 3 A trustworthy dataset
Analysis activity · About 3 h of class time · CLO2
Objective: Write labelling guidelines, measure annotator agreement, split by flight and document the dataset
Equipment
- Drone images with cracks (from the lecturer)
- CVAT
- Python and the module 3 example code or StratifiedGroupKFold
- One ArduPilot or PX4 flight log (from the lecturer, or your own if available)
Safety
- Desk work only; no flying
- Crop or blur people or number plates before sharing images with the group
Steps
- In class: write a one-page crack labelling guideline with positive and negative examples
- In class: have two classmates label the same first 10 images in CVAT to test the guideline
- Self-study: complete labelling to 50 images, then compute kappa and IoU with Example 1
- In class: revise the guideline where they disagree, then split by flight with Example 2
- Self-study: relabel, remeasure and report class proportions
- Self-study: check the dataset against the minimum list and write the documentation
- Self-study: export the IMU (or VIBE) messages from one flight log, cut them into 1-second windows and compute both features of Example 3
Deliverables
- Revised labelling guideline
- Kappa and IoU before and after revision
- Split and class-proportion table
- Dataset documentation
- Table of vibration features per window
Checklist
- The revised guideline has positive and negative examples, how to draw boxes and what to do when unsure
- Table 1 has rounds before and after revision with p_o, p_e and kappa, not just percent agreement
- In Table 2 no flight appears in both train and test, and every split has its class share
- Table 3 has at least 10 windows from a named flight log, with units
- The dataset documentation states image rights, the split method and the results of the minimum checklist
Instructor guide
Class timing
- Objectives, image privacy and using CVAT10 min
- Write the guideline and have two classmates label the first 10 images50 min
- Compute kappa and IoU with Example 1, then revise the guideline30 min
- Split by flight with Example 2 and check the minimum list35 min
- Export IMU or VIBE and compute the Example 3 features40 min
- Wrap-up, questions and hand-in checklist15 min
Expected results
- Table 1 (real numbers depend on the group's images; the lesson's Example 1 gives reference values): 100 images, p_o 0.86, p_e 0.42, kappa 0.76, box IoU of the three pairs 0.85, 0.38, 0.04 (mean 0.42). After revising the box-drawing rule, kappa and IoU should rise; if they do not, the guideline is still unclear. Check that kappa = (p_o − p_e)/(1 − p_e) is computed correctly.
- Table 2 (Example 2 data, 12 flights, 1,318 images): train F05, F04, F01, F03, F06, F07, F11, F02 with 901 images (68%), crack share 0.180; validation F08, F12 with 192 images (15%), 0.178; test F09, F10 with 225 images (17%), 0.220. With StratifiedGroupKFold the result may differ, but no flight may appear in more than one split.
- Table 3 (Example 3 simulated data at 400 samples per second, rotor at 95 revolutions per second): sound propellers give a standard deviation of about 5.3 to 6.5 m/s² and an energy share near 95 Hz of about 0.02 to 0.09; a chipped propeller gives 25.3 to 36.3 m/s² and a share of 0.95 to 0.98. A real log from a drone with sound propellers should show vibration below 30 m/s/s, as in the ArduPilot documentation. Real numbers depend on the drone; the rotor frequency used must be stated for each window.
- In the lesson, 86% agreement looks high, but kappa is 0.76 because chance agreement is as high as 0.42 when one class is common. A strong answer names the revised rule (for example, boxes tight to the crack, excluding shadow) and shows the low box IoUs (0.38, 0.04) improving after revision.
- In the lesson's example, train and validation are very close (0.180 and 0.178) and test is slightly higher (0.220), because with few flights the split is coarse. With a random split by image, very similar images from one flight end up in both train and test, so the score looks better than it is.
- The energy share near the rotor frequency is better: in the example it flags 50 of 50 chipped-propeller windows, while the rule std above 30 m/s² flags only 25 of 50, because a moderate imbalance can stay under the guideline. Rotor speed changes with throttle, so the band must follow the motor speed recorded in the log. The answer must compare the group's own vibration level with 30 m/s/s.
- At least: class definitions and the labelling guideline, image source and usage rights, numbers of images and flights, the split method and class share per split, annotator agreement, and the results of the minimum checklist (duplicates across splits, boxes outside the image or of zero size, images missing labels).
Discussion questions
- If two annotators disagree on an image, who should decide, and where should the decision be recorded?
- If all images come from one bridge, should you split by flight or by site, and how does this limit using the model on other bridges?
- Which other sensor data in a flight log might reveal a drone fault before it shows in the images?
Adapting to student background
- Upper secondary (M.6)
- Have them compute kappa from the 3×3 table on paper before using the code, and explain with probability where chance agreement comes from.
- Vocational certificate
- Start with labelling in CVAT and comparing two boxes on screen before showing IoU as overlap area over union area; allow a spreadsheet for the flight split instead of code.
- Diploma
- Extension: export two logs from a drone they maintain, before and after balancing or replacing propellers, and compare both features.
4Worksheet 4 Training and evaluating a detector
Analysis activity · About 4 h of class time · CLO3, CLO1
Objective: Train an object detector by transfer learning, compute AP yourself against the tool and analyse errors
Equipment
- Computer with a GPU or a cloud notebook
- A small YOLO model (e.g. Ultralytics)
- Dataset from worksheet 3
- Module 4 example code
Safety
- Desk work only; no flying
- For cloud training, upload only data that you are permitted to upload
Steps
- In class: compute feature-map sizes of the first three layers with Example 2
- In class: start training a detector on the module 3 dataset by transfer learning
- Self-study: finish training and keep the training log and model weights
- In class: export validation predictions and compute AP@0.5 with Example 3
- Self-study: compare AP with the tool and explain the difference
- In class: vary NMS IoU and confidence threshold; observe precision and recall
- Self-study: review wrong predictions one by one and group their causes
Deliverables
- Layer-size table
- Training log and model weights
- AP from both sources
- Effect of IoU and threshold
- Grouped error causes
Checklist
- Table 1 shows the output-size and parameter formulas and uses values from the actual model structure
- Both AP values in Table 2 state the IoU criterion and are computed on the validation set, not the training set
- Table 3 groups errors into at least 3 groups with image numbers that can be traced
- The training log and model weights are attached, naming the worksheet 3 dataset used
- The answers quote numbers from your own tables and always report AP with its criterion
Instructor guide
Class timing
- Review of neurons, backpropagation and convolution layers15 min
- Compute the first three feature-map sizes with Example 225 min
- Start training the detector by transfer learning60 min
- Export validation predictions and compute AP@0.5 with Example 350 min
- Vary NMS IoU and confidence threshold; record precision and recall40 min
- Review wrong predictions, group causes, wrap up and run the hand-in checklist50 min
Expected results
- Table 1 (if the model takes 640 px images and its first three layers are 3×3 convolutions with stride 2 and padding 1, channels 3 → 16 → 32 → 64; check against the structure file of the model actually used): output sizes 320, 160, 80 px and 448, 4,640 and 18,496 parameters from k×k×C_in×C_out + C_out. Lesson reference values: 640 px gives 640 at stride 1 and 320 at stride 2; a 3 → 32 channel layer has 896 and a 32 → 64 layer has 18,496 parameters.
- Table 2 (reference values from Example 3, one image with 4 cracks): NMS IoU 0.5 with no confidence cut gives precision 0.60, recall 0.75, AP 0.688; threshold 0.5 gives 0.75, 0.75, 0.688; threshold 0.7 gives 0.67, 0.50, 0.500; threshold 0.9 gives 1.00, 0.25, 0.250; NMS IoU 0.95 with no cut gives 0.43, 0.75, 0.542. Real validation results depend on the dataset. Your own AP should be close to the tool's (a few hundredths apart) when the same criterion is used.
- Common groups to expect: small or thin cracks lost when the image is resized (FN), stains, shadows or concrete joints reported as cracks (FP), blur or glare, boxes whose extent differs from the label (IoU below 0.5), and wrong labels in the dataset itself. A strong answer gives the number of images per group and a practical fix.
- Differences come from: a different IoU criterion (AP@0.5 versus AP@0.5:0.95), the way the area under the curve is approximated (every point, 11 points or 101 points), pooling all images together instead of per image, and different confidence or NMS settings. A strong answer states the criterion and method of both sources.
- As the threshold rises, precision usually rises and recall falls (in the example, 0.5 gives 0.75/0.75 and 0.9 gives 1.00/0.25). For screening where misses are expensive, choose a threshold low enough to keep recall high and accept false alarms, choosing it on the validation set with the Module 1 costs.
- Duplicate boxes are no longer removed, because the duplicates in the example overlap at IoU 0.83 and 0.79, below 0.95. They count as false alarms, so precision falls from 0.60 to 0.43 and AP from 0.688 to 0.542.
- It depends on the group's results. If many small cracks are missed, use larger input images or tiles and add images of small cracks; if stains or shadows are flagged, add negative examples to the guideline and the dataset; if wrong labels are found, fix the guideline, relabel and remeasure kappa.
Discussion questions
- Why does transfer learning suit our small crack dataset better than training from scratch?
- If two vendors report mAP under different criteria, how can we compare them fairly?
- What does looking at wrong images one by one tell us that a single mAP value cannot?
Adapting to student background
- Upper secondary (M.6)
- Have them work one neuron by hand as in Example 1 (forward, backward and update) before training the detector, so they see what the tool does inside.
- Vocational certificate
- Start with reviewing wrong images and grouping causes, then compute AP with a fill-in table row by row (sort by score, count hits, compute cumulative precision and recall).
- Diploma
- Extension: retrain at two input sizes (for example 640 and 960 px) and compare small-crack recall and training time.
5Worksheet 5 Benchmarking and shrinking the model
Lab · About 4 h of class time · CLO3
Objective: Measure inference time correctly on a PC and an onboard computer, quantise the model to INT8 and write a deployment plan
Equipment
- Model from worksheet 4
- At least one accessible computer, such as a personal PC or a cloud notebook
- The lab's onboard computer (demonstrated by the lecturer in class, or open for use outside class time if available) with a camera and power supply
- ONNX and a quantisation tool
Safety
- Bench or desk work only; no flying
- If you use the onboard computer yourself, use the correct supply voltage and beware of hot heat sinks during long runs
Steps
- In class: time inference on a PC at least 200 times after warm-up and watch the lecturer run the same measurement on the onboard computer
- Self-study: report p50, p95 and maximum for at least two machines with Example 1, stating hardware, runtime and image size
- In class: export to ONNX, quantise to INT8 and compare size and time
- Self-study: compare the AP of FP32 and INT8
- Self-study: measure end-to-end time from frame to result and compare with model time
- Self-study: write a deployment plan with acceptance criteria
- In class (week 15): present the whole AI system
Deliverables
- Inference-time table for at least two machines, including the onboard-computer result demonstrated by the lecturer
- End-to-end timing
- FP32 versus INT8 table
- Drone deployment plan
Checklist
- Table 1 has at least two machines, at least 200 runs after discarding warm-up, and states machine, runtime and image size
- p50, p95 and maximum are reported, not the mean alone
- Table 2 re-measures INT8 AP on the same validation set as FP32
- The plan has acceptance criteria for end-to-end time, accuracy after shrinking, power and heat, and the overload behaviour
- Model time and end-to-end time are clearly separated in the report and presentation
Instructor guide
Class timing
- Objectives, safety of power supply and heat sinks15 min
- Time 200+ runs on a PC after warm-up and watch the onboard-computer demo60 min
- Export to ONNX, quantise to INT8, compare size, time and AP60 min
- Measure end-to-end time from frame to result45 min
- Write the drone deployment plan with acceptance criteria45 min
- Wrap-up, questions and hand-in checklist15 min
Expected results
- Table 1 (numbers depend on the real machines; reference values from the Example 1 simulated onboard-computer data): including warm-up, 205 runs, mean 46.1, p50 43.0, p95 59.3, max 202.9 ms; after dropping the first 5, 200 runs, mean 42.8, p50 42.8, p95 56.4, max 63.4 ms. An onboard computer is usually slower than a PC with a GPU. Check that the maximum after warm-up is not abnormally high like the first runs.
- Table 2: the INT8 file is about one quarter of FP32 (in Example 2, 10,000 weights fall from 39.1 KiB to 9.8 KiB). Time may fall on hardware with fast INT8, but some machines are not faster. AP must be re-measured; real numbers depend on the model and quantisation tool, so there is no fixed answer. Check that it is measured on the same validation set and compared with the criterion the group set in advance.
- End-to-end time must always exceed model time. Example (assumed): model p95 56.4 ms, image read 8 ms, resize 6 ms, send 5 ms gives 75.4 ms, about 13.3 frames per second. A good plan states the machine and runtime, image size, maximum accepted end-to-end p95, minimum AP after shrinking, power and heat, and what happens when processing falls behind.
- Frames per second is about 1000/p95: p95 of 56.4 ms gives about 17.7 fps, and 50 ms gives 20. A strong answer compares this with the frame rate the job needs; for example, still images for later inspection need far less than a task that must react in flight.
- In the assumed example, end-to-end time of 75.4 ms is 19 ms more than model time, and a drone at 10 m/s moves about 0.75 m while one frame is processed. A strong answer names the slowest part from real measurements (for example image reading or resizing), which may take longer than the model itself.
- The AP drop depends on the group's results and must be compared with the criterion set before measuring. An outlier makes the scale coarse: in Example 2, using the true maximum gives scale 0.00472 and mean error 1.186e-3, about 3 times higher than clipping at ±0.2 (0.00157, 0.392e-3), but clipping distorts the outlier by 0.400, so accuracy must be re-measured every time.
- The options taught are skipping frames (processing only the latest frame) or storing images for processing after the flight. A strong answer chooses by task: crack inspection that needs no immediate reaction can store images for post-flight processing without losing data, and states how the system informs the operator.
Discussion questions
- Why do some vendors report only mean model time, and what extra data should a buyer ask for?
- If the onboard computer heats up and slows itself down during a long flight, under what conditions should our acceptance criteria be measured?
- Which drone tasks should be processed onboard, and which can wait until after the flight?
Adapting to student background
- Upper secondary (M.6)
- Have them compute p50 and p95 by hand from the first 20 measurements before using numpy, and compute the scale and q values for three weights with the quantisation formula.
- Vocational certificate
- Focus on setting up and measuring on the real hardware with the lecturer, using a prepared script, and fill Table 1 cell by cell, explaining in words that p95 means 95 of 100 runs finish within that time.
- Diploma
- Extension: connect the camera to the onboard computer themselves under supervision, and measure real end-to-end time and heat-sink temperature during a 10-minute continuous run.
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) |
|---|---|---|---|---|---|
| Problem framing and data preparation | 25% | Measurable problem; dataset with guideline, agreement scores and correct split by flight | Nearly complete | No agreement check or a leaky split | Unclear problem and undocumented dataset |
| Model training and evaluation | 30% | Task-appropriate metrics, AP matching the tool, grouped error analysis | Correct evaluation, partial error analysis | Unsuitable metrics or evaluation on training data | No trustworthy evaluation |
| Onboard deployment | 25% | Correct timing, full INT8 comparison, plan with acceptance criteria and overload behaviour | Nearly complete | Timing includes warm-up or plan lacks criteria | No measurements on real hardware |
| Communication and reporting | 20% | Clear, concise, states the AI's scope and limits honestly | Clear with minor flaws | Hard to follow or missing parts | Does not communicate results |
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.