awslabs / sagemaker-handwritten-text-recognition
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 87 units with 1,371 lines of code in units (48.5% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (55 lines of code)
    • 20 medium size units (631 lines of code)
    • 33 small units (485 lines of code)
    • 33 very small units (200 lines of code)
0% | 4% | 46% | 35% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 4% | 46% | 35% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sagemaker/src0% | 4% | 49% | 31% | 14%
sagemaker/ground_truth/post-label0% | 0% | 65% | 20% | 13%
deployment/solution-assistant/src0% | 0% | 0% | 88% | 11%
deployment/string-functions/src0% | 0% | 0% | 61% | 38%
sagemaker/ground_truth/pre-label0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run_epoch()
in sagemaker/src/word_and_line_segmentation.py
55 13 7
def generate_output_image()
in sagemaker/src/word_and_line_segmentation.py
48 2 8
def resize_image()
in sagemaker/src/utils.py
46 7 3
def __getitem__()
in sagemaker/src/htr_dataset.py
43 7 2
def run_epoch()
in sagemaker/src/handwriting_line_recognition.py
43 12 7
def lambda_handler()
in sagemaker/ground_truth/post-label/lambda_function.py
38 4 2
def _read_line_annotation()
in sagemaker/src/htr_dataset.py
37 6 2
def run_word_segmentation_net()
in sagemaker/src/run_inference.py
37 4 6
def predict_bounding_boxes()
in sagemaker/src/word_and_line_segmentation.py
36 1 6
def draw_boxes_on_image()
in sagemaker/src/utils.py
32 4 3
def draw_box()
in sagemaker/src/utils.py
29 10 4
def transform()
in sagemaker/src/word_and_line_segmentation.py
27 1 3
def draw_box_on_image()
in sagemaker/src/utils.py
27 2 3
def augment_transform()
in sagemaker/src/word_and_line_segmentation.py
26 3 4
def get_body()
in sagemaker/src/handwriting_line_recognition.py
26 1 2
def _read_word_annotations()
in sagemaker/src/htr_dataset.py
25 2 2
def _read_annotations()
in sagemaker/src/htr_dataset.py
23 8 3
def get_down_sampler()
in sagemaker/src/handwriting_line_recognition.py
23 2 2
def _read_page_annotation()
in sagemaker/src/htr_dataset.py
22 2 2
def transform_bb_after_resize()
in sagemaker/src/utils.py
22 1 4