aws-samples / amazon-sagemaker-cv
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 1,295 units with 15,801 lines of code in units (69.4% of code).
    • 5 very long units (580 lines of code)
    • 24 long units (1,683 lines of code)
    • 186 medium size units (5,529 lines of code)
    • 300 small units (4,319 lines of code)
    • 780 very small units (3,690 lines of code)
3% | 10% | 34% | 27% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py4% | 10% | 36% | 24% | 24%
cpp0% | 18% | 28% | 50% | 2%
h0% | 0% | 6% | 49% | 44%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow/sagemakercv/data19% | 8% | 43% | 21% | 7%
tensorflow/sagemakercv/detection10% | 27% | 44% | 8% | 8%
pytorch/sagemakercv/core13% | 0% | 25% | 33% | 26%
tensorflow/sagemakercv/core4% | 11% | 47% | 18% | 18%
pytorch/sagemakercv/detection0% | 11% | 38% | 28% | 21%
pytorch/cuda_utils/smcv_utils0% | 14% | 24% | 50% | 11%
tensorflow/sagemakercv/training0% | 14% | 33% | 32% | 18%
pytorch/sagemakercv/training0% | 26% | 33% | 31% | 8%
pytorch/sagemakercv/layers0% | 9% | 35% | 28% | 25%
pytorch/sagemakercv/data0% | 6% | 36% | 25% | 31%
pytorch0% | 51% | 0% | 11% | 36%
pytorch/sagemakercv/utils0% | 0% | 20% | 30% | 48%
tensorflow/sagemakercv/utils0% | 0% | 22% | 25% | 52%
pytorch/cuda_utils0% | 0% | 100% | 0% | 0%
tensorflow/sagemakercv/layers0% | 0% | 52% | 17% | 30%
pytorch/sagemakercv/inference0% | 0% | 42% | 43% | 13%
tensorflow0% | 0% | 0% | 76% | 23%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in tensorflow/sagemakercv/detection/backbones/resnet.py
136 5 8
def __call__()
in pytorch/sagemakercv/core/balanced_positive_negative_sampler.py
117 18 4
def __call__()
in tensorflow/sagemakercv/data/coco/dataloader.py
113 31 2
def selective_crop_and_resize()
in tensorflow/sagemakercv/core/spatial_transform_ops.py
107 16 6
def dataset_parser()
in tensorflow/sagemakercv/data/coco/dataloader_utils.py
107 10 6
def __call__()
in pytorch/sagemakercv/detection/roi_heads/box_head/loss.py
97 19 3
def create_tf_example()
in tensorflow/sagemakercv/data/coco/create_coco_tf_record.py
95 10 6
def forward()
in pytorch/sagemakercv/detection/rpn/inference.py
94 9 6
def __init__()
in tensorflow/sagemakercv/detection/backbones/resnet.py
91 2 8
void pre_calc_for_bilinear_interpolate()
in pytorch/cuda_utils/smcv_utils/cpu/ROIAlign_cpu.cpp
83 11 13
def step()
in pytorch/sagemakercv/training/optimizers/fused_novograd.py
82 26 2
def _resource_apply_dense()
in tensorflow/sagemakercv/training/optimizers/novograd.py
81 10 4
def call()
in tensorflow/sagemakercv/detection/roi_heads/cascade_roi_head.py
80 11 8
void ROIAlignForward_cpu_kernel()
in pytorch/cuda_utils/smcv_utils/cpu/ROIAlign_cpu.cpp
78 10 11
def __init__()
in tensorflow/sagemakercv/detection/backbones/resnet.py
71 2 8
def forward_for_single_feature_map()
in pytorch/sagemakercv/detection/rpn/inference.py
69 18 5
def __call__()
in tensorflow/sagemakercv/training/losses/frcnn_losses.py
68 7 7
def calc_detection_voc_prec_rec()
in pytorch/sagemakercv/data/datasets/evaluation/voc/voc_eval.py
66 12 3
def multilevel_propose_rois()
in tensorflow/sagemakercv/core/roi_ops.py
66 3 10
def generate_detections_per_image_tpu()
in tensorflow/sagemakercv/core/postprocess_ops.py
65 5 11