apple / ml-cvnets
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 667 units with 8,354 lines of code in units (76.6% of code).
    • 3 very long units (429 lines of code)
    • 14 long units (910 lines of code)
    • 98 medium size units (3,061 lines of code)
    • 130 small units (1,852 lines of code)
    • 422 very small units (2,102 lines of code)
5% | 10% | 36% | 22% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py5% | 10% | 36% | 22% | 25%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cvnets8% | 12% | 35% | 18% | 25%
engine12% | 32% | 50% | 0% | 4%
ROOT0% | 44% | 43% | 6% | 4%
data0% | 0% | 36% | 29% | 34%
utils0% | 0% | 41% | 29% | 28%
loss_fn0% | 0% | 21% | 32% | 45%
optim0% | 0% | 21% | 49% | 29%
metrics0% | 0% | 40% | 47% | 12%
options0% | 0% | 40% | 40% | 18%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_configuration()
in cvnets/models/classification/config/mobilevit.py
196 9 1
def run()
in engine/training_engine.py
124 36 2
def get_configuration()
in cvnets/models/classification/config/resnet.py
109 5 1
def main()
in main_train.py
91 21 2
def __init__()
in cvnets/models/classification/mobilenetv2.py
80 6 4
def __init__()
in cvnets/models/detection/ssd.py
80 14 3
def predict_and_save()
in engine/eval_segmentation.py
80 23 8
def __init__()
in cvnets/models/classification/mobilevit.py
64 5 4
def __init__()
in engine/training_engine.py
63 8 15
def __init__()
in cvnets/modules/mobilevit_block.py
62 3 19
def __init__()
in cvnets/models/classification/resnet.py
60 6 4
def predict_and_save()
in engine/eval_detection.py
60 14 5
def train_epoch()
in engine/training_engine.py
60 16 2
def __init__()
in cvnets/layers/conv_layer.py
53 13 14
def __init__()
in cvnets/layers/conv_layer.py
53 14 14
def main_worker()
in main_train.py
53 12 1
def predict_images_in_folder()
in engine/eval_segmentation.py
51 9 2
def profile_model()
in cvnets/models/detection/ssd.py
50 10 2
def predict_images_in_folder()
in engine/eval_detection.py
50 9 2
def main_worker()
in main_eval.py
50 11 1