Repository Analysis

danielgatis/rembg

Rembg is a tool to remove images background

95.8 Strong AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of danielgatis/rembg, a Python project with 23,794 GitHub stars. SynthScan v2.0 examined 4,390 lines of code across 48 source files, recording 103 pattern matches distributed across 7 syntactic categories. The overall adjusted score of 95.8 places this repository in the Strong 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).

95.8
Adjusted Score
95.8
Raw Score
100%
Time Factor
2026-07-09
Last Push
23.8K
Stars
Python
Language
4.4K
Lines of Code
48
Files
103
Pattern Hits
2026-07-14
Scan Date
1.62
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 0HIGH 78MEDIUM 4LOW 21

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 103 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.

Docstring Block Structure48 hits · 240 pts
SeverityFileLineSnippetContext
HIGHrembg/session_factory.py12 Create a new session object based on the specified model name. This function searches for the session class baSTRING
HIGHrembg/sessions/u2net_custom.py17 Initialize a new U2netCustomSession object. Parameters: model_name (str): The name of the STRING
HIGHrembg/sessions/u2net_custom.py36 Predict the segmentation mask for the input image. Parameters: img (PILImage): The input iSTRING
HIGHrembg/sessions/u2net_custom.py69 Download the model files. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/u2net_custom.py93 Get the name of the model. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/u2net_cloth_seg.py59 Predict the cloth category of an image. This method takes an image as input and predicts the cloth catSTRING
HIGHrembg/sessions/birefnet_portrait.py15 Downloads the BiRefNet-Portrait model file from a specific URL and saves it. Parameters: *STRING
HIGHrembg/sessions/birefnet_portrait.py42 Returns the name of the BiRefNet-Portrait session. Parameters: *args: Additional positionaSTRING
HIGHrembg/sessions/birefnet_general.py21 Predicts the output masks for the input image using the inner session. Parameters: img (PISTRING
HIGHrembg/sessions/birefnet_general.py54 Downloads the BiRefNet-General model file from a specific URL and saves it. Parameters: *aSTRING
HIGHrembg/sessions/birefnet_general.py81 Returns the name of the BiRefNet-General session. Parameters: *args: Additional positionalSTRING
HIGHrembg/sessions/u2net_human_seg.py18 Predicts human segmentation masks for the input image. Parameters: img (PILImage): The inpSTRING
HIGHrembg/sessions/u2net_human_seg.py51 Downloads the U2Net model weights. Parameters: *args: Variable length argument list. STRING
HIGHrembg/sessions/u2net_human_seg.py78 Returns the name of the U2Net model. Parameters: *args: Variable length argument list. STRING
HIGHrembg/sessions/ben_custom.py64 Download the model files. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/ben_custom.py88 Get the name of the model. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/dis_anime.py18 Use a pre-trained model to predict the object in the given image. Parameters: img (PILImagSTRING
HIGHrembg/sessions/dis_anime.py49 Download the pre-trained models. Parameters: *args: Variable length argument list. STRING
HIGHrembg/sessions/dis_anime.py76 Get the name of the pre-trained model. Parameters: *args: Variable length argument list. STRING
HIGHrembg/sessions/dis_custom.py63 Download the model files. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/dis_custom.py87 Get the name of the model. Parameters: *args: Additional positional arguments. STRING
HIGHrembg/sessions/birefnet_general_lite.py15 Downloads the BiRefNet-General-Lite model file from a specific URL and saves it. Parameters: STRING
HIGHrembg/sessions/birefnet_general_lite.py42 Returns the name of the BiRefNet-General-Lite session. Parameters: *args: Additional positSTRING
HIGHrembg/sessions/birefnet_hrsod.py15 Downloads the BiRefNet-HRSOD model file from a specific URL and saves it. Parameters: *argSTRING
HIGHrembg/sessions/birefnet_hrsod.py42 Returns the name of the BiRefNet-HRSOD session. Parameters: *args: Additional positional aSTRING
HIGHrembg/sessions/dis_general_use.py45 Downloads the pre-trained model file. This class method downloads the pre-trained model file from a spSTRING
HIGHrembg/sessions/dis_general_use.py74 Returns the name of the model. This class method returns the name of the model. Parameters: STRING
HIGHrembg/sessions/birefnet_massive.py15 Downloads the BiRefNet-Massive model file from a specific URL and saves it. Parameters: *aSTRING
HIGHrembg/sessions/birefnet_massive.py42 Returns the name of the BiRefNet-Massive session. Parameters: *args: Additional positionalSTRING
HIGHrembg/sessions/birefnet_dis.py15 Downloads the BiRefNet-DIS model file from a specific URL and saves it. Parameters: *args:STRING
HIGHrembg/sessions/birefnet_dis.py42 Returns the name of the BiRefNet-DIS session. Parameters: *args: Additional positional argSTRING
HIGHrembg/sessions/sam.py172 Predict masks for an input image. This function takes an image as input and performs various preprocesSTRING
HIGHrembg/sessions/sam.py300 Class method to download ONNX model files. This method is responsible for downloading two ONNX model fSTRING
HIGHrembg/sessions/sam.py378 Class method to return a string value. This method returns the string value 'sam'. ParametersSTRING
HIGHrembg/sessions/u2net.py18 Predicts the output masks for the input image using the inner session. Parameters: img (PISTRING
HIGHrembg/sessions/u2net.py51 Downloads the U2net model file from a specific URL and saves it. Parameters: *args: AdditiSTRING
HIGHrembg/sessions/u2net.py78 Returns the name of the U2net session. Parameters: *args: Additional positional arguments.STRING
HIGHrembg/sessions/silueta.py16 Predict the mask of the input image. This method takes an image as input, preprocesses it, and performSTRING
HIGHrembg/sessions/silueta.py51 Download the pre-trained model file. This method downloads the pre-trained model file from a specifiedSTRING
HIGHrembg/sessions/silueta.py80 Return the name of the model. This method returns the name of the Silueta model. Parameters: STRING
HIGHrembg/sessions/bria_rmbg.py18 Predicts the output masks for the input image using the inner session. Parameters: img (PISTRING
HIGHrembg/sessions/bria_rmbg.py51 Downloads the BRIA-RMBG 2.0 model file from a specific URL and saves it. Parameters: *argsSTRING
HIGHrembg/sessions/bria_rmbg.py78 Returns the name of the Bria-rmbg session. Parameters: *args: Additional positional argumeSTRING
HIGHrembg/sessions/birefnet_cod.py15 Downloads the BiRefNet-COD model file from a specific URL and saves it. Parameters: *args:STRING
HIGHrembg/sessions/birefnet_cod.py42 Returns the name of the BiRefNet-COD session. Parameters: *args: Additional positional argSTRING
HIGHrembg/commands/p_command.py129 Command-line interface (CLI) program for performing background removal on images in a folder. This program takSTRING
HIGHrembg/commands/i_command.py89 Click command line interface function to process an input file based on the provided options. This function isSTRING
HIGHrembg/commands/b_command.py105 Command-line interface for processing images by removing the background using a specified model and generating a maSTRING
Cross-File Repetition30 hits · 150 pts
SeverityFileLineSnippetContext
HIGHrembg/sessions/u2net_custom.py0download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. reSTRING
HIGHrembg/sessions/ben_custom.py0download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. reSTRING
HIGHrembg/sessions/dis_custom.py0download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. reSTRING
HIGHrembg/sessions/u2net_custom.py0get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. rSTRING
HIGHrembg/sessions/ben_custom.py0get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. rSTRING
HIGHrembg/sessions/dis_custom.py0get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. rSTRING
HIGHrembg/sessions/birefnet_portrait.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_general.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_general_lite.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_hrsod.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_massive.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_dis.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/u2net.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/bria_rmbg.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_cod.py0downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumenSTRING
HIGHrembg/sessions/birefnet_portrait.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_general.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_general_lite.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_hrsod.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_massive.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_dis.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/u2net.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/bria_rmbg.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_cod.py0returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional kSTRING
HIGHrembg/sessions/birefnet_general.py0predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *argSTRING
HIGHrembg/sessions/u2net.py0predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *argSTRING
HIGHrembg/sessions/bria_rmbg.py0predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *argSTRING
HIGHrembg/sessions/ben_custom.py0predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimageSTRING
HIGHrembg/sessions/dis_custom.py0predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimageSTRING
HIGHrembg/sessions/dis_general_use.py0predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimageSTRING
Excessive Try-Catch Wrapping11 hits · 16 pts
SeverityFileLineSnippetContext
MEDIUMrembg/bg.py216 print(f"Error: no model found: {model}")CODE
LOWrembg/bg.py222 except Exception as e:CODE
MEDIUMrembg/bg.py223 print(f"Error downloading model: {e}")CODE
LOWrembg/commands/p_command.py152 except Exception:CODE
LOWrembg/commands/p_command.py184 except Exception as e:CODE
LOWrembg/commands/i_command.py106 except Exception:CODE
LOWrembg/commands/b_command.py124 except Exception:CODE
LOWrembg/commands/s_command.py207 except Exception:CODE
LOWrembg/commands/s_command.py235 except Exception:CODE
LOWrembg/commands/s_command.py257 except Exception:CODE
MEDIUMrembg/commands/s_command.py232def startup():CODE
Unused Imports7 hits · 7 pts
SeverityFileLineSnippetContext
LOWrembg/__init__.py11CODE
LOWrembg/__init__.py12CODE
LOWrembg/session_factory.py8CODE
LOWrembg/sessions/u2net_custom.py6CODE
LOWrembg/sessions/__init__.py1CODE
LOWrembg/sessions/__init__.py3CODE
LOWrembg/commands/b_command.py6CODE
Deep Nesting3 hits · 3 pts
SeverityFileLineSnippetContext
LOWtests/test_remove.py13CODE
LOWrembg/bg.py226CODE
LOWrembg/sessions/base.py13CODE
AI Structural Patterns3 hits · 3 pts
SeverityFileLineSnippetContext
LOWrembg/bg.py226CODE
LOWrembg/commands/s_command.py112CODE
LOWrembg/commands/s_command.py157CODE
Self-Referential Comments1 hit · 1 pts
SeverityFileLineSnippetContext
MEDIUMrembg/sessions/u2netp.py13 """This class represents a session for using the U2netp model."""STRING