PaddleDetection

How to integrate W&B with PaddleDetection.

PaddleDetection is an end-to-end object-detection development kit based on PaddlePaddle. It detects various mainstream objects, segments instances, and tracks and detects keypoints using configurable modules such as network components, data augmentations, and losses.

PaddleDetection now includes a built-in W&B integration which logs all your training and validation metrics, as well as your model checkpoints and their corresponding metadata.

The PaddleDetection WandbLogger logs your training and evaluation metrics to Weights & Biases as well as your model checkpoints while training.

Read a W&B blog post which illustrates how to integrate a YOLOX model with PaddleDetection on a subset of the COCO2017 dataset.

Sign up and create an API key

An API key authenticates your machine to W&B. You can generate an API key from your user profile.

  1. Click your user profile icon in the upper right corner.
  2. Select User Settings, then scroll to the API Keys section.
  3. Click Reveal. Copy the displayed API key. To hide the API key, reload the page.

Install the wandb library and log in

To install the wandb library locally and log in:

  1. Set the WANDB_API_KEY environment variable to your API key.

    export WANDB_API_KEY=<your_api_key>
    
  2. Install the wandb library and log in.

    pip install wandb
    
    wandb login
    
pip install wandb
import wandb
wandb.login()
!pip install wandb

import wandb
wandb.login()

Activate the WandbLogger in your training script

To use wandb via arguments to train.py in PaddleDetection:

  • Add the --use_wandb flag
  • The first wandb arguments must be preceded by -o (you only need to pass this once)
  • Each individual wandb argument must contain the prefix wandb- . For example any argument to be passed to wandb.init would get the wandb- prefix
python tools/train.py 
    -c config.yml \ 
    --use_wandb \
    -o \ 
    wandb-project=MyDetector \
    wandb-entity=MyTeam \
    wandb-save_dir=./logs

Add the wandb arguments to the config.yml file under the wandb key:

wandb:
  project: MyProject
  entity: MyTeam
  save_dir: ./logs

When you run your train.py file, it generates a link to your W&B dashboard.

A Weights & Biases Dashboard

Feedback or issues

If you have any feedback or issues about the Weights & Biases integration please open an issue on the PaddleDetection GitHub or email support@wandb.com.


Last modified February 13, 2025: a09c831