License Details for the Segment Anything Model: Apache 2.0 Explained
The Segment Anything Model (SAM) and all code in the facebookresearch/segment-anything repository are released under the Apache License, Version 2.0, permitting commercial use, modification, and distribution provided you include the license text and state any changes.
The facebookresearch/segment-anything repository provides the official implementation of Meta's Segment Anything Model. Understanding the license details for the Segment Anything Model is essential for researchers and developers who want to integrate SAM into commercial products, academic projects, or derivative AI systems without legal uncertainty.
Apache 2.0 Permissions and Grant
According to the LICENSE file in the repository root, the Apache 2.0 license grants five core rights to users of the Segment Anything Model:
-
Commercial Use — You may use the model and code for any purpose, including commercial projects and proprietary applications.
-
Reproduction and Distribution — You can copy, modify, and distribute the source code or compiled binaries to third parties.
-
Modification — You are free to create derivative works based on SAM, provided you include a notice stating the changes you made.
-
Patent Grant — Contributors provide a worldwide, royalty-free patent license for any patents covering their contributions to the repository.
-
Sublicensing — You can grant downstream recipients the same rights to use, reproduce, and modify the code.
License Conditions and Limitations
The Apache 2.0 license imposes specific conditions that you must follow when redistributing the Segment Anything Model:
-
Include License Text — You must include a copy of the Apache 2.0 license text, typically by retaining the
LICENSEfile in any distribution. -
State Changes — If you modify the source files, you must add prominent notices stating the changes you made to the original work.
-
Retain Notices — If the repository contains a
NOTICEfile, its contents must be preserved in any derivative works you distribute.
The license also specifies important limitations:
-
No Warranty — The code and model weights are provided "as is" without warranties of any kind, express or implied.
-
No Liability — Contributors and copyright holders are not liable for any damages arising from the use of the Segment Anything Model.
-
Trademark Restrictions — You may not use Meta's trademarks without explicit permission, separate from the code license.
Key Licensing Files in the Repository
The facebookresearch/segment-anything repository contains the following governance documents:
-
LICENSE— Located at the repository root, this file contains the complete Apache 2.0 license text governing both the code and the model weights. -
README.md— The License section in the README provides a high-level summary of the licensing terms and links to the fullLICENSEfile for detailed reference. -
CONTRIBUTING.md— This file outlines guidelines for contributors and confirms that all contributions to the repository must comply with the Apache 2.0 license terms. -
CODE_OF_CONDUCT.md— While not directly related to licensing, this document establishes community standards for participants in the repository.
Accessing License Information Programmatically
When building applications that distribute SAM, you may need to display or log licensing information at runtime. The following Python snippet reads the bundled LICENSE file using importlib.resources (Python 3.9+):
import importlib.resources as pkg_resources
# Locate the LICENSE file bundled with the installed package
license_path = pkg_resources.files("segment_anything").joinpath("LICENSE")
# Read and print the license content
with open(license_path, "r", encoding="utf-8") as f:
print(f.read())
This code locates the LICENSE file that ships with the segment_anything package and prints its contents, ensuring you can programmatically verify compliance or display terms to end users.
Summary
- The Segment Anything Model is licensed under Apache License, Version 2.0, as explicitly stated in the repository's
LICENSEfile and README. - Commercial use is permitted, including integration into proprietary products and services without royalty payments.
- You must include the original license text and document any file modifications when redistributing the code or model weights.
- The license includes an explicit patent grant from contributors, protecting users from patent infringement claims related to the contributed code.
- Source files such as
LICENSE,README.md, andCONTRIBUTING.mddefine the complete legal framework for using SAM.
Frequently Asked Questions
Can I use the Segment Anything Model for commercial applications?
Yes. The Apache 2.0 license explicitly permits commercial use of the Segment Anything Model. You can integrate SAM into products, SaaS platforms, or internal company tools without paying royalties, provided you comply with the attribution and notice requirements specified in the LICENSE file.
Do I need to open-source my modifications to SAM?
No. The Apache 2.0 license does not require you to distribute your source code when you create derivative works based on SAM. However, you must include a prominent notice stating any changes you made to the original files, and you must retain the copyright notices and license text in your distribution.
What are the patent implications of using SAM?
The license includes an explicit patent grant from contributors. According to the LICENSE file, each contributor provides a worldwide, royalty-free, non-exclusive patent license covering their specific contributions to the Segment Anything Model. This protects users from patent infringement claims regarding the code and model weights as contributed to the repository.
Where can I find the official license text?
The official license text is located in the LICENSE file at the root of the facebookresearch/segment-anything repository. The README.md file also references these terms in its dedicated License section, providing a summary and direct link to the full legal text for quick reference.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →