Using the default trainer
Detectron2 provides a default trainer class, which helps to train Detectron2 models on custom datasets conveniently. First, we download the datasets converted in the previous section and unzip them:
!wget -q https://github.com/PacktPublishing/Hands-On-Computer-Vision-with-Detectron2/raw/main/datasets/braintumors_coco.zip !unzip -q braintumors_coco.zip
Next, install Detectron2 and register the train
/test
datasets using the exact code snippets provided in the previous section. Additionally, before training, run the following code snippet to prepare a logger that Detectron2 uses to log training/inferencing information:
from detectron2.utils.logger import setup_logger logger = setup_logger()
After having the datasets registered and setting up the logger, the next step is getting a training configuration. Precisely, we set the output directory (where we will store the logging events and the trained models), the path to store the configuration file to...