Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "sam3"
dynamic = ["version"]
description = "SAM3 (Segment Anything Model 3) implementation"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "Meta AI Research"}
Expand All @@ -17,16 +17,16 @@ classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"timm>=1.0.17",
"numpy>=1.26,<2",
"numpy>=1.26",
"tqdm",
"ftfy==6.1.1",
"regex",
Expand Down Expand Up @@ -107,6 +107,9 @@ first_party_detection = false
[tool.ufmt]
formatter = "ruff-api"

[tool.ruff.lint]
select = ["NPY201"]

[tool.mypy]
python_version = "3.12"
warn_return_any = true
Expand Down
6 changes: 3 additions & 3 deletions sam3/agent/helpers/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,22 @@ def non_empty_mask(self):
assert len(empty_ids) == 1, (
">1 ids corresponds to no labels. This is currently not supported"
)
return (self._seg != empty_ids[0]).numpy().astype(np.bool)
return (self._seg != empty_ids[0]).numpy().astype(np.bool_)

def semantic_masks(self):
for sid in self._seg_ids:
sinfo = self._sinfo.get(sid)
if sinfo is None or sinfo["isthing"]:
# Some pixels (e.g. id 0 in PanopticFPN) have no instance or semantic predictions.
continue
yield (self._seg == sid).numpy().astype(np.bool), sinfo
yield (self._seg == sid).numpy().astype(np.bool_), sinfo

def instance_masks(self):
for sid in self._seg_ids:
sinfo = self._sinfo.get(sid)
if sinfo is None or not sinfo["isthing"]:
continue
mask = (self._seg == sid).numpy().astype(np.bool)
mask = (self._seg == sid).numpy().astype(np.bool_)
if mask.sum() > 0:
yield mask, sinfo

Expand Down
Loading