The TFA (Two-stage Fine-tuning Approach) configuration is a comprehensive dictionary-based structure used to define a complete few-shot detection system. It is organized into several key top-level components:
train_pipeline / test_pipeline: Lists of data augmentation and preprocessing steps (e.g., LoadImageFromFile, Resize, Normalize, RandomFlip).data: Defines dataset settings for train, val, and test, including dataset type, ann_cfg (annotation configuration), img_prefix, and pipeline.model: The core architecture definition, including backbone (e.g., ResNet), neck (e.g., FPN), rpn_head, and roi_head.optimizer & lr_config: Settings for the optimization algorithm (e.g., SGD) and learning rate scheduling (e.g., step or cosine).runner: Defines the training loop type (e.g., IterBasedRunner) and total iterations.evaluation: Specifies how the model is evaluated (e.g., metric='bbox') and which class splits to use (class_splits=['BASE_CLASSES', 'NOVEL_CLASSES']).
# Example of the top-level structure
train_pipeline = [dict(type='LoadImageFromFile'), ...]
test_pipeline = [dict(type='LoadImageFromFile'), ...]
data = dict(
train=dict(type='FewShotCocoDefaultDataset', pipeline=train_pipeline, ...),
val=dict(type='FewShotCocoDataset', pipeline=test_pipeline, ...),
test=dict(type='FewShotCocoDataset', pipeline=test_pipeline, ...)
)
model = dict(
type='TFA',
backbone=dict(type='ResNet', depth=101, ...),
neck=dict(type='FPN', ...),
rpn_head=dict(type='RPNHead', ...),
roi_head=dict(type='StandardRoIHead', ...)
)
optimizer = dict(type='SGD', lr=0.001, ...)
lr_config = dict(policy='step', ...)
runner = dict(type='IterBasedRunner', max_iters=160000)