← All projects
Computer vision · CPU inference · benchmarking

Aerial Object Detection and Inference Benchmarking

Adapting a small computer vision model to find people, vehicles, and other objects in drone photos. The project compares how model format and image size affect detection accuracy, processing time on a laptop CPU, and file size. It also compares how much data is needed to send a list of detected objects instead of video.

PythonUltralytics YOLOPyTorchONNX RuntimeOpenCVNumPyMatplotlibpytest
The original model is on the left; the version trained on drone photos is on the right. Both see the same image. This is an example, not an accuracy test: the models recognize different sets of object types, and more boxes do not necessarily mean more correct detections.
Aerial object detection comparison
The same drone photo with the original model’s detected objects on the left and the model trained on drone photos on the right.

Footage: Jordan Koschei / ConnectHV, CC0. Source footage · Provenance and dataset terms.

The question

A small computer connected to a camera has limited processing power and may have a slow wireless connection. Larger images can make small objects easier to see, but take more work to process. Making the model file smaller saves storage, but does not automatically make it faster.

This experiment compares three versions of the same trained model at two image sizes. A separate video test asks how much less data would be needed if the computer sent the objects it found and their locations instead of sending every image.

How the experiment works

The starting point is YOLO26 nano, a small model that finds and labels objects in images. It receives additional training on VisDrone, a collection of labeled drone photos, before being saved in three versions for comparison.

Fine-tune

Train YOLO26 nano on drone photos for 50 epochs—50 passes through the training data.

Export and quantize

Export the trained model to ONNX, then use INT8 quantization to make a smaller version by using less precise numbers for some calculations.

Evaluate

Check how well each version finds objects, how long an image takes to process, and how much storage the model needs.

The trained PyTorch model is the starting point for comparison. ONNX is an exported file format, run here with ONNX Runtime. FP32 uses standard 32-bit calculations; INT8 uses less precise numbers for some calculations, which can shrink the file but change accuracy and speed.

Every version comes from the same model trained on 640 × 640-pixel images. Testing at 960 × 960 gives it larger images to analyze; the model was not retrained at that size. A separate script reads the demo video and saves a small message describing the objects found in each frame.

How it was tested

Accuracy was checked on 548 labeled drone photos kept separate from the training images. To measure processing time, each version analyzed the same test image 100 times after 10 untimed warm-up runs on an Apple M4 Pro CPU, the Mac’s main processor.

I left reading the image file out of the timer because a camera would deliver images directly to the program. The timer still includes resizing the image, finding objects, cleaning up the results, and checking the setup. It excludes the warm-up runs and printing logs.

The program checks that all versions receive images with the same dimensions within each size group. That keeps one version from looking faster simply because it processed a smaller image. Each version also uses the same cleanup step to remove duplicate boxes around an object.

Measured results

Processing time on the Apple M4 Pro CPU, including image preparation and result cleanup
FormatImage size (pixels)mAP50–95Mean latency (ms)p95 latency (ms)Model file (MB)
PyTorch FP32640 × 6400.16922.924.65.444
ONNX FP32640 × 6400.16910.911.69.861
ONNX INT8640 × 6400.15312.213.23.045
PyTorch FP32960 × 9600.21338.539.15.444
ONNX FP32960 × 9600.21322.225.410.071
ONNX INT8960 × 9600.19423.023.93.255

mAP50–95: a score for finding the right objects and placing their boxes correctly. The “50–95” means it averages scores with required box overlap set to 50%, 55%, and so on up to 95%. A 50% match allows a looser fit; 95% requires the predicted box to line up very closely with the labeled box. Higher is better; the score isn’t the percentage of objects found.

Latency: how long it takes to process an image, in milliseconds. Mean is the average; p95 gives a sense of the slower runs—roughly 95% finished within that time. Lower is faster.

Model file: the storage needed for the saved model, in megabytes (MB). Smaller is easier to store or transfer. Full measurements (CSV).

The ONNX version could handle larger images in about the same average time as the trained PyTorch version handled smaller ones. At 960 × 960, ONNX FP32 scored 0.213 and averaged 22.2 ms per image. PyTorch FP32 at 640 × 640 scored 0.169 and averaged 22.9 ms on the M4 Pro CPU. That is a higher detection score with a similar average processing time in this test, not proof that the two setups are equally fast on every image.

At 640 × 640, INT8 made the ONNX file 69.1% smaller, but the detection score dropped from 0.169 to 0.153. It also took longer on average at both image sizes. The file-size comparison uses the ONNX FP32 version because PyTorch stores its model differently.

Sending results instead of video

Instead of sending an entire image, the computer could send a short message with each object’s type, location, and the model’s confidence in its prediction. This saves image data, but the receiver no longer gets the full scene.

The comparison uses 353 frames, the individual images in a short drone video. At the video’s recorded rate of 24 frames per second, the calculated data amounts are:

  • Object messages: 4.0 kilobytes per second, based on the average message size.
  • Compressed MP4 video: 63.3 kilobytes per second, based on the video file’s size divided by its duration.
  • Separate JPEG images: 5,277.5 kilobytes per second, saving each frame as an image at quality setting 95.

In 78 of those frames, the model reported no objects. A short message can therefore reflect something the model missed, so less data is only useful alongside reliable detection. These calculations leave out the extra data needed to send messages over a network. They do not test a wireless connection or show that the model can keep up with live video. Full data comparison.

Results and limitations

These results show how the versions compare on one Mac’s CPU. Repeatedly timing one image does not tell us how quickly a complete live-video system would run. The detection scores use the model library’s evaluation tools rather than the dataset’s official competition tests, and apply to the test photos, not the separate demo video.

No computer mounted on a drone or wireless link was tested. Speed, heat, power use, and memory use on that hardware still need to be measured. The full method notes explain the technical details.

The next steps are to time a range of images and check accuracy with VisDrone’s official evaluation tools. After that, I’d try training with larger images, a larger model, and a mode without the separate duplicate-box cleanup step. Testing the actual device, camera, and connection would show how these comparisons hold up outside the laptop experiment.

Explore the source and results

The repository contains the training and evaluation scripts, saved measurements, and measurement methodology.