facebookresearch / Detic
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 213 units with 4,162 lines of code in units (54.9% of code).
    • 2 very long units (214 lines of code)
    • 19 long units (1,337 lines of code)
    • 40 medium size units (1,180 lines of code)
    • 60 small units (916 lines of code)
    • 92 very small units (515 lines of code)
5% | 32% | 28% | 22% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 32% | 28% | 22% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
detic/modeling32% | 39% | 0% | 17% | 10%
detic33% | 0% | 27% | 23% | 15%
detic/evaluation0% | 61% | 19% | 11% | 7%
detic/modeling/roi_heads0% | 29% | 38% | 21% | 10%
detic/modeling/meta_arch0% | 36% | 35% | 20% | 8%
detic/data/datasets0% | 68% | 0% | 7% | 23%
detic/data0% | 24% | 42% | 20% | 12%
ROOT0% | 38% | 34% | 26% | 0%
detic/modeling/backbone0% | 13% | 32% | 38% | 15%
tools0% | 55% | 19% | 15% | 9%
detic/data/transforms0% | 0% | 37% | 20% | 41%
detic/modeling/text0% | 0% | 18% | 44% | 37%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def debug_second_stage()
in detic/modeling/debug.py
111 28 9
def add_detic_config()
in detic/config.py
103 12 1
def image_label_losses()
in detic/modeling/roi_heads/detic_fast_rcnn.py
90 26 7
def do_train()
in train_net.py
90 23 3
def evaluate_img_google()
in detic/evaluation/oideval.py
83 28 4
def _derive_coco_results()
in detic/evaluation/custom_coco_eval.py
77 18 4
def accumulate()
in detic/evaluation/oideval.py
77 21 1
def custom_load_lvis_json()
in detic/data/datasets/lvis_v1.py
75 25 3
def __call__()
in detic/data/custom_dataset_mapper.py
73 10 2
def __init__()
in detic/modeling/meta_arch/d2_deformable_detr.py
72 6 2
def _forward_box()
in detic/modeling/roi_heads/detic_roi_heads.py
71 27 8
def __init__()
in detic/modeling/backbone/swintransformer.py
71 12 27
def debug_test()
in detic/modeling/debug.py
70 18 8
def forward()
in detic/modeling/roi_heads/res5_roi_heads.py
70 20 9
def forward()
in detic/modeling/meta_arch/custom_rcnn.py
69 28 3
def __init__()
in detic/evaluation/oideval.py
64 20 6
def debug_train()
in detic/modeling/debug.py
63 10 9
def preprocess()
in tools/preprocess_imagenet22k.py
59 9 0
def load_coco_json_mem_efficient()
in detic/data/datasets/register_oid.py
57 24 4
def _evaluate_predictions_on_oid()
in detic/evaluation/oideval.py
55 7 4