Rembg is a tool to remove images background
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).
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.
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.
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.
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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | rembg/session_factory.py | 12 | Create a new session object based on the specified model name. This function searches for the session class ba | STRING |
| HIGH | rembg/sessions/u2net_custom.py | 17 | Initialize a new U2netCustomSession object. Parameters: model_name (str): The name of the | STRING |
| HIGH | rembg/sessions/u2net_custom.py | 36 | Predict the segmentation mask for the input image. Parameters: img (PILImage): The input i | STRING |
| HIGH | rembg/sessions/u2net_custom.py | 69 | Download the model files. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/u2net_custom.py | 93 | Get the name of the model. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/u2net_cloth_seg.py | 59 | Predict the cloth category of an image. This method takes an image as input and predicts the cloth cat | STRING |
| HIGH | rembg/sessions/birefnet_portrait.py | 15 | Downloads the BiRefNet-Portrait model file from a specific URL and saves it. Parameters: * | STRING |
| HIGH | rembg/sessions/birefnet_portrait.py | 42 | Returns the name of the BiRefNet-Portrait session. Parameters: *args: Additional positiona | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 21 | Predicts the output masks for the input image using the inner session. Parameters: img (PI | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 54 | Downloads the BiRefNet-General model file from a specific URL and saves it. Parameters: *a | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 81 | Returns the name of the BiRefNet-General session. Parameters: *args: Additional positional | STRING |
| HIGH | rembg/sessions/u2net_human_seg.py | 18 | Predicts human segmentation masks for the input image. Parameters: img (PILImage): The inp | STRING |
| HIGH | rembg/sessions/u2net_human_seg.py | 51 | Downloads the U2Net model weights. Parameters: *args: Variable length argument list. | STRING |
| HIGH | rembg/sessions/u2net_human_seg.py | 78 | Returns the name of the U2Net model. Parameters: *args: Variable length argument list. | STRING |
| HIGH | rembg/sessions/ben_custom.py | 64 | Download the model files. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/ben_custom.py | 88 | Get the name of the model. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/dis_anime.py | 18 | Use a pre-trained model to predict the object in the given image. Parameters: img (PILImag | STRING |
| HIGH | rembg/sessions/dis_anime.py | 49 | Download the pre-trained models. Parameters: *args: Variable length argument list. | STRING |
| HIGH | rembg/sessions/dis_anime.py | 76 | Get the name of the pre-trained model. Parameters: *args: Variable length argument list. | STRING |
| HIGH | rembg/sessions/dis_custom.py | 63 | Download the model files. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/dis_custom.py | 87 | Get the name of the model. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/birefnet_general_lite.py | 15 | Downloads the BiRefNet-General-Lite model file from a specific URL and saves it. Parameters: | STRING |
| HIGH | rembg/sessions/birefnet_general_lite.py | 42 | Returns the name of the BiRefNet-General-Lite session. Parameters: *args: Additional posit | STRING |
| HIGH | rembg/sessions/birefnet_hrsod.py | 15 | Downloads the BiRefNet-HRSOD model file from a specific URL and saves it. Parameters: *arg | STRING |
| HIGH | rembg/sessions/birefnet_hrsod.py | 42 | Returns the name of the BiRefNet-HRSOD session. Parameters: *args: Additional positional a | STRING |
| HIGH | rembg/sessions/dis_general_use.py | 45 | Downloads the pre-trained model file. This class method downloads the pre-trained model file from a sp | STRING |
| HIGH | rembg/sessions/dis_general_use.py | 74 | Returns the name of the model. This class method returns the name of the model. Parameters: | STRING |
| HIGH | rembg/sessions/birefnet_massive.py | 15 | Downloads the BiRefNet-Massive model file from a specific URL and saves it. Parameters: *a | STRING |
| HIGH | rembg/sessions/birefnet_massive.py | 42 | Returns the name of the BiRefNet-Massive session. Parameters: *args: Additional positional | STRING |
| HIGH | rembg/sessions/birefnet_dis.py | 15 | Downloads the BiRefNet-DIS model file from a specific URL and saves it. Parameters: *args: | STRING |
| HIGH | rembg/sessions/birefnet_dis.py | 42 | Returns the name of the BiRefNet-DIS session. Parameters: *args: Additional positional arg | STRING |
| HIGH | rembg/sessions/sam.py | 172 | Predict masks for an input image. This function takes an image as input and performs various preproces | STRING |
| HIGH | rembg/sessions/sam.py | 300 | Class method to download ONNX model files. This method is responsible for downloading two ONNX model f | STRING |
| HIGH | rembg/sessions/sam.py | 378 | Class method to return a string value. This method returns the string value 'sam'. Parameters | STRING |
| HIGH | rembg/sessions/u2net.py | 18 | Predicts the output masks for the input image using the inner session. Parameters: img (PI | STRING |
| HIGH | rembg/sessions/u2net.py | 51 | Downloads the U2net model file from a specific URL and saves it. Parameters: *args: Additi | STRING |
| HIGH | rembg/sessions/u2net.py | 78 | Returns the name of the U2net session. Parameters: *args: Additional positional arguments. | STRING |
| HIGH | rembg/sessions/silueta.py | 16 | Predict the mask of the input image. This method takes an image as input, preprocesses it, and perform | STRING |
| HIGH | rembg/sessions/silueta.py | 51 | Download the pre-trained model file. This method downloads the pre-trained model file from a specified | STRING |
| HIGH | rembg/sessions/silueta.py | 80 | Return the name of the model. This method returns the name of the Silueta model. Parameters: | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 18 | Predicts the output masks for the input image using the inner session. Parameters: img (PI | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 51 | Downloads the BRIA-RMBG 2.0 model file from a specific URL and saves it. Parameters: *args | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 78 | Returns the name of the Bria-rmbg session. Parameters: *args: Additional positional argume | STRING |
| HIGH | rembg/sessions/birefnet_cod.py | 15 | Downloads the BiRefNet-COD model file from a specific URL and saves it. Parameters: *args: | STRING |
| HIGH | rembg/sessions/birefnet_cod.py | 42 | Returns the name of the BiRefNet-COD session. Parameters: *args: Additional positional arg | STRING |
| HIGH | rembg/commands/p_command.py | 129 | Command-line interface (CLI) program for performing background removal on images in a folder. This program tak | STRING |
| HIGH | rembg/commands/i_command.py | 89 | Click command line interface function to process an input file based on the provided options. This function is | STRING |
| HIGH | rembg/commands/b_command.py | 105 | Command-line interface for processing images by removing the background using a specified model and generating a ma | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | rembg/sessions/u2net_custom.py | 0 | download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. re | STRING |
| HIGH | rembg/sessions/ben_custom.py | 0 | download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. re | STRING |
| HIGH | rembg/sessions/dis_custom.py | 0 | download the model files. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. re | STRING |
| HIGH | rembg/sessions/u2net_custom.py | 0 | get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. r | STRING |
| HIGH | rembg/sessions/ben_custom.py | 0 | get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. r | STRING |
| HIGH | rembg/sessions/dis_custom.py | 0 | get the name of the model. parameters: *args: additional positional arguments. **kwargs: additional keyword arguments. r | STRING |
| HIGH | rembg/sessions/birefnet_portrait.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_general_lite.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_hrsod.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_massive.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_dis.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/u2net.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_cod.py | 0 | downloads the birefnet-cod model file from a specific url and saves it. parameters: *args: additional positional argumen | STRING |
| HIGH | rembg/sessions/birefnet_portrait.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_general_lite.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_hrsod.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_massive.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_dis.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/u2net.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_cod.py | 0 | returns the name of the birefnet-cod session. parameters: *args: additional positional arguments. **kwargs: additional k | STRING |
| HIGH | rembg/sessions/birefnet_general.py | 0 | predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *arg | STRING |
| HIGH | rembg/sessions/u2net.py | 0 | predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *arg | STRING |
| HIGH | rembg/sessions/bria_rmbg.py | 0 | predicts the output masks for the input image using the inner session. parameters: img (pilimage): the input image. *arg | STRING |
| HIGH | rembg/sessions/ben_custom.py | 0 | predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimage | STRING |
| HIGH | rembg/sessions/dis_custom.py | 0 | predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimage | STRING |
| HIGH | rembg/sessions/dis_general_use.py | 0 | predicts the mask image for the input image. this method takes a pilimage object as input and returns a list of pilimage | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM⚡ | rembg/bg.py | 216 | print(f"Error: no model found: {model}") | CODE |
| LOW⚡ | rembg/bg.py | 222 | except Exception as e: | CODE |
| MEDIUM⚡ | rembg/bg.py | 223 | print(f"Error downloading model: {e}") | CODE |
| LOW | rembg/commands/p_command.py | 152 | except Exception: | CODE |
| LOW | rembg/commands/p_command.py | 184 | except Exception as e: | CODE |
| LOW | rembg/commands/i_command.py | 106 | except Exception: | CODE |
| LOW | rembg/commands/b_command.py | 124 | except Exception: | CODE |
| LOW | rembg/commands/s_command.py | 207 | except Exception: | CODE |
| LOW | rembg/commands/s_command.py | 235 | except Exception: | CODE |
| LOW | rembg/commands/s_command.py | 257 | except Exception: | CODE |
| MEDIUM | rembg/commands/s_command.py | 232 | def startup(): | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rembg/__init__.py | 11 | CODE | |
| LOW | rembg/__init__.py | 12 | CODE | |
| LOW | rembg/session_factory.py | 8 | CODE | |
| LOW | rembg/sessions/u2net_custom.py | 6 | CODE | |
| LOW | rembg/sessions/__init__.py | 1 | CODE | |
| LOW | rembg/sessions/__init__.py | 3 | CODE | |
| LOW | rembg/commands/b_command.py | 6 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_remove.py | 13 | CODE | |
| LOW | rembg/bg.py | 226 | CODE | |
| LOW | rembg/sessions/base.py | 13 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rembg/bg.py | 226 | CODE | |
| LOW | rembg/commands/s_command.py | 112 | CODE | |
| LOW | rembg/commands/s_command.py | 157 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | rembg/sessions/u2netp.py | 13 | """This class represents a session for using the U2netp model.""" | STRING |