Repository Analysis

jacobgil/pytorch-grad-cam

Advanced AI Explainability for computer vision. Support for CNNs, Vision Transformers, Classification, Object detection, Segmentation, Image similarity and more.

27.3 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of jacobgil/pytorch-grad-cam, a Python project with 12,952 GitHub stars. SynthScan v2.0 examined 4,968 lines of code across 61 source files, recording 127 pattern matches distributed across 7 syntactic categories. The overall adjusted score of 27.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).

27.3
Adjusted Score
27.3
Raw Score
100%
Time Factor
2026-08-13
Last Push
13.0K
Stars
Python
Language
5.0K
Lines of Code
61
Files
127
Pattern Hits
2026-08-13
Scan Date
0.02
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

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

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 0HIGH 1MEDIUM 2LOW 124

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 127 distinct pattern matches across 7 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.

Unused Imports83 hits · 78 pts
SeverityFileLineSnippetContext
LOWcam.py17CODE
LOWcam.py17CODE
LOWcam.py87CODE
LOWusage_examples/clip_example.py7CODE
LOWusage_examples/vit_example.py16CODE
LOWpytorch_grad_cam/ablation_cam_multilayer.py1CODE
LOWpytorch_grad_cam/shapley_cam.py1CODE
LOWpytorch_grad_cam/shapley_cam.py1CODE
LOWpytorch_grad_cam/shapley_cam.py1CODE
LOWpytorch_grad_cam/shapley_cam.py1CODE
LOWpytorch_grad_cam/shapley_cam.py3CODE
LOWpytorch_grad_cam/__init__.py1CODE
LOWpytorch_grad_cam/__init__.py2CODE
LOWpytorch_grad_cam/__init__.py3CODE
LOWpytorch_grad_cam/__init__.py4CODE
LOWpytorch_grad_cam/__init__.py5CODE
LOWpytorch_grad_cam/__init__.py6CODE
LOWpytorch_grad_cam/__init__.py7CODE
LOWpytorch_grad_cam/__init__.py7CODE
LOWpytorch_grad_cam/__init__.py7CODE
LOWpytorch_grad_cam/__init__.py8CODE
LOWpytorch_grad_cam/__init__.py9CODE
LOWpytorch_grad_cam/__init__.py10CODE
LOWpytorch_grad_cam/__init__.py11CODE
LOWpytorch_grad_cam/__init__.py12CODE
LOWpytorch_grad_cam/__init__.py13CODE
LOWpytorch_grad_cam/__init__.py14CODE
LOWpytorch_grad_cam/__init__.py15CODE
LOWpytorch_grad_cam/__init__.py16CODE
LOWpytorch_grad_cam/__init__.py17CODE
LOWpytorch_grad_cam/__init__.py18CODE
LOWpytorch_grad_cam/__init__.py19CODE
LOWpytorch_grad_cam/__init__.py20CODE
LOWpytorch_grad_cam/__init__.py21CODE
LOWpytorch_grad_cam/__init__.py22CODE
LOWpytorch_grad_cam/__init__.py23CODE
LOWpytorch_grad_cam/__init__.py23CODE
LOWpytorch_grad_cam/__init__.py24CODE
LOWpytorch_grad_cam/__init__.py25CODE
LOWpytorch_grad_cam/__init__.py26CODE
LOWpytorch_grad_cam/__init__.py27CODE
LOWpytorch_grad_cam/hirescam.py1CODE
LOWpytorch_grad_cam/metrics/cam_mult_image.py3CODE
LOWpytorch_grad_cam/metrics/cam_mult_image.py3CODE
LOWpytorch_grad_cam/utils/__init__.py1CODE
LOWpytorch_grad_cam/utils/__init__.py2CODE
LOWpytorch_grad_cam/utils/__init__.py3CODE
LOWpytorch_grad_cam/utils/__init__.py4CODE
LOWpytorch_grad_cam/utils/model_targets.py1CODE
LOW…am/feature_factorization/deep_feature_factorization.py4CODE
LOW…am/feature_factorization/deep_feature_factorization.py4CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py6CODE
LOWtests/test_context_release.py16CODE
23 more matches not shown…
Hyper-Verbose Identifiers26 hits · 30 pts
SeverityFileLineSnippetContext
LOWpytorch_grad_cam/ablation_cam_multilayer.py84 def set_ablation_layer_batch_indices(self, indices):CODE
LOWpytorch_grad_cam/ablation_cam_multilayer.py88 def trim_ablation_layer_batch_indices(self, keep):CODE
LOWpytorch_grad_cam/guided_backprop.py59 def recursive_replace_relu_with_guidedrelu(self, module_top):CODE
LOWpytorch_grad_cam/guided_backprop.py65 def recursive_replace_guidedrelu_with_relu(self, module_top):CODE
LOWpytorch_grad_cam/ablation_layer.py11 def objectiveness_mask_from_svd(self, activations, threshold=0.01):CODE
LOWpytorch_grad_cam/ablation_layer.py25 def activations_to_be_ablated(CODE
LOWpytorch_grad_cam/base_cam.py183 def forward_augmentation_smoothing(CODE
LOWpytorch_grad_cam/utils/find_layers.py11def replace_all_layer_type_recursive(model, old_layer_type, new_layer):CODE
LOWpytorch_grad_cam/utils/find_layers.py18def find_layer_types_recursive(model, layer_types):CODE
LOWpytorch_grad_cam/utils/find_layers.py24def find_layer_predicate_recursive(model, predicate):CODE
LOWpytorch_grad_cam/utils/reshape_transforms.py4def fasterrcnn_reshape_transform(x):CODE
LOWpytorch_grad_cam/utils/image.py83def show_factorization_on_image(CODE
LOWpytorch_grad_cam/utils/image.py179def scale_accross_batch_and_channels(tensor, target_size):CODE
LOWtests/test_context_release.py46def test_memory_usage_in_loop(numpy_image, batch_size, width, height,CODE
LOWtests/test_finer_cam_correctness.py33def test_finercam_supports_context_manager():CODE
LOWtests/test_finer_cam_correctness.py39def test_finercam_runs_on_binary_classifier_without_index_error():CODE
LOWtests/test_finer_cam_correctness.py47def test_finercam_runs_on_ternary_classifier_without_index_error():CODE
LOWtests/test_finer_cam_correctness.py55def test_finercam_htcore_is_single_underscore():CODE
LOWtests/test_run_all_models.py59def test_all_cam_models_can_run(numpy_image, batch_size, width, height,CODE
LOWtests/test_one_channel.py30def test_memory_usage_in_loop(numpy_image, cam_method):CODE
LOWtests/test_context_release_cuda.py48def test_memory_usage_in_loop(numpy_image, batch_size, width, height,CODE
LOWtests/test_sess.py88def test_sess_without_targets(numpy_image):CODE
LOWtests/test_sess.py105def test_sess_invalid_arguments():CODE
LOWtests/test_fasterrcnn_target_device.py12def test_target_inherits_output_device_cpu():CODE
LOWtests/test_fasterrcnn_target_device.py27def test_target_returns_zero_on_empty_boxes():CODE
LOWtests/test_fasterrcnn_target_device.py39def test_target_preserves_boxes_dtype():CODE
AI Structural Patterns10 hits · 10 pts
SeverityFileLineSnippetContext
LOWusage_examples/clip_example.py77CODE
LOWusage_examples/swinT_example.py62CODE
LOWusage_examples/vit_example.py62CODE
LOWpytorch_grad_cam/ablation_layer.py111CODE
LOWpytorch_grad_cam/sess.py28CODE
LOWpytorch_grad_cam/utils/reshape_transforms.py24CODE
LOWpytorch_grad_cam/utils/reshape_transforms.py34CODE
LOWpytorch_grad_cam/utils/image.py176CODE
LOWpytorch_grad_cam/utils/image.py189CODE
LOW…am/feature_factorization/deep_feature_factorization.py134CODE
AI Response Leakage1 hit · 8 pts
SeverityFileLineSnippetContext
HIGHREADME.md130 # In this example grayscale_cam has only one image in the batch:COMMENT
Excessive Try-Catch Wrapping4 hits · 6 pts
SeverityFileLineSnippetContext
LOWpytorch_grad_cam/guided_backprop.py71 except Exception:CODE
MEDIUMpytorch_grad_cam/guided_backprop.py65def recursive_replace_guidedrelu_with_relu(self, module_top):CODE
LOWpytorch_grad_cam/finer_cam.py45 except Exception:CODE
MEDIUMpytorch_grad_cam/finer_cam.py42def __del__(self):CODE
Deep Nesting2 hits · 2 pts
SeverityFileLineSnippetContext
LOWpytorch_grad_cam/ablation_cam_multilayer.py92CODE
LOWpytorch_grad_cam/ablation_cam.py75CODE
Over-Commented Block1 hit · 1 pts
SeverityFileLineSnippetContext
LOWpytorch_grad_cam/metrics/road.py1# A Consistent and Efficient Evaluation Strategy for Attribution MethodsCOMMENT