facebookresearch / MaskFormer
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 145 units with 2,121 lines of code in units (28.8% of code).
    • 0 very long units (0 lines of code)
    • 5 long units (357 lines of code)
    • 22 medium size units (726 lines of code)
    • 33 small units (493 lines of code)
    • 85 very small units (545 lines of code)
0% | 16% | 34% | 23% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 16% | 34% | 23% | 25%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tools0% | 63% | 22% | 5% | 8%
mask_former/data0% | 31% | 31% | 24% | 13%
ROOT0% | 41% | 27% | 17% | 13%
mask_former/modeling0% | 0% | 31% | 28% | 40%
mask_former0% | 0% | 83% | 13% | 3%
mask_former/utils0% | 0% | 0% | 56% | 43%
datasets0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in tools/evaluate_pq_for_semantic_segmentation.py
83 13 0
def pq_compute_single_image()
in tools/evaluate_pq_for_semantic_segmentation.py
76 29 4
def __call__()
in mask_former/data/dataset_mappers/mask_former_panoptic_dataset_mapper.py
73 16 2
def build_optimizer()
in train_net.py
68 17 3
def __call__()
in mask_former/data/dataset_mappers/mask_former_semantic_dataset_mapper.py
57 14 2
def add_mask_former_config()
in mask_former/config.py
48 3 1
def __init__()
in mask_former/modeling/backbone/swin.py
48 1 3
def forward()
in mask_former/mask_former_model.py
46 13 2
def build_evaluator()
in train_net.py
45 10 4
def from_config()
in mask_former/mask_former_model.py
44 5 2
def panoptic_inference()
in mask_former/mask_former_model.py
44 8 3
def __call__()
in mask_former/data/dataset_mappers/detr_panoptic_dataset_mapper.py
43 11 2
def forward()
in mask_former/modeling/backbone/swin.py
39 7 4
def forward()
in mask_former/modeling/backbone/swin.py
37 5 3
def load_ade20k_panoptic_json()
in mask_former/data/datasets/register_ade20k_panoptic.py
36 8 5
def do_flop()
in tools/analyze_model.py
31 7 1
def forward()
in mask_former/modeling/backbone/swin.py
31 2 3
def from_config()
in mask_former/data/dataset_mappers/mask_former_semantic_dataset_mapper.py
31 3 3
def memory_efficient_forward()
in mask_former/modeling/matcher.py
28 6 3
def do_activation()
in tools/analyze_model.py
26 4 1