### Install MIM for MMDetection Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/6_benchmarks.md.txt Install the OpenMMLab MIM package, required for running MMDetection benchmarks. ```shell pip install openmim ``` -------------------------------- ### Example config file name Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Example config file name for SwAV with ResNet50, multi-crop, cosine LR, and ImageNet1k data. ```text swav_resnet50_8xb32-mcrop-2-6-coslr-200e_in1k-224-96.py ``` -------------------------------- ### Install Dataset4EO and GBA_Poly repositories Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/README.md Install the two required repositories from the project root using pip editable installs. ```bash pip install -e Dataset4EO pip install -e GBA_Poly ``` -------------------------------- ### MAE Visualization example Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Example invocation of the MAE visualization tool with concrete arguments. ```shell python tools/misc/mae_visualization.py tests/data/color.jpg configs/selfsup/mae/mae_vit-base-p16_8xb512-coslr-400e_in1k.py mae_epoch_400.pth --device 'cuda:0' ``` -------------------------------- ### Example: Train ODC ResNet50 with 8 GPUs Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Example command for training the ODC ResNet50 config with 8 GPUs. Checkpoints and logs are saved in the specified work directory. ```shell # checkpoints and logs saved in WORK_DIR=work_dirs/selfsup/odc/odc_resnet50_8xb64-steplr-440e_in1k/ bash tools/dist_train.sh configs/selfsup/odc/odc_resnet50_8xb64-steplr-440e_in1k.py 8 --work-dir work_dirs/selfsup/odc/odc_resnet50_8xb64-steplr-440e_in1k/ ``` -------------------------------- ### Example: Generate and plot confusion matrix Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example command for generating and plotting a confusion matrix using a specific config, prediction result, and save directory. ```shell python tools/confusion_matrix.py \ configs/fcn/fcn_r50-d8_512x1024_40k_cityscapes.py \ result/pred_result.pkl \ result/confusion_matrix \ --show ``` -------------------------------- ### Example invocation of test_torchserve.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example command using a demo image, an FCN config, a checkpoint, and the model name 'fcn'. ```shell python tools/torchserve/test_torchserve.py \ demo/demo.png \ configs/fcn/fcn_r50-d8_512x1024_40k_cityscapes.py \ checkpoint/fcn_r50-d8_512x1024_40k_cityscapes_20200604_192608-efe53f0d.pth \ fcn ``` -------------------------------- ### Example: Generate prediction result with test.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example command for generating a prediction result .pkl file using a specific config and checkpoint. ```shell python tools/test.py \ configs/fcn/fcn_r50-d8_512x1024_40k_cityscapes.py \ checkpoint/fcn_r50-d8_512x1024_40k_cityscapes_20200604_192608-efe53f0d.pth \ --out result/pred_result.pkl ``` -------------------------------- ### Example: Slurm training ODC ResNet50 Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Example Slurm command for training the ODC ResNet50 config with 8 GPUs per node. ```shell GPUS_PER_NODE=8 GPUS=8 bash tools/slurm_train.sh Dummy Test_job configs/selfsup/odc/odc_resnet50_8xb64-steplr-440e_in1k.py work_dirs/selfsup/odc/odc_resnet50_8xb64-steplr-440e_in1k/ ``` -------------------------------- ### Verify PyTorch and MMSegmentation installations Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Checks that PyTorch and MMSegmentation are correctly installed and prints their versions. ```python import torch, torchvision print(torch.__version__, torch.cuda.is_available()) import mmseg print(mmseg.__version__) ``` -------------------------------- ### Install newest versions of torch and torchdata Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/README.md Run the shell script to install the required dependencies. ```shell sh install_requirements.sh ``` -------------------------------- ### Install required libraries (torch, torchvision, torchdata, mmcv-full, etc.) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/install.md.txt Step 2: install core libraries including PyTorch with CUDA 11.3, torchdata, mmcv-full 1.6.0, prettytable, pycocotools, and wandb. ```shell conda install pytorch torchvision cudatoolkit=11.3 -c pytorch pip install torchdata pip install mmcv-full==1.6.0 pip install prettytable pip install pycocotools pip install wandb ``` -------------------------------- ### Install Dataset4EO Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/README.md Clone the repository and install the package in editable mode. ```shell git clone git@github.com:DeepAI4EO/Dataset4EO.git python -m pip install -e . ``` -------------------------------- ### Install PyTorch, MMCV, and MMSegmentation Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Installs PyTorch 1.12.0 with CUDA 11.3, MMCV via openmim, and clones and installs MMSegmentation from source. ```python !pip install torch==1.12.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu113 !pip install openmim !mim install mmcv-full==1.6.0 ``` ```python !rm -rf mmsegmentation !git clone https://github.com/open-mmlab/mmsegmentation.git %cd mmsegmentation !pip install -e . ``` -------------------------------- ### Annotation file format example Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/1_new_dataset.md.txt Shows the expected format of the annotation file for a customized dataset: each line contains an image filename and a label separated by a space. ```text 000001.jpg 0 000002.jpg 1 ``` -------------------------------- ### Install RSI-Segmentation Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/get_started.md Clones the RSI-Segmentation repository and installs it in editable mode. Required for segmentation tasks. ```shell git clone https://github.com/EarthNets/RSI-Segmentation.git cd RSI-Segmentation pip install -e . ``` -------------------------------- ### Config file modification to use NewDataset Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/1_new_dataset.md.txt Example config snippet that sets up a training pipeline using NewDataset with NewDataSource, num_views, pipelines, and prefetch. ```python train=dict( type='NewDataset', data_source=dict( type='NewDataSource', ), num_views=[2], pipelines=[train_pipeline], prefetch=prefetch, )) ``` -------------------------------- ### Install onnx and onnxruntime-gpu Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Prerequisite for evaluating ONNX models. Installs the onnx and onnxruntime-gpu packages via pip. ```shell pip install onnx onnxruntime-gpu ``` -------------------------------- ### MoCo v2 Training Config Example (mocov2_resnet50_8xb32-coslr-200e_in1k.py) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Shows how to build a training config by inheriting base configs from _base_ folders. The checkpoint_config sets interval and max_keep_ckpts to control checkpoint saving. ```python _base_ = [ '../_base_/models/mocov2.py', # model '../_base_/datasets/imagenet_mocov2.py', # data '../_base_/schedules/sgd_coslr-200e_in1k.py', # training schedule '../_base_/default_runtime.py', # runtime setting ] # Here we inherit runtime settings and modify the max_keep_ckpts. # the max_keep_ckpts controls the max number of ckpt file in your work_dirs # if it is 3, when CheckpointHook (in mmcv) saves the 4th ckpt # it will remove the oldest one to keep the number of total ckpts as 3 checkpoint_config = dict(interval=10, max_keep_ckpts=3) ``` -------------------------------- ### Skip validation at start with start parameter Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/5_runtime.md.txt Sets start=200 to skip evaluation during the first 200 epochs. Evaluation runs after training from the 200th epoch onward. ```python evaluation = dict(interval=1, start=200, metric='accuracy', metric_options={'topk': (1, )}) ``` -------------------------------- ### Example multi-GPU training command Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/train.md Example command for training with 8 GPUs, setting a custom work directory and deterministic mode. Checkpoints and logs are saved in the specified work_dir. ```shell # checkpoints and logs saved in WORK_DIR=work_dirs/pspnet_r50-d8_512x512_80k_ade20k/ # If work_dir is not set, it will be generated automatically. sh tools/dist_train.sh configs/pspnet/pspnet_r50-d8_512x512_80k_ade20k.py 8 --work_dir work_dirs/pspnet_r50-d8_512x512_80k_ade20k/ --deterministic ``` -------------------------------- ### Use EMAHook with interval 100 Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/5_runtime.md.txt Example of using the EMAHook from MMCV with an interval of 100 iterations and HIGH priority. ```python custom_hooks = [ dict(type='EMAHook', interval=100, priority='HIGH') ] ``` -------------------------------- ### Example: train PSPNet with 16 GPUs on Slurm Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/train.md Example command using 16 GPUs to train PSPNet on the dev partition with the specified config and work directory. ```shell GPUS=16 sh tools/slurm_train.sh dev pspr50 configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py work_dirs/pspnet_r50-d8_512x1024_40k_cityscapes/ ``` -------------------------------- ### make_stage_plugins method with docstring example Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/models/backbones/resnet.html Creates plugins for a given ResNet stage. The docstring shows an example plugins format and usage: after defining plugins, call make_stage_plugins(plugins, 0) and assert the result has length 3. ```python [docs] def make_stage_plugins(self, plugins, stage_idx): """make plugins for ResNet 'stage_idx'th stage . Currently we support to insert 'context_block', 'empirical_attention_block', 'nonlocal_block' into the backbone like ResNet/ResNeXt. They could be inserted after conv1/conv2/conv3 of Bottleneck. An example of plugins format could be : >>> plugins=[ ... dict(cfg=dict(type='xxx', arg1='xxx'), ... stages=(False, True, True, True), ... position='after_conv2'), ... dict(cfg=dict(type='yyy'), ... stages=(True, True, True, True), ... position='after_conv3'), ... dict(cfg=dict(type='zzz', postfix='1'), ... stages=(True, True, True, True), ... position='after_conv3'), ... dict(cfg=dict(type='zzz', postfix='2'), ... stages=(True, True, True, True), ... position='after_conv3') ... ] >>> self = ResNet(depth=18) >>> stage_plugins = self.make_stage_plugins(plugins, 0) >>> assert len(stage_plugins) == 3 ``` -------------------------------- ### Equivalent configuration without gradient accumulation Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/tutorials/4_schedule.html Equivalent to the previous gradient accumulation example, using a larger batch size (samples_per_gpu=256) and the standard OptimizerHook. ```python data = dict(samples_per_gpu=256) optimizer_config = dict(type="OptimizerHook") ``` -------------------------------- ### Enable Online Hard Example Mining (OHEM) for PSPNet Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/training_tricks.md Configures the decode head with an OHEMPixelSampler that uses only pixels with confidence below 0.7 and keeps at least 100000 pixels. If thresh is not specified, pixels with top min_kept loss are selected. ```python _base_ = './pspnet_r50-d8_512x1024_40k_cityscapes.py' model=dict( decode_head=dict( sampler=dict(type='OHEMPixelSampler', thresh=0.7, min_kept=100000)) ) ``` -------------------------------- ### Reference fields from base config with {{_base_.num_classes}} Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Refer to variables from the base config to avoid duplication. This example uses `{{_base_.num_classes}}` for `num_classes` in the model head and memory bank, and sets training schedule and checkpoint settings. ```python _base_ = [ '../_base_/models/odc.py', '../_base_/datasets/imagenet_odc.py', '../_base_/schedules/sgd_steplr-200e_in1k.py', '../_base_/default_runtime.py', ] # model settings model = dict( head=dict(num_classes={{_base_.num_classes}}), memory_bank=dict(num_classes={{_base_.num_classes}}), ) # optimizer optimizer = dict( type='SGD', lr=0.06, momentum=0.9, weight_decay=1e-5, paramwise_options={'\Ahead.': dict(momentum=0.)}) # learning policy lr_config = dict(policy='step', step=[400], gamma=0.4) # runtime settings runner = dict(type='EpochBasedRunner', max_epochs=440) # the max_keep_ckpts controls the max number of ckpt file in your work_dirs # if it is 3, when CheckpointHook (in mmcv) saves the 4th ckpt # it will remove the oldest one to keep the number of total ckpts as 3 checkpoint_config = dict(interval=10, max_keep_ckpts=3) ``` -------------------------------- ### PSPNet backbone config with ResNetV1c Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/config.md Base config example for MaskRCNN with ResNetV1c backbone. Shows the structure of norm_cfg and model dict before changing the backbone. ```python norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='MaskRCNN', pretrained='torchvision://resnet50', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=(1, 2, 1, 1), norm_cfg=norm_cfg, norm_eval=False, style='pytorch', contract_dilation=True), decode_head=dict(...), auxiliary_head=dict(...)) ``` -------------------------------- ### Check nvcc and GCC versions Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Verifies the CUDA and GCC toolchain versions before installing PyTorch and MMSegmentation. ```python !nvcc -V !gcc --version ``` -------------------------------- ### Load PSPNet config from file Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Loads the base PSPNet config for Cityscapes using mmcv's Config.fromfile. This is the starting point for modifying the config for a new dataset. ```python from mmcv import Config cfg = Config.fromfile('configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py') ``` -------------------------------- ### Launch ImageNet semi-supervised classification training (distributed and slurm) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/tutorials/6_benchmarks.html Use these bash commands to start semi-supervised classification training on ImageNet. The distributed version runs locally, while the slurm version submits to a cluster. Default GPU number is 4; CONFIG refers to config files under configs/benchmarks/classification/imagenet/ named imagenet_*percent folders, and PRETRAIN is the pre-trained model file. ```bash # distributed version bash tools/benchmarks/classification/dist_train_semi.sh ${CONFIG} ${PRETRAIN} # slurm version bash tools/benchmarks/classification/slurm_train_semi.sh ${PARTITION} ${JOB_NAME} ${CONFIG} ${PRETRAIN} ``` -------------------------------- ### Register NewDataset in datasets/__init__.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/1_new_dataset.md.txt Shows how to add the new Dataset to the package's __init__.py, importing it and including it in __all__. ```python from .base import BaseDataset ... from .new_dataset import NewDataset __all__ = [ 'BaseDataset', ..., 'NewDataset' ] ``` -------------------------------- ### Convert cityscapes PSPNet model to TorchScript Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example command converting a cityscapes PSPNet PyTorch model to TorchScript. Specifies config, checkpoint, output file, and input shape 512x1024. ```shell python tools/pytorch2torchscript.py configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py \ --checkpoint checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth \ --output-file checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pt \ --shape 512 1024 ``` -------------------------------- ### Launch training on first machine with dist_train.sh Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/train.md Run on the first machine to start multi-node training with two nodes. Requires NNODES, NODE_RANK, PORT, MASTER_ADDR environment variables and the config and GPU count. ```shell NNODES=2 NODE_RANK=0 PORT=$MASTER_PORT MASTER_ADDR=$MASTER_ADDR sh tools/dist_train.sh $CONFIG $GPUS ``` -------------------------------- ### Register NewDataSource in data_sources/__init__.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/1_new_dataset.md.txt Shows how to add the new DataSource to the package's __init__.py, importing it and including it in __all__. ```python from .base import BaseDataSource ... from .new_data_source import NewDataSource __all__ = [ 'BaseDataSource', ..., 'NewDataSource' ] ``` -------------------------------- ### Create and activate conda environment Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/install.md.txt Step 1 of the prerequisites: create a conda environment named 'earthnets' and activate it. ```shell conda create --name earthnets -y conda activate earthnets ``` -------------------------------- ### Use PyTorch optimizers like SGD and Adam Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/customize_models.md PyTorch optimizers are supported by changing the optimizer field. Example shows SGD and Adam configurations; Adam may drop performance. ```python optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001) ``` ```python optimizer = dict(type='Adam', lr=0.0003, weight_decay=0.0001) ``` -------------------------------- ### Header customization options in html_theme_options Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/readme.md Example config covering all available header customization options in docs/conf.py. Includes logo_url, a menu list with links and dropdowns, and menu_lang for shared menu language ('en' or 'cn', any other string falls back to 'en'). ```python html_theme_options = { # The target url that the logo directs to. Unset to do nothing 'logo_url': 'https://mmocr.readthedocs.io/en/latest/', # "menu" is a list of dictionaries where you can specify the content and the # behavior of each item in the menu. Each item can either be a link or a # dropdown menu containing a list of links. 'menu': [ # A link { 'name': 'GitHub', 'url': 'https://github.com/open-mmlab/' }, # A dropdown menu { 'name': 'Projects', 'children': [ # A vanilla dropdown item { 'name': 'MMCV', 'url': 'https://github.com/open-mmlab/mmcv', }, # A dropdown item with a description { 'name': 'MMDetection', 'url': 'https://github.com/open-mmlab/mmdetection', 'description': 'Object detection toolbox and benchmark' }, ], # Optional, determining whether this dropdown menu will always be # highlighted. 'active': True, }, ], # For shared menu: If your project is a part of OpenMMLab's project and # you would like to append Docs and OpenMMLab section to the right # of the menu, you can specify menu_lang to choose the language of # shared contents. Available options are 'en' and 'cn'. Any other # strings will fall back to 'en'. 'menu_lang': 'en', } ``` -------------------------------- ### Download PSPNet Cityscapes checkpoint Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Creates a checkpoints directory and downloads the PSPNet R50-D8 pretrained model for Cityscapes. ```python !mkdir checkpoints !wget https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth -P checkpoints ``` -------------------------------- ### Import CustomizedOptim in __init__.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/4_schedule.md.txt Import the custom optimizer and builder in mmselfsup/core/optimizer/__init__.py so it is available for use in configs. ```python from .optimizers import CustomizedOptim from .builder import build_optimizer __all__ = ['CustomizedOptim', 'build_optimizer', ...] ``` -------------------------------- ### Run detection with Detectron2 Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/6_benchmarks.md.txt Commands to run detection benchmarks with Detectron2. Activate the detectron2 environment, convert the pre-trained model to Detectron2 format (output must be .pkl), then run the benchmark script with a detection config and the converted file. ```shell conda activate detectron2 # use detectron2 environment here, otherwise use open-mmlab environment cd benchmarks/detection python convert-pretrain-to-detectron2.py ${WEIGHT_FILE} ${OUTPUT_FILE} # must use .pkl as the output extension. bash run.sh ${DET_CFG} ${OUTPUT_FILE} ``` -------------------------------- ### Initialize the segmentation model Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Builds the model from the config and checkpoint files, using CUDA device 0. ```python model = init_segmentor(config_file, checkpoint_file, device='cuda:0') ``` -------------------------------- ### Prepare PASCAL VOC 2007 with prepare_voc07_cls.sh Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/prepare_data.md.txt Downloads PASCAL VOC 2007 into $YOUR_DATA_ROOT, prepares required files, creates a data folder under $MMSELFSUP, and symlinks VOCdevkit. Run from the MMSelfSup root. ```shell bash tools/data_converters/prepare_voc07_cls.sh $YOUR_DATA_ROOT ``` -------------------------------- ### Implement a New Hook in MMSelfSup Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/5_runtime.md.txt Create a custom hook by registering it with the HOOKS registry and implementing the desired lifecycle methods. ```python from mmcv.runner import HOOKS, Hook @HOOKS.register_module() class MyHook(Hook): def __init__(self, a, b): pass def before_run(self, runner): pass def after_run(self, runner): pass def before_epoch(self, runner): pass def after_epoch(self, runner): pass def before_iter(self, runner): pass def after_iter(self, runner): pass ``` -------------------------------- ### Default runtime settings (default_runtime.py) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Provides default runtime configuration including checkpoint saving every 10 epochs, logging every 50 iterations, distributed training with NCCL backend, and persistent workers in the DataLoader. Includes commented-out Tensorboard logger hook. ```python # checkpoint saving checkpoint_config = dict(interval=10) # The save interval is 10 # yapf:disable log_config = dict( interval=50, # Interval to print the log hooks=[ dict(type='TextLoggerHook'), # The Tensorboard logger is also supported # dict(type='TensorboardLoggerHook'), ]) # yapf:enable # runtime settings dist_params = dict(backend='nccl') # Parameters to setup distributed training, the port can also be set. log_level = 'INFO' # The output level of the log. load_from = None # Runner to load ckpt resume_from = None # Resume checkpoints from a given path, the training will be resumed from the epoch when the checkpoint's is saved. workflow = [('train', 1)] # Workflow for runner. [('train', 1)] means there is only one workflow and the workflow named 'train' is executed once. persistent_workers = True # The boolean type to set persistent_workers in Dataloader. see detail in the documentation of PyTorch ``` -------------------------------- ### ResNet Example Usage Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/models/backbones/resnet.html Shows how to instantiate and run a ResNet model with depth 18, producing output shapes for each stage. The example uses random input of shape (1, 3, 32, 32) and prints the tuple of each level's output shape. ```python >>> from mmseg.models import ResNet >>> import torch >>> self = ResNet(depth=18) >>> self.eval() >>> inputs = torch.rand(1, 3, 32, 32) >>> level_outputs = self.forward(inputs) >>> for level_out in level_outputs: ... print(tuple(level_out.shape)) (1, 64, 8, 8) (1, 128, 4, 4) (1, 256, 2, 2) (1, 512, 1, 1) ``` -------------------------------- ### Set train and validation workflow Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/5_runtime.md.txt Runs training and validation phases iteratively, one epoch each, to check metrics like loss and accuracy. ```python [('train', 1), ('val', 1)] ``` -------------------------------- ### Algorithm information naming pattern Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Pattern for algorithm information in config names, combining algorithm abbreviation and optional misc info. ```text {algorithm}-{misc} ``` -------------------------------- ### Specify SGD optimizer in config Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/customize_runtime.md Example of the default optimizer field in config files. ```python optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001) ``` -------------------------------- ### Import New Hook via __init__.py Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/5_runtime.md.txt Modify mmselfsup/core/hooks/__init__.py to import and export the custom hook. ```python from .my_hook import MyHook __all__ = [..., MyHook, ...] ``` -------------------------------- ### CustomDataset.prepare_test_img Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/datasets/custom.html Builds results dict with img_info, calls pre_pipeline, then applies the pipeline to get test data. ```python img_info = self.img_infos[idx] results = dict(img_info=img_info) self.pre_pipeline(results) return self.pipeline(results) ``` -------------------------------- ### CustomDataset.prepare_train_img Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/datasets/custom.html Builds results dict with img_info and ann_info, calls pre_pipeline, then applies the pipeline to get training data. ```python img_info = self.img_infos[idx] ann_info = self.get_ann_info(idx) results = dict(img_info=img_info, ann_info=ann_info) self.pre_pipeline(results) out_dataset = self.pipeline(results) #print(out_dataset) return out_dataset ``` -------------------------------- ### Download and unzip Stanford Background Dataset Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Downloads the Stanford Background Dataset archive and extracts it. Requires wget and tar commands. ```python # download and unzip !wget http://dags.stanford.edu/data/iccv09Data.tar.gz -O stanford_background.tar.gz !tar xf stanford_background.tar.gz ``` -------------------------------- ### Repeat and concatenate multiple datasets Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/customize_datasets.md Complex example that repeats Dataset_A and Dataset_B by N and M times, respectively, and then concatenates the repeated datasets in the train field. ```python dataset_A_train = dict( type='RepeatDataset', times=N, dataset=dict( type='Dataset_A', ... pipeline=train_pipeline ) ) dataset_A_val = dict( ... pipeline=test_pipeline ) dataset_A_test = dict( ... pipeline=test_pipeline ) dataset_B_train = dict( type='RepeatDataset', times=M, dataset=dict( type='Dataset_B', ... pipeline=train_pipeline ) ) data = dict( imgs_per_gpu=2, workers_per_gpu=2, train = [ dataset_A_train, dataset_B_train ], val = dataset_A_val, test = dataset_A_test ) ``` -------------------------------- ### Concatenate different datasets in data config Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/customize_datasets.md Concatenate different datasets by listing them in the train field of the data config. The example shows dataset_A_train and dataset_B_train. ```python dataset_A_train = dict() dataset_B_train = dict() data = dict( imgs_per_gpu=2, workers_per_gpu=2, train = [ dataset_A_train, dataset_B_train ], val = dataset_A_val, test = dataset_A_test ) ``` -------------------------------- ### Imports and setup for mmseg.apis.test Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/apis/test.html Imports required modules and adds a custom path for LAM_Demo. Includes SaliencyModel utilities and BackProp functions. ```python import os.path as osp import pickle import shutil import tempfile import mmcv import numpy as np import torch import torch.distributed as dist from mmcv.image import tensor2imgs from mmcv.runner import get_dist_info import pdb import cv2, os, sys, matplotlib.pyplot as plt from PIL import Image sys.path.append('/home/xshadow/LAM_Demo') from ModelZoo.utils import load_as_tensor, Tensor2PIL, PIL2Tensor, _add_batch_one from ModelZoo import get_model, load_model, print_network from SaliencyModel.utils import vis_saliency, vis_saliency_kde, click_select_position, grad_abs_norm, grad_norm, prepare_images, make_pil_grid, blend_input from SaliencyModel.utils import cv2_to_pil, pil_to_cv2, gini from SaliencyModel.attributes import attr_grad, attr_id, attr_gabor_generator from SaliencyModel.BackProp import I_gradient, attribution_objective, Path_gradient_GTA from SaliencyModel.BackProp import saliency_map_PG as saliency_map from SaliencyModel.BackProp import GaussianBlurPath, LinearPath, CosinePath from SaliencyModel.utils import grad_norm, IG_baseline, interpolation, isotropic_gaussian_kernel import pdb ``` -------------------------------- ### HRNet Example Usage Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/models/backbones/hrnet.html Shows how to instantiate HRNet with a custom extra configuration and forward a random input, printing the output shapes for each level. ```python >>> from mmseg.models import HRNet >>> import torch >>> extra = dict( >>> stage1=dict( >>> num_modules=1, >>> num_branches=1, >>> block='BOTTLENECK', >>> num_blocks=(4, ), >>> num_channels=(64, )), >>> stage2=dict( >>> num_modules=1, >>> num_branches=2, >>> block='BASIC', >>> num_blocks=(4, 4), >>> num_channels=(32, 64)), >>> stage3=dict( >>> num_modules=4, >>> num_branches=3, >>> block='BASIC', >>> num_blocks=(4, 4, 4), >>> num_channels=(32, 64, 128)), >>> stage4=dict( >>> num_modules=3, >>> num_branches=4, >>> block='BASIC', >>> num_blocks=(4, 4, 4, 4), >>> num_channels=(32, 64, 128, 256))) >>> self = HRNet(extra, in_channels=1) >>> self.eval() >>> inputs = torch.rand(1, 1, 32, 32) >>> level_outputs = self.forward(inputs) >>> for level_out in level_outputs: ... print(tuple(level_out.shape)) (1, 32, 8, 8) (1, 64, 4, 4) (1, 128, 2, 2) (1, 256, 1, 1) ``` -------------------------------- ### Set config and checkpoint file paths Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/demo/rsi_segmentation_tutorial.ipynb Defines the paths to the PSPNet config file and the downloaded checkpoint. ```python config_file = 'configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py' checkpoint_file = 'checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth' ``` -------------------------------- ### Module information naming pattern Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Pattern for module information in config names, including backbone, neck, and head settings. ```text {backbone setting}-{neck setting}-{head_setting} ``` -------------------------------- ### MultiImageMixDataset with Mosaic augmentation Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/customize_datasets.md Use MultiImageMixDataset as a wrapper to mix images from multiple datasets. The example shows a train_pipeline with RandomMosaic and a train_dataset config that includes the inner dataset pipeline. ```python train_pipeline = [ dict(type='RandomMosaic', prob=1), dict(type='Resize', img_scale=(1024, 512), keep_ratio=True), dict(type='RandomFlip', prob=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_semantic_seg']), ] train_dataset = dict( type='MultiImageMixDataset', dataset=dict( classes=classes, palette=palette, type=dataset_type, reduce_zero_label=False, img_dir=data_root + "images/train", ann_dir=data_root + "annotations/train", pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), ] ), pipeline=train_pipeline ) ``` -------------------------------- ### Train with multiple machines (first machine) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Command for the first machine when launching multi-machine training over ethernet. Requires setting NNODES, NODE_RANK, PORT, and MASTER_ADDR. ```shell NNODES=2 NODE_RANK=0 PORT=$MASTER_PORT MASTER_ADDR=$MASTER_ADDR bash tools/dist_train.sh $CONFIG $GPUS ``` -------------------------------- ### Use Dataset4EO with DataLoader2 Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/README.md Example usage: list datasets, create a Landslide4Sense dataset, and iterate a DataLoader2. The dataset is downloaded and decompressed automatically upon creation. ```python from Dataset4EO.datasets import list_datasets, load, landslide4sense from torch.utils.data import DataLoader2 from tqdm import tqdm #list all the supported datasets print(list_datasets()) #create new dataset object by calling: datasets_dir = './' dp = landslide4sense.Landslide4Sense(datasets_dir, split='train') #Then the corresponding dataset will be downloaded and decompressed automatically #create a dataloader by calling: data_loader = DataLoader2(dp.shuffle(), batch_size=4, num_workers=4, shuffle=True, drop_last=True) #Now, iterating the dataloader for training for it in tqdm(data_loader): print(it) ``` -------------------------------- ### get_root_logger(log_file=None, log_level=logging.INFO) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/utils/logger.html Gets the root logger for the mmseg package. The logger is initialized if it has not been, adding a StreamHandler by default and a FileHandler if a log file is specified. ```APIDOC ## get_root_logger(log_file=None, log_level=logging.INFO) ### Description Gets the root logger for the mmseg package. The logger is initialized if it has not been, adding a StreamHandler by default and a FileHandler if a log file is specified. ### Parameters - **log_file** (str | None) - Optional - The log filename. If specified, a FileHandler will be added to the root logger. - **log_level** (int) - Optional - The root logger level. Note that only the process of rank 0 is affected, while other processes will set the level to "Error" and be silent most of the time. ### Returns - **logging.Logger** - The root logger. ``` -------------------------------- ### PSPNet config file with PSPHead Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/tutorials/customize_models.html Example configuration for the PSPNet model using the new PSPHead decode head, including backbone and loss settings. ```python norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='pretrain_model/resnet50_v1c_trick-2cccc1ad.pth', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=(1, 2, 1, 1), norm_cfg=norm_cfg, norm_eval=False, style='pytorch', contract_dilation=True), decode_head=dict( type='PSPHead', in_channels=2048, in_index=3, channels=512, pool_scales=(1, 2, 3, 6), dropout_ratio=0.1, num_classes=19, norm_cfg=norm_cfg, align_corners=False, loss_decode=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0))) ``` -------------------------------- ### Config file naming convention pattern Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Defines the naming convention for config files: algorithm, module, training, and data information separated by underscores. ```text {algorithm}_{module}_{training_info}_{data_info}.py ``` -------------------------------- ### Plot loss metric Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example of plotting the loss metric from a log file using --keys loss and --legend loss. ```shell python tools/analyze_logs.py log.json --keys loss --legend loss ``` -------------------------------- ### Train with Slurm using slurm_train.sh Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Launches training on a Slurm-managed cluster. Requires setting GPUS_PER_NODE, GPUS, SRUN_ARGS, partition, job name, config file, and work directory. ```shell GPUS_PER_NODE=${GPUS_PER_NODE} GPUS=${GPUS} SRUN_ARGS=${SRUN_ARGS} bash tools/slurm_train.sh ${PARTITION} ${JOB_NAME} ${CONFIG_FILE} ${YOUR_WORK_DIR} [optional arguments] ``` -------------------------------- ### Run MMDetection benchmark scripts Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/6_benchmarks.md.txt Commands to run detection benchmarks with MMDetection. Use the distributed version for multi-GPU training and the slurm version for cluster scheduling. Replace ${CONFIG} with a config file under configs/benchmarks/mmdetection/ and ${PRETRAIN} with the pre-trained model file. ```shell # distributed version bash tools/benchmarks/mmdetection/mim_dist_train.sh ${CONFIG} ${PRETRAIN} ${GPUS} # slurm version bash tools/benchmarks/mmdetection/mim_slurm_train.sh ${PARTITION} ${CONFIG} ${PRETRAIN} ``` -------------------------------- ### Imports and resource limit setup Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_modules/mmseg/datasets/builder.html Imports required modules and sets a soft file descriptor limit to 4096 on non-Windows platforms to avoid hitting the hard limit. ```python import copy import platform import random from functools import partial import numpy as np from mmcv.parallel import collate from mmcv.runner import get_dist_info from mmcv.utils import Registry, build_from_cfg from mmcv.utils.parrots_wrapper import DataLoader, PoolDataLoader from torch.utils.data import DistributedSampler if platform.system() != 'Windows': # https://github.com/pytorch/pytorch/issues/973 import resource rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) hard_limit = rlimit[1] soft_limit = min(4096, hard_limit) resource.setrlimit(resource.RLIMIT_NOFILE, (soft_limit, hard_limit)) DATASETS = Registry('dataset') PIPELINES = Registry('pipeline') ``` -------------------------------- ### Train with single/multiple GPUs using dist_train.sh Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/get_started.md.txt Launches distributed training with a config file and number of GPUs. Optional arguments include --resume-from and --deterministic. Checkpoints and logs are saved under work_dirs/. ```shell bash tools/dist_train.sh ${CONFIG_FILE} ${GPUS} --work-dir ${YOUR_WORK_DIR} [optional arguments] ``` -------------------------------- ### Plot mIoU, mAcc, aAcc metrics Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Example of plotting mIoU, mAcc, and aAcc metrics from a log file using --keys and --legend. ```shell python tools/analyze_logs.py log.json --keys mIoU mAcc aAcc --legend mIoU mAcc aAcc ``` -------------------------------- ### Use PyTorch Adam optimizer Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/tutorials/customize_models.md.txt Use any PyTorch optimizer by changing the optimizer field. Example uses Adam with lr=0.0003 and weight_decay=0.0001; note performance may drop. ```python optimizer = dict(type='Adam', lr=0.0003, weight_decay=0.0001) ``` -------------------------------- ### Set Class Balanced Loss for Cityscapes Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/training_tricks.md Changes the loss weight of each class by passing class_weight to CrossEntropyLoss as the weight argument. The example uses the class weights from DeepLab for cityscapes. ```python _base_ = './pspnet_r50-d8_512x1024_40k_cityscapes.py' model=dict( decode_head=dict( loss_decode=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0, # DeepLab used this class weight for cityscapes class_weight=[0.8373, 0.9180, 0.8660, 1.0345, 1.0166, 0.9969, 0.9754, 1.0489, 0.8786, 1.0023, 0.9539, 0.9843, 1.1116, 0.9037, 1.0865, 1.0955, 1.0865, 1.1529, 1.0507]))) ``` -------------------------------- ### Checkpoint naming convention pattern Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/tutorials/0_config.md.txt Pattern for checkpoint file names, including config name, date, and hash. ```text {config_name}_{date}-{hash}.pth ``` -------------------------------- ### Option 1: Set different ports in config files Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/train.md.txt When starting multiple tasks on a node, specify different ports in each config file. Launch two jobs with config1.py and config2.py. ```python dist_params = dict(backend='nccl', port=29500) ``` ```python dist_params = dict(backend='nccl', port=29501) ``` ```shell CUDA_VISIBLE_DEVICES=0,1,2,3 GPUS=4 sh tools/slurm_train.sh ${PARTITION} ${JOB_NAME} config1.py tmp_work_dir_1 CUDA_VISIBLE_DEVICES=4,5,6,7 GPUS=4 sh tools/slurm_train.sh ${PARTITION} ${JOB_NAME} config2.py tmp_work_dir_2 ``` -------------------------------- ### Recommended data directory structure for MMSelfSup Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/_build/html/_sources/prepare_data.md.txt Shows the recommended folder layout under $MMSELFSUP/data for supported datasets (ImageNet, Places205, iNaturalist2018, PASCAL VOC, CIFAR10). Symlink your dataset root to $MMSELFSUP/data; adjust config paths if your structure differs. ```text mmselfsup ├── mmselfsup ├── tools ├── configs ├── docs ├── data │ ├── imagenet │ │ ├── meta │ │ ├── train │ │ ├── val │ ├── places205 │ │ ├── meta │ │ ├── train │ │ ├── val │ ├── inaturalist2018 │ │ ├── meta │ │ ├── train │ │ ├── val │ ├── VOCdevkit │ │ ├── VOC2007 │ ├── cifar │ │ ├── cifar-10-batches-py ``` -------------------------------- ### Train with a single GPU (experimental support) Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/train.md Use this command for single GPU training without distributed setup. It converts SyncBN to BN. Replace ${CONFIG_FILE} with your config file path. ```shell python tools/train.py ${CONFIG_FILE} [optional arguments] ``` -------------------------------- ### Run tools/deploy_test.py to evaluate ONNX model Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/GBA_Poly/docs/en/_build/html/_sources/useful_tools.md.txt Command-line usage for tools/deploy_test.py. Requires CONFIG_FILE, MODEL_FILE, and BACKEND (onnxruntime or tensorrt). Optional flags include --out, --eval, --show, --show-dir, --cfg-options, --eval-options, and --opacity. Note that --format-only and --eval are mutually exclusive. ```bash python tools/deploy_test.py \ ${CONFIG_FILE} \ ${MODEL_FILE} \ ${BACKEND} \ --out ${OUTPUT_FILE} \ --eval ${EVALUATION_METRICS} \ --show \ --show-dir ${SHOW_DIRECTORY} \ --cfg-options ${CFG_OPTIONS} \ --eval-options ${EVALUATION_OPTIONS} \ --opacity ${OPACITY} \ ``` -------------------------------- ### Run main.py with input list and processes flag Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/make_lod1/README.md Executes the main processing script. Use --input_file to specify a text file listing GeoJSON paths, and --processes to set parallel processes; 0 uses all available GPU cores. ```bash python main.py --input_file /path/to/input_list.txt --processes 0 ``` -------------------------------- ### Config file naming convention Source: https://github.com/zhu-xlab/globalbuildingatlas/blob/main/im2bf/Dataset4EO/docs/en/tutorials/config.md Follow this naming style for config files: {model}_{backbone}_[misc]_[gpu x batch_per_gpu]_{resolution}_{iterations}_{dataset}. Required fields are in braces, optional in brackets. ```default {model}_{backbone}_[misc]_[gpu x batch_per_gpu]_{resolution}_{iterations}_{dataset} ```