tensorflow / tfjs-models
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,162 units with 18,237 lines of code in units (56.4% of code).
    • 1 very long units (147 lines of code)
    • 34 long units (2,517 lines of code)
    • 263 medium size units (7,846 lines of code)
    • 304 small units (4,579 lines of code)
    • 560 very small units (3,148 lines of code)
<1% | 13% | 43% | 25% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts<1% | 13% | 42% | 25% | 17%
js0% | 24% | 58% | 8% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
speech-commands8% | 22% | 35% | 21% | 11%
pose-detection0% | 16% | 45% | 21% | 16%
body-segmentation0% | 11% | 47% | 23% | 17%
hand-pose-detection0% | 13% | 42% | 30% | 14%
blazeface0% | 67% | 14% | 15% | 2%
face-landmarks-detection0% | 10% | 41% | 30% | 17%
shared0% | 12% | 41% | 29% | 16%
body-pix0% | 8% | 55% | 19% | 16%
model-playground0% | 70% | 0% | 0% | 29%
handpose0% | 16% | 33% | 27% | 22%
qna0% | 26% | 42% | 12% | 17%
coco-ssd0% | 28% | 35% | 21% | 14%
posenet0% | 0% | 38% | 33% | 27%
tasks0% | 0% | 38% | 34% | 26%
knn-classifier0% | 0% | 41% | 40% | 17%
toxicity0% | 0% | 63% | 16% | 19%
mobilenet0% | 0% | 76% | 20% | 4%
universal-sentence-encoder0% | 0% | 30% | 20% | 49%
deeplab0% | 0% | 23% | 55% | 21%
ROOT0% | 0% | 0% | 58% | 41%
scripts0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
async collectExample()
in speech-commands/src/browser_fft_recognizer.ts
147 21 2
async listen()
in speech-commands/src/browser_fft_recognizer.ts
91 19 2
module.exports = function()
in model-playground/karma-ci.conf.js
90 1 1
async estimatePoses()
in pose-detection/src/blazepose_tfjs/detector.ts
90 14 3
export function createSsdAnchors()
in body-segmentation/src/shared/calculators/create_ssd_anchors.ts
84 18 1
export function createSsdAnchors()
in shared/calculators/create_ssd_anchors.ts
84 18 1
export function createSsdAnchors()
in pose-detection/src/shared/calculators/create_ssd_anchors.ts
84 18 1
export function createSsdAnchors()
in face-landmarks-detection/src/shared/calculators/create_ssd_anchors.ts
84 18 1
export function createSsdAnchors()
in hand-pose-detection/src/shared/calculators/create_ssd_anchors.ts
84 18 1
function decodeBoxes()
in body-segmentation/src/shared/calculators/tensors_to_detections.ts
82 6 3
function decodeBoxes()
in shared/calculators/tensors_to_detections.ts
82 6 3
function decodeBoxes()
in pose-detection/src/shared/calculators/tensors_to_detections.ts
82 6 3
function decodeBoxes()
in face-landmarks-detection/src/shared/calculators/tensors_to_detections.ts
82 6 3
function decodeBoxes()
in hand-pose-detection/src/shared/calculators/tensors_to_detections.ts
82 6 3
async getBoundingBoxes()
in blazeface/src/face.ts
80 7 3
async segmentMultiPerson()
in body-segmentation/src/body_pix/impl/body_pix_model.ts
79 2 2
async segmentMultiPersonParts()
in body-segmentation/src/body_pix/impl/body_pix_model.ts
79 1 2
async estimateFaces()
in blazeface/src/face.ts
79 7 4
async segmentMultiPerson()
in body-pix/src/body_pix_model.ts
79 2 2
async segmentMultiPersonParts()
in body-pix/src/body_pix_model.ts
79 1 2