microsoft / SpeciesClassification
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 265 units with 4,491 lines of code in units (77.4% of code).
    • 6 very long units (831 lines of code)
    • 13 long units (859 lines of code)
    • 38 medium size units (1,167 lines of code)
    • 58 small units (888 lines of code)
    • 150 very small units (746 lines of code)
18% | 19% | 25% | 19% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py18% | 19% | 25% | 19% | 16%
pyx0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
PyTorchClassification37% | 20% | 16% | 13% | 12%
FasterRCNNDetection26% | 36% | 5% | 21% | 9%
misc0% | 47% | 51% | 0% | 1%
FasterRCNNDetection/utils0% | 29% | 27% | 0% | 43%
FasterRCNNDetection/model0% | 8% | 33% | 40% | 17%
FasterRCNNDetection/misc0% | 73% | 0% | 26% | 0%
FasterRCNNDetection/data0% | 0% | 47% | 29% | 23%
PyTorchClassification/pretrained0% | 0% | 31% | 39% | 29%
PyTorchClassification/snakes0% | 0% | 80% | 0% | 19%
DetectionClassificationAPI0% | 0% | 45% | 25% | 30%
ROOT0% | 0% | 45% | 33% | 21%
PyTorchClassification/imagenet-nonanimal-test0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in PyTorchClassification/train.py
279 58 0
def __init__()
in PyTorchClassification/data_loader.py
119 44 11
def main()
in PyTorchClassification/run_training.py
117 11 0
def train()
in FasterRCNNDetection/train.py
108 20 1
def main()
in PyTorchClassification/run_snakes_training.py
105 9 0
def init()
in PyTorchClassification/models.py
103 23 5
def forward()
in FasterRCNNDetection/trainer.py
93 12 5
def __init__()
in PyTorchClassification/data_loader_cv.py
85 39 10
def calc_detection_voc_prec_rec()
in FasterRCNNDetection/utils/eval_tool.py
79 21 7
def main()
in PyTorchClassification/run_serengeti_training.py
74 9 0
def train()
in PyTorchClassification/train.py
72 12 6
def add_new_categories()
in misc/convert_folders_to_coco_format.py
65 30 5
def add_new_categories()
in misc/make_species_extended.py
65 30 5
def eval()
in FasterRCNNDetection/train.py
60 15 6
def main()
in PyTorchClassification/onnx_export.py
55 6 0
def validate()
in PyTorchClassification/train.py
54 9 6
def predict()
in FasterRCNNDetection/model/faster_rcnn.py
53 5 4
def main()
in PyTorchClassification/run_cct_training.py
53 9 0
def train()
in FasterRCNNDetection/misc/train_fast.py
51 7 1
def process_image()
in PyTorchClassification/data_loader.py
50 10 6