Repository Analysis

ultralytics/yolov5

Ultralytics YOLOv5 in PyTorch > ONNX > CoreML > TFLite

17.3 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of ultralytics/yolov5, a Python project with 57,678 GitHub stars. SynthScan v2.0 examined 25,874 lines of code across 131 source files, recording 229 pattern matches distributed across 15 syntactic categories. The overall adjusted score of 17.3 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

17.3
Adjusted Score
17.3
Raw Score
100%
Time Factor
2026-07-12
Last Push
57.7K
Stars
Python
Language
25.9K
Lines of Code
131
Files
229
Pattern Hits
2026-07-14
Scan Date
0.38
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 1HIGH 49MEDIUM 5LOW 174

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 229 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Docstring Block Structure48 hits · 240 pts
SeverityFileLineSnippetContext
HIGHval.py67Saves a single JSON detection result, including image ID, category ID, bounding box, and confidence score. Args: STRING
HIGHval.py396Parse command-line options for configuring YOLOv5 model inference. Args: data (str, optional): Path to the STRING
HIGHval.py474Executes YOLOv5 tasks like training, validation, testing, speed, and study benchmarks based on provided options. ArSTRING
HIGHexport.py97Initializes an iOS compatible model with normalization based on image dimensions. Args: model (torcSTRING
HIGHexport.py123Run a forward pass on the input tensor, returning class confidences and normalized coordinates. Args: STRING
HIGHexport.py144Returns a DataFrame of supported YOLOv5 model export formats and their properties. Returns: pandas.DataFramSTRING
HIGHexport.py183Log success or failure, execution time, and file size for YOLOv5 model export functions wrapped with @try_export. ASTRING
HIGHexport.py226Export a YOLOv5 model to the TorchScript format. Args: model (torch.nn.Module): The YOLOv5 model to be expoSTRING
HIGHexport.py281Export a YOLOv5 model to ONNX format with dynamic axes support and optional model simplification. Args: modSTRING
HIGHexport.py380Export a YOLOv5 model to OpenVINO format with optional FP16 and INT8 quantization. Args: file (Path): Path STRING
HIGHexport.py464Export a YOLOv5 PyTorch model to PaddlePaddle format using X2Paddle, saving the converted model and metadata. Args:STRING
HIGHexport.py512Export a YOLOv5 model to CoreML format with optional NMS, INT8, and FP16 support. Args: model (torch.nn.ModSTRING
HIGHexport.py584Export a YOLOv5 model to TensorRT engine format, requiring GPU and TensorRT>=7.0.0. Args: model (torch.nn.MSTRING
HIGHexport.py703Export a YOLOv5 model to the TensorFlow SavedModel format, supporting dynamic axes and non-maximum suppression (NMS)STRING
HIGHexport.py786Export YOLOv5 model to TensorFlow GraphDef (*.pb) format. Args: keras_model (tf.keras.Model): The Keras modSTRING
HIGHexport.py826Export a YOLOv5 model to TensorFlow Lite format with optional INT8 quantization and NMS support. Args: keraSTRING
HIGHexport.py899Exports a YOLOv5 model to Edge TPU compatible TFLite format; requires Linux and Edge TPU compiler. Args: fiSTRING
HIGHexport.py981Convert a YOLOv5 model to TensorFlow.js format with optional uint8 quantization. Args: file (Path): Path toSTRING
HIGHexport.py1042Adds metadata to a TensorFlow Lite (TFLite) model file, supporting multiple outputs according to TensorFlow guidelinSTRING
HIGHexport.py1103Convert a PyTorch YOLOv5 model to CoreML format with Non-Maximum Suppression (NMS), handling different input/output STRING
HIGHexport.py1302Exports a YOLOv5 model to specified formats including ONNX, TensorRT, CoreML, and TensorFlow. Args: data (sSTRING
HIGHexport.py1482Parse command-line options for YOLOv5 model export configurations. Args: known (bool): If True, uses `argpaSTRING
HIGHtrain.py107Train a YOLOv5 model on a custom dataset using specified hyperparameters, options, and device, managing datasets, moSTRING
HIGHtrain.py548Parse command-line arguments for YOLOv5 training, validation, and testing. Args: known (bool, optional): IfSTRING
HIGHtrain.py622Runs the main entry point for training or hyperparameter evolution with specified options and optional callbacks. ASTRING
HIGHtrain.py894Generate an individual with random hyperparameters within specified ranges. Args: input_ranges (list[tuple[STRING
HIGHtrain.py924Execute YOLOv5 training with specified options, allowing optional overrides through keyword arguments. Args: STRING
HIGHhubconf.py17Creates or loads a YOLOv5 model, with options for pretrained weights and model customization. Args: name (sSTRING
HIGHhubconf.py107Loads a custom or local YOLOv5 model from a given path with optional autoshaping and device specification. Args: STRING
HIGHhubconf.py138Instantiates the YOLOv5-nano model with options for pretraining, input channels, class count, autoshaping, verbositySTRING
HIGHhubconf.py174Create a YOLOv5-small (yolov5s) model with options for pretraining, input channels, class count, autoshaping, verbosSTRING
HIGHhubconf.py215Instantiates the YOLOv5-medium model with customizable pretraining, channel count, class count, autoshaping, verbosiSTRING
HIGHhubconf.py248Creates YOLOv5-large model with options for pretraining, channels, classes, autoshaping, verbosity, and device selecSTRING
HIGHhubconf.py278Create the YOLOv5-xlarge model with options for pretraining, input channels, class count, autoshaping, verbosity, anSTRING
HIGHhubconf.py308Creates YOLOv5-nano-P6 model with options for pretraining, channels, classes, autoshaping, verbosity, and device. ASTRING
HIGHhubconf.py335Instantiate the YOLOv5-small-P6 model with options for pretraining, input channels, number of classes, autoshaping, STRING
HIGHhubconf.py372Create YOLOv5-medium-P6 model with options for pretraining, channel count, class count, autoshaping, verbosity, and STRING
HIGHhubconf.py406Instantiate the YOLOv5-large-P6 model with options for pretraining, channel and class counts, autoshaping, verbositySTRING
HIGHhubconf.py438Creates the YOLOv5-xlarge-P6 model with options for pretraining, number of input channels, class count, autoshaping,STRING
HIGHdetect.py102Runs YOLOv5 detection inference on various sources like images, videos, directories, streams, etc. Args: weSTRING
HIGHdetect.py331Parse command-line arguments for YOLOv5 detection, allowing custom inference options and model configurations. ArgsSTRING
HIGHdetect.py417Executes YOLOv5 model inference based on provided command-line arguments, validating dependencies before running. ASTRING
HIGHbenchmarks.py63Run YOLOv5 benchmarks on multiple export formats and log results for model performance evaluation. Args: weSTRING
HIGHbenchmarks.py159Run YOLOv5 export tests for all supported formats and log the results, including export statuses. Args: weiSTRING
HIGHbenchmarks.py217Parses command-line arguments for YOLOv5 model inference configuration. Args: weights (str): The path to thSTRING
HIGHbenchmarks.py255Executes YOLOv5 benchmark tests or main training/inference routines based on the provided command-line arguments. ASTRING
HIGHutils/metrics.py337Returns the intersection over box2 area given box1, box2. Args: box1: np.array of shape(4) box2: npSTRING
HIGHutils/autoanchor.py69Creates kmeans-evolved anchors from training dataset. Args: dataset: path to data.yaml, or a loaded datasetSTRING
Excessive Try-Catch Wrapping44 hits · 44 pts
SeverityFileLineSnippetContext
LOWval.py381 except Exception as e:CODE
LOWexport.py217 except Exception as e:CODE
LOWexport.py373 except Exception as e:CODE
LOWexport.py620 except Exception:CODE
LOWexport.py739 except Exception:CODE
LOWhubconf.py84 except Exception:CODE
LOWhubconf.py100 except Exception as e:CODE
LOWbenchmarks.py127 except Exception as e:CODE
LOWbenchmarks.py204 except Exception:CODE
LOWsegment/val.py389 except Exception as e:CODE
LOWtests/test_invariant_export.py103 except Exception:CODE
LOWutils/autobatch.py53 except Exception as e:CODE
LOWutils/dataloaders.py583 except Exception as e:CODE
LOWutils/dataloaders.py593 except Exception:CODE
LOWutils/dataloaders.py749 except Exception as e:CODE
LOWutils/dataloaders.py1028 except Exception as e:CODE
LOWutils/dataloaders.py1059 except Exception as e:CODE
LOWutils/dataloaders.py1101 except Exception as e: # use OpenCVCODE
LOWutils/downloads.py66 except Exception as e: # url2CODE
LOWutils/downloads.py108 except Exception:CODE
LOWutils/downloads.py111 except Exception:CODE
LOWutils/downloads.py114 except Exception:CODE
LOWutils/plots.py380 except Exception as e:CODE
LOWutils/autoanchor.py142 except Exception:CODE
LOWutils/torch_utils.py170 except Exception:CODE
LOWutils/torch_utils.py181 except Exception: # no backward methodCODE
LOWutils/torch_utils.py191 except Exception as e:CODE
LOWutils/torch_utils.py298 except Exception:CODE
LOWutils/general.py286 except Exception:CODE
LOWutils/general.py373 except Exception as e:CODE
LOWutils/general.py517 except Exception:CODE
LOWutils/general.py1035 except Exception:CODE
LOWutils/augmentations.py51 except Exception as e:CODE
LOWutils/augmentations.py293 except Exception as e:CODE
LOWutils/loggers/__init__.py466 except Exception as e:CODE
LOWutils/loggers/comet/comet_utils.py64 except Exception as e:CODE
LOWutils/segment/plots.py146 except Exception as e:CODE
LOWutils/flask_rest_api/restapi.py55 except Exception:CODE
LOWmodels/yolo.py494 except Exception as e:CODE
MEDIUMmodels/yolo.py495 print(f"Error in {cfg}: {e}")CODE
LOW.github/workflows/merge-main-into-prs.yml74 except Exception as update_error:CODE
LOW.github/workflows/merge-main-into-prs.yml80 except Exception as e:CODE
LOWdata/Objects365.yaml439 except Exception as e:CODE
LOWdata/xView.yaml137 except Exception as e:CODE
Deep Nesting41 hits · 41 pts
SeverityFileLineSnippetContext
LOWval.py113CODE
LOWval.py473CODE
LOWtrain.py106CODE
LOWtrain.py621CODE
LOWhubconf.py16CODE
LOWdetect.py71CODE
LOWclassify/val.py53CODE
LOWclassify/predict.py68CODE
LOWclassify/train.py79CODE
LOWsegment/val.py105CODE
LOWsegment/val.py436CODE
LOWsegment/predict.py70CODE
LOWsegment/train.py101CODE
LOWsegment/train.py593CODE
LOWutils/metrics.py224CODE
LOWutils/dataloaders.py983CODE
LOWutils/dataloaders.py320CODE
LOWutils/dataloaders.py535CODE
LOWutils/dataloaders.py859CODE
LOWutils/downloads.py80CODE
LOWutils/plots.py135CODE
LOWutils/torch_utils.py72CODE
LOWutils/torch_utils.py144CODE
LOWutils/torch_utils.py208CODE
LOWutils/torch_utils.py305CODE
LOWutils/general.py395CODE
LOWutils/general.py435CODE
LOWutils/general.py560CODE
LOWutils/general.py563CODE
LOWutils/augmentations.py248CODE
LOWutils/segment/dataloaders.py235CODE
LOWutils/segment/loss.py48CODE
LOWutils/segment/plots.py20CODE
LOWutils/segment/plots.py116CODE
LOWutils/segment/general.py132CODE
LOWmodels/tf.py504CODE
LOWmodels/common.py458CODE
LOWmodels/common.py692CODE
LOWmodels/common.py887CODE
LOWmodels/common.py978CODE
LOWmodels/yolo.py380CODE
Redundant / Tautological Comments17 hits · 26 pts
SeverityFileLineSnippetContext
LOWval.py334 # Print resultsCOMMENT
LOWval.py340 # Print results per classCOMMENT
LOWdetect.py253 # Print resultsCOMMENT
LOWdetect.py318 # Print resultsCOMMENT
LOWbenchmarks.py135 # Print resultsCOMMENT
LOWbenchmarks.py207 # Print resultsCOMMENT
LOWclassify/val.py141 # Print resultsCOMMENT
LOWclassify/predict.py153 # Print resultsCOMMENT
LOWclassify/predict.py197 # Print resultsCOMMENT
LOWsegment/val.py341 # Print resultsCOMMENT
LOWsegment/val.py347 # Print results per classCOMMENT
LOWsegment/predict.py183 # Print resultsCOMMENT
LOWsegment/predict.py247 # Print resultsCOMMENT
LOWutils/loggers/comet/__init__.py163 # Check if running the Experiment with the Comet OptimizerCOMMENT
LOWutils/loggers/comet/__init__.py454 # Check if running Experiment with Comet OptimizerCOMMENT
LOWutils/loggers/clearml/clearml_utils.py146 # Set data to data_dict because wandb will crash without this information and opt is the best wayCOMMENT
LOW.github/workflows/merge-main-into-prs.yml62 # Check if PR is behind the default branchCOMMENT
Over-Commented Block23 hits · 23 pts
SeverityFileLineSnippetContext
LOWrequirements.txt21# Logging ---------------------------------------------------------------------COMMENT
LOWrequirements.txt41packaging # Migration of deprecated pkg_resources packagesCOMMENT
LOWpyproject.toml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWutils/autoanchor.py141 assert n == len(k) # kmeans may return fewer points than requested if wh is insufficient or too similarCOMMENT
LOWmodels/common.py461 # TorchScript: *.torchscriptCOMMENT
LOWdata/ImageNet1000.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/coco128.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/coco.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/coco128-seg.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/GlobalWheat2020.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/VisDrone.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/SKU-110K.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/Objects365.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/ImageNet10.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/xView.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/ImageNet100.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/Argoverse.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/ImageNet.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/VOC.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/hyps/hyp.VOC.yaml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWdata/scripts/get_imagenet1000.sh1#!/bin/bashCOMMENT
LOWdata/scripts/get_imagenet100.sh1#!/bin/bashCOMMENT
LOWdata/scripts/get_imagenet10.sh1#!/bin/bashCOMMENT
Hyper-Verbose Identifiers18 hits · 20 pts
SeverityFileLineSnippetContext
LOWtests/test_invariant_export.py21def test_shell_injection_via_model_path(malicious_path):CODE
LOWtests/test_invariant_export.py39def test_export_edgetpu_no_shell_true():CODE
LOWtests/test_flask_rest_api.py57def test_rejects_non_image_upload_with_allowed_extension(client):CODE
LOWtests/test_flask_rest_api.py63def test_rejects_upload_with_disallowed_extension(client):CODE
LOWtests/test_flask_rest_api.py69def test_rejects_oversized_upload(client):CODE
LOWtests/test_flask_rest_api.py75def test_accepts_valid_image_upload(client):CODE
LOWtests/test_invariant_common.py42def test_ssrf_redirect_target_is_validated(monkeypatch):CODE
LOWtests/test_invariant_common.py72def test_scale_image_many_masks():CODE
LOWtests/test_invariant_common.py83def test_tensorrt_deserialize_failure_reports_environment(monkeypatch, tmp_path):CODE
LOWutils/triton.py36 def create_input_placeholders() -> list[InferInput]:CODE
LOWutils/dataloaders.py1201def create_classification_dataloader(CODE
LOWutils/torch_utils.py72def reshape_classifier_output(model, n=1000):CODE
LOWutils/torch_utils.py96def torch_distributed_zero_first(local_rank: int):CODE
LOWutils/loggers/__init__.py175 def on_pretrain_routine_start(self):CODE
LOWutils/loggers/comet/__init__.py369 def download_dataset_artifact(self, artifact_path):CODE
LOWutils/loggers/comet/comet_utils.py21def download_model_checkpoint(opt, experiment):CODE
LOWutils/segment/metrics.py17def ap_per_class_box_and_mask(CODE
LOWmodels/tf.py707def representative_dataset_gen(dataset, ncalib=100):CODE
AI Structural Patterns18 hits · 17 pts
SeverityFileLineSnippetContext
LOWval.py113CODE
LOWexport.py689CODE
LOWexport.py1275CODE
LOWdetect.py71CODE
LOWbenchmarks.py52CODE
LOWbenchmarks.py148CODE
LOWclassify/val.py53CODE
LOWclassify/predict.py68CODE
LOWsegment/val.py105CODE
LOWsegment/predict.py70CODE
LOWutils/dataloaders.py158CODE
LOWutils/dataloaders.py535CODE
LOWutils/general.py785CODE
LOWutils/augmentations.py118CODE
LOWutils/augmentations.py248CODE
LOWutils/segment/dataloaders.py21CODE
LOWutils/segment/dataloaders.py89CODE
LOWutils/segment/augmentations.py26CODE
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippetContext
CRITICALexport.py1253 pipeline.spec.description.metadata.userDefined.update(CODE
Unused Imports9 hits · 9 pts
SeverityFileLineSnippetContext
LOWutils/triton.py4CODE
LOWutils/__init__.py6CODE
LOWutils/torch_utils.py16CODE
LOWutils/general.py4CODE
LOWutils/general.py45CODE
LOWutils/general.py46CODE
LOWutils/general.py49CODE
LOWutils/general.py49CODE
LOWutils/general.py52CODE
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMtrain.py853 # Create the next generation through crossover and mutationCOMMENT
MEDIUMdetect.py190 # Define the path for the CSV fileCOMMENT
AI Slop Vocabulary2 hits · 4 pts
SeverityFileLineSnippetContext
MEDIUMpyproject.toml14# For comprehensive documentation and usage instructions, visit: https://docs.ultralytics.com/yolov5/COMMENT
MEDIUMmodels/common.py851 """AutoShape class for robust YOLOv5 inference with preprocessing, NMS, and support for various input formats."""STRING
Modern Structural Boilerplate3 hits · 3 pts
SeverityFileLineSnippetContext
LOWutils/loggers/comet/__init__.py10logger = logging.getLogger(__name__)CODE
LOWutils/loggers/comet/comet_utils.py14logger = logging.getLogger(__name__)CODE
LOWutils/loggers/comet/hpo.py12logger = logging.getLogger(__name__)CODE
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWutils/autobatch.py21 # Usage:COMMENT
TODO Padding1 hit · 2 pts
SeverityFileLineSnippetContext
LOWutils/augmentations.py275 # TODO: implement AugMix, AutoAug & RandAug in albumentationCOMMENT
Cross-Language Confusion1 hit · 1 pts
SeverityFileLineSnippetContext
HIGHexport.py41 $ cd .. && git clone https://github.com/zldrobit/tfjs-yolov5-example.git && cd tfjs-yolov5-exampleSTRING