การเรียนรู้เชิงลึกและ CNN

Neural networks, CNNs, transfer learning and object detection

Last updated:

Why it matters

One drone flight can produce hundreds or thousands of images. Having people look through every one for cracks, people or vehicles is slow, and tired eyes miss things. Deep learning lets a computer learn what an object looks like from labelled examples and then find it in new images. Convolutional neural networks (CNNs) sit at the core of almost every computer vision task on drones, from image classification to object detection.

Neural networks

A single neuron takes several inputs, multiplies each by a weight, sums them, adds a bias and passes the result through an activation function such as ReLU, which keeps positive values and sets negative ones to zero. Stacking many layers of neurons lets the network learn complex relationships. Training adjusts the weights to reduce the loss between predictions and true labels, using backpropagation to compute gradients and gradient descent to take small steps.

How a CNN works

A convolutional layer slides a small filter, for example 3 × 3, across the image. The same filter is used at every position, so the layer has far fewer parameters than a fully connected one and finds a feature wherever the object is. Early layers learn edges and textures; deeper layers combine them into shapes and object parts.

  • Stride and pooling shrink the feature maps so that later layers see a wider area.
  • The receptive field is the region of the original image that influences one value deep in the network. Five stacked 3 × 3 layers with stride 1 have a receptive field of 1 + 5 × 2 = 11 pixels.
  • Landmark networks include LeNet (1998), AlexNet (2012) and ResNet (2016), whose residual connections made very deep networks trainable.

Classification, detection and segmentation

TaskOutputDrone example
ClassificationOne label per imageDoes this image show a crack?
Object detectionA box, label and confidence score for each objectCounting cars in a car park, finding people in a flood
SegmentationA label for every pixelMeasuring flooded area or leaf area

Single-stage detectors such as YOLO predict boxes and labels in one pass, fast enough for real time. Overlapping boxes are removed with non-maximum suppression (NMS), and results are measured with IoU (intersection over union), precision, recall and AP following the PASCAL VOC and COCO conventions.

Transfer learning

Training a CNN from scratch needs a very large labelled dataset. Transfer learning reuses a network already trained on a large dataset such as ImageNet or COCO: keep the feature extractor (backbone) and train only a new head for your task. If the backbone outputs a 512-value vector and the task has 4 labels, a fully connected head has only 512 × 4 + 4 = 2,052 parameters, which can be trained from a few hundred images. With more data, unfreeze some deeper layers and fine-tune them with a low learning rate.

Worked example: how many pixels is a person in a drone image?

Example: shrinking the image until the object vanishes

An assumed camera has a 13.2 mm wide sensor, 8.8 mm focal length and images 5,472 by 3,648 pixels, looking straight down. The task is to detect people about 0.5 m wide seen from above (assumed). The detector takes 640-pixel input.

  1. GSD = (w × H) / (f × N). At 60 m: 13.2 × 60 / (8.8 × 5,472) ≈ 0.0164 m, or 1.64 cm per pixel.
  2. A person spans 0.5 / 0.0164 ≈ 30 pixels in the full image.
  3. If the whole image is shrunk to 640 pixels wide, the person becomes 30.4 × 640 / 5,472 ≈ 3.6 pixels, too small for a typical detector.
  4. At 90 m, GSD ≈ 2.47 cm, the person spans ≈ 20 pixels and ≈ 2.4 pixels after shrinking.

The remedy is to cut the full image into 640 × 640 tiles: 9 × 6 = 54 tiles per image without overlap, and a small overlap is wise so that objects on tile edges are not cut. The price is many times more computation, which must be weighed against flying lower or using a model with larger input.

Common pitfalls

  • Shrinking a high-resolution image whole, losing small objects, then blaming the model.
  • Splitting training and test sets randomly by image, although consecutive frames from one flight are near duplicates; results look better than they are. Split by flight or site.
  • Using a model trained on ground-level photos for nadir imagery without adaptation; objects look very different from above.
  • Reporting only overall accuracy without breaking it down by condition such as evening light, shadow or haze.
  • Using data or models without checking licences; datasets, weights and code may carry different terms.

Continue in the lessons

Key references

  1. Prince, S. J. D. (2023). Understanding deep learning. MIT Press. link
  2. Géron, A. (2022). Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow (3rd ed.). O'Reilly.
  3. Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep learning. MIT Press. link
  4. He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of CVPR 2016 (pp. 770–778). link
  5. Redmon, J., Divvala, S., Girshick, R., & Farhadi, A. (2016). You only look once: Unified, real-time object detection. In Proceedings of CVPR 2016 (pp. 779–788). link
  6. Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., & Zitnick, C. L. (2014). Microsoft COCO: Common objects in context. In Computer Vision – ECCV 2014 (pp. 740–755). Springer. link

Used in courses

How to cite this page

Drone Institute, Rangsit University. (2026). การเรียนรู้เชิงลึกและ CNN. In UAS Technology Knowledge Hub (B.Tech.). https://rsu-uat.pk-research.work/en/kb/new/dl-cnn/