Repository Analysis

ultralytics/yolov5

Ultralytics YOLOv5 in PyTorch for object detection, instance segmentation, classification, training, and export.

17.9 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of ultralytics/yolov5, a Python project with 57,940 GitHub stars. SynthScan v2.0 examined 24,994 lines of code across 131 source files, recording 235 pattern matches distributed across 15 syntactic categories. The overall adjusted score of 17.9 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.9
Adjusted Score
17.9
Raw Score
100%
Time Factor
2026-08-28
Last Push
57.9K
Stars
Python
Language
25.0K
Lines of Code
131
Files
235
Pattern Hits
2026-08-29
Scan Date
0.37
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 48MEDIUM 4LOW 182

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 235 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 Structure47 hits · 235 pts
SeverityFileLineSnippetContext
HIGHval.py66Saves a single JSON detection result, including image ID, category ID, bounding box, and confidence score. Args: STRING
HIGHval.py397Parse command-line options for configuring YOLOv5 model inference. Args: data (str, optional): Path to the STRING
HIGHval.py475Executes 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.py379Export a YOLOv5 model to OpenVINO format with optional FP16 and INT8 quantization. Args: file (Path): Path STRING
HIGHexport.py463Export a YOLOv5 PyTorch model to PaddlePaddle format using X2Paddle, saving the converted model and metadata. Args:STRING
HIGHexport.py511Export a YOLOv5 model to CoreML format with optional NMS, INT8, and FP16 support. Args: model (torch.nn.ModSTRING
HIGHexport.py592Export a YOLOv5 model to TensorRT engine format, requiring GPU and TensorRT>=7.0.0. Args: model (torch.nn.MSTRING
HIGHexport.py711Export a YOLOv5 model to the TensorFlow SavedModel format, supporting dynamic axes and non-maximum suppression (NMS)STRING
HIGHexport.py794Export YOLOv5 model to TensorFlow GraphDef (*.pb) format. Args: keras_model (tf.keras.Model): The Keras modSTRING
HIGHexport.py831Export a YOLOv5 model to TensorFlow Lite format with optional INT8 quantization and NMS support. Args: keraSTRING
HIGHexport.py904Exports a YOLOv5 model to Edge TPU compatible TFLite format; requires Linux and Edge TPU compiler. Args: fiSTRING
HIGHexport.py989Convert a YOLOv5 model to TensorFlow.js format with optional uint8 quantization. Args: file (Path): Path toSTRING
HIGHexport.py1050Adds metadata to a TensorFlow Lite (TFLite) model file, supporting multiple outputs according to TensorFlow guidelinSTRING
HIGHexport.py1111Convert a PyTorch YOLOv5 model to CoreML format with Non-Maximum Suppression (NMS), handling different input/output STRING
HIGHexport.py1312Exports a YOLOv5 model to specified formats including ONNX, TensorRT, CoreML, and TensorFlow. Args: data (sSTRING
HIGHexport.py1492Parse 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.py534Parse command-line arguments for YOLOv5 training, validation, and testing. Args: known (bool, optional): IfSTRING
HIGHtrain.py603Runs the main entry point for training or hyperparameter evolution with specified options and optional callbacks. ASTRING
HIGHtrain.py878Generate an individual with random hyperparameters within specified ranges. Args: input_ranges (list[tuple[STRING
HIGHtrain.py908Execute 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.py110Loads a custom or local YOLOv5 model from a given path with optional autoshaping and device specification. Args: STRING
HIGHhubconf.py141Instantiates the YOLOv5-nano model with options for pretraining, input channels, class count, autoshaping, verbositySTRING
HIGHhubconf.py177Create a YOLOv5-small (yolov5s) model with options for pretraining, input channels, class count, autoshaping, verbosSTRING
HIGHhubconf.py218Instantiates the YOLOv5-medium model with customizable pretraining, channel count, class count, autoshaping, verbosiSTRING
HIGHhubconf.py251Creates YOLOv5-large model with options for pretraining, channels, classes, autoshaping, verbosity, and device selecSTRING
HIGHhubconf.py281Create the YOLOv5-xlarge model with options for pretraining, input channels, class count, autoshaping, verbosity, anSTRING
HIGHhubconf.py311Creates YOLOv5-nano-P6 model with options for pretraining, channels, classes, autoshaping, verbosity, and device. ASTRING
HIGHhubconf.py338Instantiate the YOLOv5-small-P6 model with options for pretraining, input channels, number of classes, autoshaping, STRING
HIGHhubconf.py375Create YOLOv5-medium-P6 model with options for pretraining, channel count, class count, autoshaping, verbosity, and STRING
HIGHhubconf.py409Instantiate the YOLOv5-large-P6 model with options for pretraining, channel and class counts, autoshaping, verbositySTRING
HIGHhubconf.py441Creates the YOLOv5-xlarge-P6 model with options for pretraining, number of input channels, class count, autoshaping,STRING
HIGHdetect.py101Runs YOLOv5 detection inference on various sources like images, videos, directories, streams, etc. Args: weSTRING
HIGHdetect.py328Parse command-line arguments for YOLOv5 detection, allowing custom inference options and model configurations. ArgsSTRING
HIGHdetect.py412Executes YOLOv5 model inference based on provided command-line arguments, validating dependencies before running. ASTRING
HIGHbenchmarks.py62Run YOLOv5 benchmarks on multiple export formats and log results for model performance evaluation. Args: weSTRING
HIGHbenchmarks.py157Run YOLOv5 export tests for all supported formats and log the results, including export statuses. Args: weiSTRING
HIGHbenchmarks.py214Parses command-line arguments for YOLOv5 model inference configuration. Args: weights (str): The path to thSTRING
HIGHbenchmarks.py252Executes YOLOv5 benchmark tests or main training/inference routines based on the provided command-line arguments. ASTRING
HIGHutils/autoanchor.py68Creates kmeans-evolved anchors from training dataset. Args: dataset: path to data.yaml, or a loaded datasetSTRING
Excessive Try-Catch Wrapping40 hits · 40 pts
SeverityFileLineSnippetContext
LOWval.py382 except Exception as e:CODE
LOWexport.py217 except Exception as e:CODE
LOWexport.py372 except Exception as e:CODE
LOWexport.py628 except Exception:CODE
LOWexport.py747 except Exception:CODE
LOWhubconf.py86 except Exception:CODE
LOWhubconf.py100 except Exception as e:CODE
LOWbenchmarks.py126 except Exception as e:CODE
LOWbenchmarks.py202 except Exception:CODE
LOWsegment/val.py381 except Exception as e:CODE
LOWtests/test_invariant_export.py104 except Exception:CODE
LOWutils/autobatch.py53 except Exception as e:CODE
LOWutils/dataloaders.py523 except Exception as e:CODE
LOWutils/dataloaders.py533 except Exception:CODE
LOWutils/dataloaders.py688 except Exception as e:CODE
LOWutils/dataloaders.py942 except Exception as e:CODE
LOWutils/downloads.py67 except Exception as e: # url2CODE
LOWutils/downloads.py109 except Exception:CODE
LOWutils/downloads.py112 except Exception:CODE
LOWutils/downloads.py115 except Exception:CODE
LOWutils/plots.py300 except Exception as e:CODE
LOWutils/autoanchor.py141 except Exception:CODE
LOWutils/torch_utils.py177 except Exception:CODE
LOWutils/torch_utils.py188 except Exception: # no backward methodCODE
LOWutils/torch_utils.py198 except Exception as e:CODE
LOWutils/general.py211 except Exception:CODE
LOWutils/general.py288 except Exception as e:CODE
LOWutils/general.py432 except Exception:CODE
LOWutils/general.py910 except Exception:CODE
LOWutils/augmentations.py51 except Exception as e:CODE
LOWutils/augmentations.py293 except Exception as e:CODE
LOWutils/loggers/__init__.py437 except Exception as e:CODE
LOWutils/loggers/comet/comet_utils.py64 except Exception:CODE
LOWutils/segment/plots.py146 except Exception as e:CODE
LOWutils/flask_rest_api/restapi.py55 except Exception:CODE
LOWmodels/yolo.py489 except Exception as 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.yaml438 except Exception as e:CODE
LOWdata/xView.yaml136 except Exception as e:CODE
Deep Nesting38 hits · 38 pts
SeverityFileLineSnippetContext
LOWval.py112CODE
LOWval.py474CODE
LOWtrain.py106CODE
LOWtrain.py602CODE
LOWhubconf.py16CODE
LOWdetect.py71CODE
LOWclassify/val.py52CODE
LOWclassify/predict.py68CODE
LOWclassify/train.py78CODE
LOWsegment/val.py104CODE
LOWsegment/val.py428CODE
LOWsegment/predict.py71CODE
LOWsegment/train.py100CODE
LOWsegment/train.py577CODE
LOWutils/dataloaders.py897CODE
LOWutils/dataloaders.py268CODE
LOWutils/dataloaders.py475CODE
LOWutils/dataloaders.py798CODE
LOWutils/downloads.py81CODE
LOWutils/plots.py55CODE
LOWutils/torch_utils.py79CODE
LOWutils/torch_utils.py151CODE
LOWutils/torch_utils.py263CODE
LOWutils/general.py310CODE
LOWutils/general.py350CODE
LOWutils/general.py475CODE
LOWutils/general.py478CODE
LOWutils/augmentations.py248CODE
LOWutils/segment/dataloaders.py235CODE
LOWutils/segment/loss.py48CODE
LOWutils/segment/plots.py20CODE
LOWutils/segment/plots.py116CODE
LOWmodels/tf.py504CODE
LOWmodels/common.py459CODE
LOWmodels/common.py685CODE
LOWmodels/common.py880CODE
LOWmodels/common.py971CODE
LOWmodels/yolo.py375CODE
Redundant / Tautological Comments17 hits · 26 pts
SeverityFileLineSnippetContext
LOWval.py335 # Print resultsCOMMENT
LOWval.py341 # Print results per classCOMMENT
LOWdetect.py250 # Print resultsCOMMENT
LOWdetect.py315 # Print resultsCOMMENT
LOWbenchmarks.py134 # Print resultsCOMMENT
LOWbenchmarks.py205 # Print resultsCOMMENT
LOWclassify/val.py140 # Print resultsCOMMENT
LOWclassify/predict.py151 # Print resultsCOMMENT
LOWclassify/predict.py195 # Print resultsCOMMENT
LOWsegment/val.py334 # Print resultsCOMMENT
LOWsegment/val.py340 # Print results per classCOMMENT
LOWsegment/predict.py182 # Print resultsCOMMENT
LOWsegment/predict.py239 # Print resultsCOMMENT
LOWutils/loggers/comet/__init__.py163 # Check if running the Experiment with the Comet OptimizerCOMMENT
LOWutils/loggers/comet/__init__.py448 # 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
Unused Imports23 hits · 23 pts
SeverityFileLineSnippetContext
LOWutils/triton.py4CODE
LOWutils/__init__.py6CODE
LOWutils/__init__.py6CODE
LOWutils/__init__.py6CODE
LOWutils/torch_utils.py21CODE
LOWutils/torch_utils.py24CODE
LOWutils/torch_utils.py24CODE
LOWutils/torch_utils.py24CODE
LOWutils/torch_utils.py17CODE
LOWutils/torch_utils.py19CODE
LOWutils/general.py4CODE
LOWutils/general.py42CODE
LOWutils/general.py43CODE
LOWutils/general.py43CODE
LOWutils/general.py51CODE
LOWutils/general.py51CODE
LOWutils/general.py51CODE
LOWutils/general.py53CODE
LOWutils/general.py53CODE
LOWutils/general.py53CODE
LOWutils/general.py53CODE
LOWutils/general.py63CODE
LOWutils/general.py63CODE
Over-Commented Block23 hits · 22 pts
SeverityFileLineSnippetContext
LOWrequirements.txt21# clearml>=1.2.0COMMENT
LOWrequirements.txt41# tritonclient[all]~=2.24.0COMMENT
LOWpyproject.toml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/licenseCOMMENT
LOWexport.py1181 out0.type.multiArrayType.shape[:] = out0_shape # (3780, 80)COMMENT
LOWmodels/common.py461 # PyTorch: weights = *.ptCOMMENT
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.py40def 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.py988def create_classification_dataloader(CODE
LOWutils/torch_utils.py79def reshape_classifier_output(model, n=1000):CODE
LOWutils/torch_utils.py103def torch_distributed_zero_first(local_rank: int):CODE
LOWutils/loggers/__init__.py154 def on_pretrain_routine_start(self):CODE
LOWutils/loggers/comet/__init__.py367 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 · 16 pts
SeverityFileLineSnippetContext
LOWval.py112CODE
LOWexport.py697CODE
LOWexport.py1285CODE
LOWdetect.py71CODE
LOWbenchmarks.py51CODE
LOWbenchmarks.py146CODE
LOWclassify/val.py52CODE
LOWclassify/predict.py68CODE
LOWsegment/val.py104CODE
LOWsegment/predict.py71CODE
LOWutils/dataloaders.py106CODE
LOWutils/dataloaders.py475CODE
LOWutils/general.py658CODE
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.py1263 pipeline.spec.description.metadata.userDefined.update(CODE
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMtrain.py837 # Create the next generation through crossover and mutationCOMMENT
MEDIUMdetect.py188 # 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/yolov5COMMENT
MEDIUMmodels/common.py844 """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