UAT 456 Artificial Intelligence, Machine Learning and Computer Vision for UAS

Worksheet 2 Features and a classifier for cattle and look-alikes

Analysis activity 90 minAssesses CLO1, CLO2

Objective

Extract colour and HOG features, train a classifier, read the confusion matrix and find the missing feature

Equipment and materials

  • Dataset from Worksheet 1
  • Computer with Python, numpy, opencv, scikit-learn, scipy and the example code at /downloads/uat-456/
  • Paper and calculator for hand calculation

Safety

  • Desk work at a computer; no flying
  • Use only images you have the right to use, and record their source

Steps

  1. Cut 32 × 32 or 64 × 64-pixel patches, at least 4 classes with 50 each
  2. Compute one cell's histogram by hand and with Example 1, and compare
  3. Extract colour and HOG features and train an SVM with Example 2, splitting the test set by paddock or date
  4. Read the confusion matrix, find the most confused pair, then propose and test one extra feature
  5. Report per-class precision, recall, F1 and macro average before and after adding the feature

Record of results

Table 1 Patch set
ClassNumber of patchesSize (px)Source date or paddockSet (train/test)
Table 2 One cell's histogram by hand against code
Orientation bin (degrees)Sum by handCode resultDifference
Table 3 Per-class results before and after the added feature
ClassPrecision beforeRecall beforeF1 beforeF1 after

Questions

  1. Which pair of classes is most confused in your confusion matrix, and why does the feature you added separate them?

  2. How long is the HOG vector of a 48 × 48-pixel window, and what happens to HOG if your objects are much smaller than a cell?

  3. Why does your overall accuracy look good even though some classes have low recall? Answer with your own numbers.

  4. How do your results on a test set split by paddock or date differ from the synthetic results of Example 2, and which figure should be reported to the farm?

Check before you hand in

What to hand in

  • Patch set table
  • Hand versus code histogram table
  • Confusion matrices before and after the added feature
  • Conclusion on which feature separates the confused pair

CLO1 Explain and design an intelligent image-analysis pipeline from image-data preparation and image processing to feature extraction. CLO2 Develop image classification, object detection and tracking, image segmentation and anomaly detection with machine learning and deep-learning models. (CLOs are a web-team draft; the course owner sets the final ones.)

Instructors: answers and teaching notes for this worksheet are in the teaching pack