Shortcuts

Dataset Visualization

Introduce the dataset visualization tool

python tools/visualization/browse_dataset.py \
    ${CONFIG_FILE} \
    [-o, --output-dir ${OUTPUT_DIR}] \
    [-p, --phase ${DATASET_PHASE}] \
    [-n, --show-number ${NUMBER_IMAGES_DISPLAY}] \
    [-i, --show-interval ${SHOW_INTERRVAL}] \
    [-m, --mode ${DISPLAY_MODE}] \
    [-r, --rescale-factor ${RESCALE_FACTOR}] \
    [-c, --channel-order ${CHANNEL_ORDER}] \
    [--cfg-options ${CFG_OPTIONS}]

Description of all arguments

  • config : The path of a model config file.

  • -o, --output-dir: The output path for visualized images. If not specified, it will be set to '', which means not to save.

  • -p, --phase: Phase of visualizing dataset,must be one of ['train', 'val', 'test']. If not specified, it will be set to 'train'.

  • -n, --show-number: The number of samples to visualized. If not specified, display all images in the dataset.

  • --show-interval: The interval of show (s).

  • -m, --mode: The display mode, can be one of ['original', 'transformed', 'concat', 'pipeline']. If not specified, it will be set to 'transformed'.

  • -r, --rescale-factor: The image rescale factor, which is useful if the output is too large or too small in the original mode.

  • -c, --channel-order: The channel of the showing images, could be “BGR” or “RGB”, If not specified, it will be set to ‘BGR’.

  • --cfg-options : Modifications to the configuration file, refer to Learn about Configs.

Note

  1. The -m, --mode is about display mode, display original pictures or transformed pictures or comparison pictures:

  • “original” means show images load from disk;

  • “transformed” means to show images after transformed;

  • “concat” means show images stitched by “original” and “transformed” images;

  • “pipeline” means show all the intermediate images throghout the pipeline.

  1. The -r, --rescale-factor option is set when the label information is too large or too small relative to the picture. For example, when visualizing the CIFAR dataset, since the resolution of the image is very small, --rescale-factor can be set to 10.

How to visualize the original image

In ‘original’ mode:

python ./tools/visualization/browse_dataset.py ./configs/resnet/resnet101_8xb16_cifar10.py --phase val --output-dir tmp --mode original --show-number 100 --rescale-factor 10 --channel-order RGB
  • --phase val: Visual validation set, can be simplified to -p val;

  • --output-dir tmp: The visualization results are saved in the “tmp” folder, can be simplified to -o tmp;

  • --mode original: Visualize the original image, can be simplified to -m original;

  • --show-number 100: visualize 100 images, can be simplified to -n 100;

  • --rescale-factor: the image is enlarged by 10 times, can be simplified to -r 10;

  • --channel-order RGB: The channel order of the visualized image is “RGB”, can be simplified to -c RGB.

How to visualize the transformed images

In ‘transformed’ mode:

python ./tools/visualization/browse_dataset.py ./configs/resnet/resnet50_8xb32_in1k.py -n 100

How to visualize the transformed images and original images together

In ‘concat’ mode:

python ./tools/visualization/browse_dataset.py configs/swin_transformer/swin-small_16xb64_in1k.py -n 10 -m concat
  1. In ‘pipeline’ mode:

python ./tools/visualization/browse_dataset.py configs/swin_transformer/swin-small_16xb64_in1k.py -m pipeline
python ./tools/visualization/browse_dataset.py configs/beit/beit_beit-base-p16_8xb256-amp-coslr-300e_in1k.py -m pipeline
Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.