Repository Analysis

ultralytics/yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite

16.1 Moderate AI signal View on GitHub
16.1
Adjusted Score
16.1
Raw Score
100%
Time Factor
2026-05-06
Last Push
57,455
Stars
Python
Language
26,339
Lines of Code
133
Files
188
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 1HIGH 53MEDIUM 5LOW 129

Pattern Findings

188 matches across 12 categories. Click a row to expand file-level details.

Docstring Block Structure52 hits · 260 pts
SeverityFileLineSnippet
HIGHval.py65Saves one detection result to a txt file in normalized xywh format, optionally including confidence. Args:
HIGHval.py97Saves a single JSON detection result, including image ID, category ID, bounding box, and confidence score. Args:
HIGHval.py143Return a correct prediction matrix given detections and labels at various IoU thresholds. Args: detections
HIGHval.py467Parse command-line options for configuring YOLOv5 model inference. Args: data (str, optional): Path to the
HIGHval.py545Executes YOLOv5 tasks like training, validation, testing, speed, and study benchmarks based on provided options. Ar
HIGHexport.py97Initializes an iOS compatible model with normalization based on image dimensions. Args: model (torc
HIGHexport.py123Run a forward pass on the input tensor, returning class confidences and normalized coordinates. Args:
HIGHexport.py144Returns a DataFrame of supported YOLOv5 model export formats and their properties. Returns: pandas.DataFram
HIGHexport.py183Log success or failure, execution time, and file size for YOLOv5 model export functions wrapped with @try_export. A
HIGHexport.py226Export a YOLOv5 model to the TorchScript format. Args: model (torch.nn.Module): The YOLOv5 model to be expo
HIGHexport.py281Export a YOLOv5 model to ONNX format with dynamic axes support and optional model simplification. Args: mod
HIGHexport.py380Export a YOLOv5 model to OpenVINO format with optional FP16 and INT8 quantization. Args: file (Path): Path
HIGHexport.py468Export a YOLOv5 PyTorch model to PaddlePaddle format using X2Paddle, saving the converted model and metadata. Args:
HIGHexport.py516Export a YOLOv5 model to CoreML format with optional NMS, INT8, and FP16 support. Args: model (torch.nn.Mod
HIGHexport.py587Export a YOLOv5 model to TensorRT engine format, requiring GPU and TensorRT>=7.0.0. Args: model (torch.nn.M
HIGHexport.py707Export a YOLOv5 model to the TensorFlow SavedModel format, supporting dynamic axes and non-maximum suppression (NMS)
HIGHexport.py790Export YOLOv5 model to TensorFlow GraphDef (*.pb) format. Args: keras_model (tf.keras.Model): The Keras mod
HIGHexport.py830Export a YOLOv5 model to TensorFlow Lite format with optional INT8 quantization and NMS support. Args: kera
HIGHexport.py903Exports a YOLOv5 model to Edge TPU compatible TFLite format; requires Linux and Edge TPU compiler. Args: fi
HIGHexport.py964Convert a YOLOv5 model to TensorFlow.js format with optional uint8 quantization. Args: file (Path): Path to
HIGHexport.py1025Adds metadata to a TensorFlow Lite (TFLite) model file, supporting multiple outputs according to TensorFlow guidelin
HIGHexport.py1086Convert a PyTorch YOLOv5 model to CoreML format with Non-Maximum Suppression (NMS), handling different input/output
HIGHexport.py1285Exports a YOLOv5 model to specified formats including ONNX, TensorRT, CoreML, and TensorFlow. Args: data (s
HIGHexport.py1465Parse command-line options for YOLOv5 model export configurations. Args: known (bool): If True, uses `argpa
HIGHtrain.py106Train a YOLOv5 model on a custom dataset using specified hyperparameters, options, and device, managing datasets, mo
HIGHtrain.py547Parse command-line arguments for YOLOv5 training, validation, and testing. Args: known (bool, optional): If
HIGHtrain.py621Runs the main entry point for training or hyperparameter evolution with specified options and optional callbacks. A
HIGHtrain.py890Generate an individual with random hyperparameters within specified ranges. Args: input_ranges (list[tuple[
HIGHtrain.py920Execute YOLOv5 training with specified options, allowing optional overrides through keyword arguments. Args:
HIGHhubconf.py17Creates or loads a YOLOv5 model, with options for pretrained weights and model customization. Args: name (s
HIGHhubconf.py108Loads a custom or local YOLOv5 model from a given path with optional autoshaping and device specification. Args:
HIGHhubconf.py139Instantiates the YOLOv5-nano model with options for pretraining, input channels, class count, autoshaping, verbosity
HIGHhubconf.py176Create a YOLOv5-small (yolov5s) model with options for pretraining, input channels, class count, autoshaping, verbos
HIGHhubconf.py217Instantiates the YOLOv5-medium model with customizable pretraining, channel count, class count, autoshaping, verbosi
HIGHhubconf.py250Creates YOLOv5-large model with options for pretraining, channels, classes, autoshaping, verbosity, and device selec
HIGHhubconf.py280Perform object detection using the YOLOv5-xlarge model with options for pretraining, input channels, class count, au
HIGHhubconf.py310Creates YOLOv5-nano-P6 model with options for pretraining, channels, classes, autoshaping, verbosity, and device. A
HIGHhubconf.py337Instantiate the YOLOv5-small-P6 model with options for pretraining, input channels, number of classes, autoshaping,
HIGHhubconf.py374Create YOLOv5-medium-P6 model with options for pretraining, channel count, class count, autoshaping, verbosity, and
HIGHhubconf.py408Instantiate the YOLOv5-large-P6 model with options for pretraining, channel and class counts, autoshaping, verbosity
HIGHhubconf.py440Creates the YOLOv5-xlarge-P6 model with options for pretraining, number of input channels, class count, autoshaping,
HIGHdetect.py102Runs YOLOv5 detection inference on various sources like images, videos, directories, streams, etc. Args: we
HIGHdetect.py332Parse command-line arguments for YOLOv5 detection, allowing custom inference options and model configurations. Args
HIGHdetect.py417Executes YOLOv5 model inference based on provided command-line arguments, validating dependencies before running. A
HIGHbenchmarks.py63Run YOLOv5 benchmarks on multiple export formats and log results for model performance evaluation. Args: we
HIGHbenchmarks.py159Run YOLOv5 export tests for all supported formats and log the results, including export statuses. Args: wei
HIGHbenchmarks.py218Parses command-line arguments for YOLOv5 model inference configuration. Args: weights (str): The path to th
HIGHbenchmarks.py256Executes YOLOv5 benchmark tests or main training/inference routines based on the provided command-line arguments. A
HIGHutils/metrics.py304Returns the intersection over box2 area given box1, box2. Args: box1: np.array of shape(4) box2: np
HIGHutils/autoanchor.py67Creates kmeans-evolved anchors from training dataset. Args: dataset: path to data.yaml, or a loaded dataset
HIGHutils/segment/general.py121 Args: mask1: [N, n] m1 means number of predicted objects mask2: [M, n] m2 means number of gt object
HIGHutils/segment/general.py138 Args: mask1: [N, n] m1 means number of predicted objects mask2: [N, n] m2 means number of gt object
Excessive Try-Catch Wrapping48 hits · 48 pts
SeverityFileLineSnippet
LOWval.py452 except Exception as e:
LOWexport.py217 except Exception as e:
LOWexport.py373 except Exception as e:
LOWexport.py624 except Exception:
LOWexport.py743 except Exception:
LOWhubconf.py85 except Exception:
LOWhubconf.py101 except Exception as e:
LOWbenchmarks.py127 except Exception as e:
LOWbenchmarks.py204 except Exception:
LOWsegment/val.py435 except Exception as e:
LOWutils/autobatch.py53 except Exception as e:
LOWutils/dataloaders.py585 except Exception as e:
LOWutils/dataloaders.py595 except Exception:
LOWutils/dataloaders.py752 except Exception as e:
LOWutils/dataloaders.py1171 except Exception as e:
LOWutils/dataloaders.py1202 except Exception as e:
LOWutils/dataloaders.py1244 except Exception as e: # use OpenCV
LOWutils/downloads.py72 except Exception as e: # url2
LOWutils/downloads.py114 except Exception:
LOWutils/downloads.py117 except Exception:
LOWutils/downloads.py120 except Exception:
LOWutils/plots.py453 except Exception as e:
LOWutils/plots.py488 except Exception as e:
LOWutils/autoanchor.py141 except Exception:
LOWutils/torch_utils.py108 except Exception:
LOWutils/torch_utils.py182 except Exception:
LOWutils/torch_utils.py193 except Exception: # no backward method
LOWutils/torch_utils.py203 except Exception as e:
LOWutils/torch_utils.py316 except Exception:
LOWutils/torch_utils.py390 except Exception:
LOWutils/general.py367 except Exception:
LOWutils/general.py459 except Exception as e:
LOWutils/general.py608 except Exception:
LOWutils/general.py1274 except Exception:
LOWutils/augmentations.py47 except Exception as e:
LOWutils/augmentations.py354 except Exception as e:
LOWutils/loggers/__init__.py134 except Exception:
LOWutils/loggers/__init__.py384 except Exception:
LOWutils/loggers/__init__.py465 except Exception as e:
LOWutils/loggers/comet/comet_utils.py64 except Exception as e:
LOWutils/segment/plots.py145 except Exception as e:
LOWutils/flask_rest_api/restapi.py51 except Exception:
LOWmodels/yolo.py492 except Exception as e:
MEDIUMmodels/yolo.py493 print(f"Error in {cfg}: {e}")
LOW.github/workflows/merge-main-into-prs.yml66 except Exception as update_error:
LOW.github/workflows/merge-main-into-prs.yml71 except Exception as e:
LOWdata/Objects365.yaml436 except Exception as e:
LOWdata/xView.yaml131 except Exception as e:
Deep Nesting44 hits · 44 pts
SeverityFileLineSnippet
LOWval.py184
LOWval.py544
LOWtrain.py105
LOWtrain.py620
LOWhubconf.py16
LOWdetect.py71
LOWclassify/val.py53
LOWclassify/predict.py68
LOWclassify/train.py78
LOWsegment/val.py155
LOWsegment/val.py482
LOWsegment/predict.py70
LOWsegment/train.py100
LOWsegment/train.py592
LOWutils/metrics.py238
LOWutils/dataloaders.py1061
LOWutils/dataloaders.py1126
LOWutils/dataloaders.py321
LOWutils/dataloaders.py537
LOWutils/dataloaders.py872
LOWutils/dataloaders.py932
LOWutils/downloads.py86
LOWutils/plots.py152
LOWutils/plots.py460
LOWutils/torch_utils.py67
LOWutils/torch_utils.py156
LOWutils/torch_utils.py220
LOWutils/torch_utils.py346
LOWutils/general.py481
LOWutils/general.py521
LOWutils/general.py651
LOWutils/general.py654
LOWutils/augmentations.py313
LOWutils/segment/dataloaders.py237
LOWutils/segment/loss.py47
LOWutils/segment/plots.py19
LOWutils/segment/plots.py115
LOWutils/segment/general.py154
LOWmodels/tf.py507
LOWmodels/common.py457
LOWmodels/common.py687
LOWmodels/common.py852
LOWmodels/common.py943
LOWmodels/yolo.py378
Redundant / Tautological Comments17 hits · 26 pts
SeverityFileLineSnippet
LOWval.py405 # Print results
LOWval.py411 # Print results per class
LOWdetect.py256 # Print results
LOWdetect.py321 # Print results
LOWbenchmarks.py135 # Print results
LOWbenchmarks.py207 # Print results
LOWclassify/val.py141 # Print results
LOWclassify/predict.py153 # Print results
LOWclassify/predict.py197 # Print results
LOWsegment/val.py387 # Print results
LOWsegment/val.py393 # Print results per class
LOWsegment/predict.py186 # Print results
LOWsegment/predict.py250 # Print results
LOWutils/loggers/comet/__init__.py163 # Check if running the Experiment with the Comet Optimizer
LOWutils/loggers/comet/__init__.py463 # Check if running Experiment with Comet Optimizer
LOWutils/loggers/clearml/clearml_utils.py123 # Set data to data_dict because wandb will crash without this information and opt is the best way
LOW.github/workflows/merge-main-into-prs.yml55 # Check if PR is behind the default branch
Hyper-Verbose Identifiers14 hits · 16 pts
SeverityFileLineSnippet
LOWtests/test_flask_rest_api.py56def test_rejects_non_image_upload_with_allowed_extension(client):
LOWtests/test_flask_rest_api.py62def test_rejects_upload_with_disallowed_extension(client):
LOWtests/test_flask_rest_api.py68def test_rejects_oversized_upload(client):
LOWtests/test_flask_rest_api.py74def test_accepts_valid_image_upload(client):
LOWutils/triton.py29 def create_input_placeholders() -> list[InferInput]:
LOWutils/triton.py42 def create_input_placeholders() -> list[InferInput]:
LOWutils/dataloaders.py1343def create_classification_dataloader(
LOWutils/torch_utils.py67def reshape_classifier_output(model, n=1000):
LOWutils/torch_utils.py91def torch_distributed_zero_first(local_rank: int):
LOWutils/loggers/__init__.py175 def on_pretrain_routine_start(self):
LOWutils/loggers/comet/__init__.py370 def download_dataset_artifact(self, artifact_path):
LOWutils/loggers/comet/comet_utils.py21def download_model_checkpoint(opt, experiment):
LOWutils/segment/metrics.py15def ap_per_class_box_and_mask(
LOWmodels/tf.py716def representative_dataset_gen(dataset, ncalib=100):
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippet
CRITICALexport.py1236 pipeline.spec.description.metadata.userDefined.update(
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippet
MEDIUMtrain.py851 # Create the next generation through crossover and mutation
MEDIUMdetect.py222 # Define the path for the CSV file
Over-Commented Block4 hits · 4 pts
SeverityFileLineSnippet
LOWrequirements.txt21# Logging ---------------------------------------------------------------------
LOWrequirements.txt41# Deploy ----------------------------------------------------------------------
LOWpyproject.toml1# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
LOWutils/autoanchor.py141 except Exception:
AI Slop Vocabulary2 hits · 4 pts
SeverityFileLineSnippet
MEDIUMpyproject.toml19# For comprehensive documentation and usage instructions, visit: https://docs.ultralytics.com
MEDIUMmodels/common.py813 """AutoShape class for robust YOLOv5 inference with preprocessing, NMS, and support for various input formats."""
Unused Imports2 hits · 2 pts
SeverityFileLineSnippet
LOWutils/triton.py4
LOWutils/general.py4
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWutils/autobatch.py21 # Usage:
Cross-Language Confusion1 hit · 1 pts
SeverityFileLineSnippet
HIGHexport.py41 $ cd .. && git clone https://github.com/zldrobit/tfjs-yolov5-example.git && cd tfjs-yolov5-example