-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Hands-On Computer Vision with Detectron2
By :
Test-time augmentations (TTA) can improve prediction performance by providing different versions of the input image for predictions and performing non-maximum suppression (NMS) on the resulting predictions. Detectron2 provides two classes for this: DatasetMapperTTA and GeneralizedRCNNWithTTA. The DatasetMapperTTA class helps to map a dataset dictionary (a data item in JSON format) into the format expected by Detectron2 models with the opportunity to perform augmentations. The default augmentations used are ResizeShortestEdge and RandomFlip. The GeneralizedRCNNWithTTA class takes the original model and the Mapper object as inputs. It performs predictions on the augmented data and preprocesses the resulting outputs.
Let us use the code approach to explain these two classes. As a routine, we first install Detectron2, load the brain tumors dataset, and register the test dataset. Next, the following code snippet gets a pre-trained model...