Roboflow supports tiling during training as a pre-processing step to train models to detect small objects in large images, and now you can also use tiling during inference on edge devices with no added code. Edge tiling is especially helpful and can improve accuracy for aerial images and small object detection.
Like the human eye, computer vision models can have a difficult time detecting small objects from far away because it gives us less visual data to do accurate inference on.
The solution is to zoom in! With tiling, we can divide each image into smaller, more manageable tiles in order to zoom in on smaller sections of the image and do more accurate training and inference.
The trick here is to ensure that you are tiling both during training and inference, and that the tiles used are of a similar size. Training using tiling, then attempting to do inference on non-tiled images can result in false positive detections where the model attempts to detect objects of the wrong size.
For example, this is a model trained to detect cars from aerial photos. Tiling was used during training for better accuracy, but not during inference. Notice, the model detects larger shapes than what is needed.
After applying tiling at inference, we get much better accuracy.
How to Tile During Training
To tile during training, use the tiling preprocessing step during training in the Generate section like so:
How to Tile During Inference
Roboflow’s edge docker container now supports passing a tile parameter that will split passed images into smaller tiles.
Adding a tile parameter to your inference call like so: `&tile=500` will split passed images into 500x500px tiles. The tile parameter takes any positive pixel value.
Full inference call code example:
base64 your_img.jpg | curl -d @- "http://localhost:9001/[YOUR MODEL]/[YOUR VERSION]?api_key=[YOUR API KEY]&tile=[YOUR TILE DIMENSIONS]"
Balancing Accuracy vs Performance with Tiling
Tiling can increase accuracy for small object detection and aerial photos. While you might jump straight to tiling your source images into much smaller images, there are some performance considerations and drawbacks to be aware of.
Using too many tiles can result in longer training times, and objects to be detected getting cut in half during the tiling step, which can negatively affect accuracy.
Tiling can also negatively affect inference speed. Since tiling produces a number of smaller images from a larger base image, this can degrade performance if too many tiles are generated. If your performance requirements include high speed inference, tiling may not be a good fit for your use case. Take a look at our deployment guide to help find the right solution for your problem.
If you think tiling could be beneficial for your use case, we recommend generating a number of versions of your trained model with tiling at different sizes to compare accuracy vs performance of each version for best results.