segment-geospatial 1.4.0__tar.gz → 1.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/docker-image.yml +1 -1
  2. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/docker-publish.yml +1 -1
  3. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/docs-build.yml +1 -1
  4. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/docs.yml +1 -1
  5. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/draft-pdf.yml +1 -1
  6. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/macos.yml +1 -1
  7. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/publish.yml +1 -1
  8. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/pypi.yml +1 -1
  9. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/ubuntu.yml +1 -1
  10. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/workflows/windows.yml +1 -1
  11. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.pre-commit-config.yaml +1 -1
  12. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/PKG-INFO +1 -1
  13. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/pyproject.toml +2 -2
  14. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/metadata.txt +1 -1
  15. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/__init__.py +1 -1
  16. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/samgeo3.py +204 -65
  17. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/PKG-INFO +1 -1
  18. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.editorconfig +0 -0
  19. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/FUNDING.yml +0 -0
  20. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  21. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  23. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.github/dependabot.yaml +0 -0
  24. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/.gitignore +0 -0
  25. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/CITATION.cff +0 -0
  26. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/CODE_OF_CONDUCT.md +0 -0
  27. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/Dockerfile +0 -0
  28. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/LICENSE +0 -0
  29. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/MANIFEST.in +0 -0
  30. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/README.md +0 -0
  31. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/SAMGEO.md +0 -0
  32. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/README.md +0 -0
  33. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/__init__.py +0 -0
  34. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/__main__.py +0 -0
  35. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/__init__.py +0 -0
  36. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/data.py +0 -0
  37. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/export.py +0 -0
  38. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/model.py +0 -0
  39. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/project.py +0 -0
  40. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/segment.py +0 -0
  41. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/session.py +0 -0
  42. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/core/vector.py +0 -0
  43. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/samgeo_cli.py +0 -0
  44. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/skills/SKILL.md +0 -0
  45. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/tests/TEST.md +0 -0
  46. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/tests/__init__.py +0 -0
  47. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/tests/test_core.py +0 -0
  48. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/tests/test_full_e2e.py +0 -0
  49. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/utils/__init__.py +0 -0
  50. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/utils/repl_skin.py +0 -0
  51. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/cli_anything/samgeo/utils/samgeo_backend.py +0 -0
  52. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/agent-harness/setup.py +0 -0
  53. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/CNAME +0 -0
  54. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/api.md +0 -0
  55. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/assets/README.md +0 -0
  56. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/assets/favicon.png +0 -0
  57. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/assets/logo.png +0 -0
  58. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/assets/logo_rect.png +0 -0
  59. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/caption.md +0 -0
  60. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/changelog.md +0 -0
  61. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/changelog_update.py +0 -0
  62. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/common.md +0 -0
  63. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/contributing.md +0 -0
  64. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/detectree2.md +0 -0
  65. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/arcgis.ipynb +0 -0
  66. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/automatic_mask_generator.ipynb +0 -0
  67. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/automatic_mask_generator_hq.ipynb +0 -0
  68. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/box_prompts.ipynb +0 -0
  69. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/data/tree_boxes.geojson +0 -0
  70. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/detectree2.ipynb +0 -0
  71. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/fast_sam.ipynb +0 -0
  72. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/image_captioning.ipynb +0 -0
  73. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/input_prompts.ipynb +0 -0
  74. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/input_prompts_hq.ipynb +0 -0
  75. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/maxar_open_data.ipynb +0 -0
  76. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_automatic.ipynb +0 -0
  77. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_box_prompts.ipynb +0 -0
  78. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_point_prompts.ipynb +0 -0
  79. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_predictor.ipynb +0 -0
  80. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_text_prompts.ipynb +0 -0
  81. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam2_video.ipynb +0 -0
  82. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_automated_segmentation.ipynb +0 -0
  83. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_batch_segmentation.ipynb +0 -0
  84. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_box_prompts.ipynb +0 -0
  85. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_image_segmentation.ipynb +0 -0
  86. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_image_segmentation_jpg.ipynb +0 -0
  87. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_interactive.ipynb +0 -0
  88. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_object_tracking.ipynb +0 -0
  89. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_point_prompts.ipynb +0 -0
  90. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_point_prompts_batch.ipynb +0 -0
  91. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_tiled_segmentation.ipynb +0 -0
  92. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_video_masks.ipynb +0 -0
  93. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_video_prompts.ipynb +0 -0
  94. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/sam3_video_segmentation.ipynb +0 -0
  95. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/satellite-predictor.ipynb +0 -0
  96. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/satellite.ipynb +0 -0
  97. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/text_prompts.ipynb +0 -0
  98. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/text_prompts_batch.ipynb +0 -0
  99. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/text_swimming_pools.ipynb +0 -0
  100. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/examples/tree_mapping.ipynb +0 -0
  101. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/faq.md +0 -0
  102. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/fast_sam.md +0 -0
  103. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/hq_sam.md +0 -0
  104. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/index.md +0 -0
  105. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/installation.md +0 -0
  106. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/overrides/main.html +0 -0
  107. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/samgeo.md +0 -0
  108. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/samgeo2.md +0 -0
  109. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/samgeo3.md +0 -0
  110. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/text_sam.md +0 -0
  111. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/usage.md +0 -0
  112. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/workshops/AIforGood_2025.ipynb +0 -0
  113. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/workshops/IPPN_2024.ipynb +0 -0
  114. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/workshops/cn_workshop.ipynb +0 -0
  115. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/workshops/jupytext.toml +0 -0
  116. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/docs/workshops/purdue.ipynb +0 -0
  117. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/mkdocs.yml +0 -0
  118. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/package_plugin.py +0 -0
  119. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/paper/10.21105.joss.05663.pdf +0 -0
  120. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/paper/paper.bib +0 -0
  121. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/paper/paper.md +0 -0
  122. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/LICENSE +0 -0
  123. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/README.md +0 -0
  124. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/__init__.py +0 -0
  125. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/icons/icon.png +0 -0
  126. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/install_plugin.py +0 -0
  127. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/install_plugin.sh +0 -0
  128. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/map_tools.py +0 -0
  129. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/resources.py +0 -0
  130. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/samgeo_plugin.py +0 -0
  131. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/qgis-samgeo-plugin/test_plugin.py +0 -0
  132. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/requirements.txt +0 -0
  133. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/requirements_dev.txt +0 -0
  134. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/requirements_docs.txt +0 -0
  135. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/api.py +0 -0
  136. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/caption.py +0 -0
  137. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/common.py +0 -0
  138. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/detectree2.py +0 -0
  139. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/fast_sam.py +0 -0
  140. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/fer.py +0 -0
  141. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/hq_sam.py +0 -0
  142. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/model_registry.py +0 -0
  143. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/samgeo.py +0 -0
  144. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/samgeo2.py +0 -0
  145. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/text_sam.py +0 -0
  146. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/samgeo/utmconv.py +0 -0
  147. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/scripts/upload_to_qgis_plugin_repo.py +0 -0
  148. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/SOURCES.txt +0 -0
  149. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/dependency_links.txt +0 -0
  150. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/entry_points.txt +0 -0
  151. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/requires.txt +0 -0
  152. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/segment_geospatial.egg-info/top_level.txt +0 -0
  153. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/setup.cfg +0 -0
  154. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/__init__.py +0 -0
  155. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_api.py +0 -0
  156. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_common.py +0 -0
  157. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_model_registry.py +0 -0
  158. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_samgeo.py +0 -0
  159. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_samgeo3.py +0 -0
  160. {segment_geospatial-1.4.0 → segment_geospatial-1.4.1}/tests/test_utmconv.py +0 -0
@@ -11,6 +11,6 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v6
14
+ - uses: actions/checkout@v7
15
15
  - name: Build the Docker image
16
16
  run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)
@@ -13,7 +13,7 @@ jobs:
13
13
  contents: read
14
14
  steps:
15
15
  - name: Check out the repo
16
- uses: actions/checkout@v6
16
+ uses: actions/checkout@v7
17
17
 
18
18
  - name: Log in to Docker Hub
19
19
  uses: docker/login-action@v4
@@ -10,7 +10,7 @@ jobs:
10
10
  run:
11
11
  shell: bash -el {0}
12
12
  steps:
13
- - uses: actions/checkout@v6
13
+ - uses: actions/checkout@v7
14
14
  with:
15
15
  fetch-depth: 0
16
16
  - name: Setup micromamba
@@ -7,7 +7,7 @@ jobs:
7
7
  deploy:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
- - uses: actions/checkout@v6
10
+ - uses: actions/checkout@v7
11
11
  - uses: actions/setup-python@v6
12
12
  with:
13
13
  python-version: "3.12"
@@ -6,7 +6,7 @@ jobs:
6
6
  name: Paper Draft
7
7
  steps:
8
8
  - name: Checkout
9
- uses: actions/checkout@v6
9
+ uses: actions/checkout@v7
10
10
  - name: Build draft PDF
11
11
  uses: openjournals/openjournals-draft-action@master
12
12
  with:
@@ -22,7 +22,7 @@ jobs:
22
22
  env:
23
23
  SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
24
24
  steps:
25
- - uses: actions/checkout@v6
25
+ - uses: actions/checkout@v7
26
26
 
27
27
  - name: Setup micromamba
28
28
  uses: mamba-org/setup-micromamba@v3
@@ -23,7 +23,7 @@ jobs:
23
23
  PLUGIN_NAME: samgeo_plugin
24
24
  ZIP_PATH: dist/samgeo_plugin.zip
25
25
  steps:
26
- - uses: actions/checkout@v6
26
+ - uses: actions/checkout@v7
27
27
 
28
28
  - uses: actions/setup-python@v6
29
29
  with:
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
 
14
14
  steps:
15
- - uses: actions/checkout@v6
15
+ - uses: actions/checkout@v7
16
16
  - name: Set up Python
17
17
  uses: actions/setup-python@v6
18
18
  with:
@@ -26,7 +26,7 @@ jobs:
26
26
  shell: bash -el {0}
27
27
  steps:
28
28
  - name: CHECKOUT CODE
29
- uses: actions/checkout@v6
29
+ uses: actions/checkout@v7
30
30
  - name: Setup micromamba
31
31
  uses: mamba-org/setup-micromamba@v3
32
32
  with:
@@ -14,7 +14,7 @@ jobs:
14
14
  run:
15
15
  shell: bash -el {0}
16
16
  steps:
17
- - uses: actions/checkout@v6
17
+ - uses: actions/checkout@v7
18
18
  - name: Setup micromamba
19
19
  uses: mamba-org/setup-micromamba@v3
20
20
  with:
@@ -12,7 +12,7 @@ repos:
12
12
  args: ["--maxkb=500"]
13
13
 
14
14
  - repo: https://github.com/astral-sh/ruff-pre-commit
15
- rev: v0.15.17
15
+ rev: v0.15.20
16
16
  hooks:
17
17
  - id: ruff
18
18
  types_or: [pyi, jupyter]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: segment-geospatial
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: Meta AI's Segment Anything Model (SAM) for Geospatial Data.
5
5
  Author-email: Qiusheng Wu <giswqs@gmail.com>
6
6
  License: MIT license
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "segment-geospatial"
7
- version = "1.4.0"
7
+ version = "1.4.1"
8
8
  dynamic = [
9
9
  "dependencies",
10
10
  ]
@@ -117,7 +117,7 @@ dependencies = {file = ["requirements.txt"]}
117
117
  universal = true
118
118
 
119
119
  [tool.bumpversion]
120
- current_version = "1.4.0"
120
+ current_version = "1.4.1"
121
121
  commit = true
122
122
  tag = true
123
123
 
@@ -2,7 +2,7 @@
2
2
  name=SamGeo
3
3
  qgisMinimumVersion=3.22
4
4
  description=Segment remote sensing images using SAM (Segment Anything Model) with text, point, and box prompts.
5
- version=1.4.0
5
+ version=1.4.1
6
6
  author=Qiusheng Wu
7
7
  email=giswqs@gmail.com
8
8
  about=A QGIS plugin for remote sensing image segmentation powered by Meta's Segment Anything Model (SAM).
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = """Qiusheng Wu"""
4
4
  __email__ = "giswqs@gmail.com"
5
- __version__ = "1.4.0"
5
+ __version__ = "1.4.1"
6
6
 
7
7
 
8
8
  from .samgeo import * # noqa: F403
@@ -4,7 +4,11 @@ https://github.com/facebookresearch/sam3
4
4
 
5
5
  import glob
6
6
  import inspect
7
+ import logging
7
8
  import os
9
+ import warnings
10
+ import weakref
11
+ from contextlib import nullcontext
8
12
  from typing import Any, Dict, List, Optional, Tuple, Union
9
13
 
10
14
  import cv2
@@ -16,6 +20,7 @@ from tqdm import tqdm
16
20
  SAM3_META_IMPORT_ERROR = None
17
21
  download_ckpt_from_hf = None
18
22
  try:
23
+ import torch
19
24
  from sam3.model_builder import build_sam3_image_model, build_sam3_video_predictor
20
25
 
21
26
  try:
@@ -62,10 +67,34 @@ except ImportError:
62
67
  pass
63
68
 
64
69
 
70
+ logger = logging.getLogger(__name__)
71
+
65
72
  SAM31_CKPT_NAME = "sam3.1_multiplex.pt"
66
73
  SAM31_CONFIG_NAME = "config.json"
67
74
 
68
75
 
76
+ def _tensor_to_numpy(tensor):
77
+ """Convert a torch tensor to a numpy array, upcasting unsupported dtypes.
78
+
79
+ NumPy has no bfloat16 (or float16) scalar type, so tensors produced under
80
+ the Meta backend's bfloat16 autocast raise ``TypeError: Got unsupported
81
+ ScalarType BFloat16`` when passed directly to ``.numpy()``. This helper
82
+ moves the tensor to CPU and casts bfloat16/float16 tensors to float32
83
+ before conversion. Non-floating tensors (e.g. boolean masks) are converted
84
+ unchanged.
85
+
86
+ Args:
87
+ tensor (torch.Tensor): The tensor to convert.
88
+
89
+ Returns:
90
+ numpy.ndarray: The tensor as a numpy array.
91
+ """
92
+ tensor = tensor.detach().cpu()
93
+ if tensor.dtype in (torch.bfloat16, torch.float16):
94
+ tensor = tensor.float()
95
+ return tensor.numpy()
96
+
97
+
69
98
  def _download_sam31_checkpoint():
70
99
  """Download the SAM 3.1 checkpoint with released and source sam3 builds."""
71
100
  if download_ckpt_from_hf is not None:
@@ -315,6 +344,24 @@ class SamGeo3:
315
344
  )
316
345
  # For transformers backend, the threshold is stored and used during generate_masks
317
346
 
347
+ def _meta_autocast(self):
348
+ """Return a bfloat16 autocast context for the Meta backend on CUDA.
349
+
350
+ SAM3's fused ``addmm_act`` kernel (``sam3/perflib/fused.py``) casts
351
+ activations to bfloat16 on CUDA while the surrounding ``Linear`` layers
352
+ keep their float32 weights. Running the forward pass under bfloat16
353
+ autocast keeps activation and weight dtypes consistent (matching how
354
+ Meta runs the model) and avoids a ``mat1 and mat2 must have the same
355
+ dtype`` runtime error. On non-CUDA devices this is a no-op context.
356
+
357
+ Returns:
358
+ A context manager: ``torch.autocast`` on CUDA, otherwise
359
+ ``contextlib.nullcontext``.
360
+ """
361
+ if self.backend == "meta" and str(self.device).startswith("cuda"):
362
+ return torch.autocast(device_type="cuda", dtype=torch.bfloat16)
363
+ return nullcontext()
364
+
318
365
  def set_image(
319
366
  self,
320
367
  image: Union[str, np.ndarray],
@@ -375,9 +422,10 @@ class SamGeo3:
375
422
  if self.backend == "meta":
376
423
  # SAM3's processor expects PIL Image or tensor with (C, H, W) format
377
424
  # Numpy arrays from cv2 have (H, W, C) format which causes incorrect dimension extraction
378
- self.inference_state = self.processor.set_image(
379
- image_for_processor, state=state
380
- )
425
+ with self._meta_autocast():
426
+ self.inference_state = self.processor.set_image(
427
+ image_for_processor, state=state
428
+ )
381
429
  else: # transformers
382
430
  # For Transformers backend, we just store the PIL image
383
431
  # Processing will happen during generate_masks
@@ -456,7 +504,8 @@ class SamGeo3:
456
504
  self.sources_batch = sources
457
505
 
458
506
  # Call the processor's set_image_batch method
459
- self.batch_state = self.processor.set_image_batch(pil_images, state=state)
507
+ with self._meta_autocast():
508
+ self.batch_state = self.processor.set_image_batch(pil_images, state=state)
460
509
 
461
510
  print(f"Set {len(pil_images)} images for batch processing.")
462
511
 
@@ -518,7 +567,10 @@ class SamGeo3:
518
567
 
519
568
  # Reset prompts and set text prompt for this image
520
569
  self.processor.reset_all_prompts(image_state)
521
- output = self.processor.set_text_prompt(state=image_state, prompt=prompt)
570
+ with self._meta_autocast():
571
+ output = self.processor.set_text_prompt(
572
+ state=image_state, prompt=prompt
573
+ )
522
574
 
523
575
  # Build result for this image
524
576
  result = {
@@ -672,14 +724,14 @@ class SamGeo3:
672
724
  # If it's a batched tensor, split into list
673
725
  if masks.dim() >= 3:
674
726
  for i in range(masks.shape[0]):
675
- converted_masks.append(masks[i].cpu().numpy())
727
+ converted_masks.append(_tensor_to_numpy(masks[i]))
676
728
  else:
677
- converted_masks.append(masks.cpu().numpy())
729
+ converted_masks.append(_tensor_to_numpy(masks))
678
730
  else:
679
731
  # It's already a list
680
732
  for mask in masks:
681
- if hasattr(mask, "cpu"):
682
- mask_np = mask.cpu().numpy()
733
+ if isinstance(mask, torch.Tensor):
734
+ mask_np = _tensor_to_numpy(mask)
683
735
  elif hasattr(mask, "numpy"):
684
736
  mask_np = mask.numpy()
685
737
  else:
@@ -695,13 +747,13 @@ class SamGeo3:
695
747
  # If it's a batched tensor [N, 4], split into list
696
748
  if boxes.dim() == 2:
697
749
  for i in range(boxes.shape[0]):
698
- converted_boxes.append(boxes[i].cpu().numpy())
750
+ converted_boxes.append(_tensor_to_numpy(boxes[i]))
699
751
  else:
700
- converted_boxes.append(boxes.cpu().numpy())
752
+ converted_boxes.append(_tensor_to_numpy(boxes))
701
753
  else:
702
754
  for box in boxes:
703
- if hasattr(box, "cpu"):
704
- box_np = box.cpu().numpy()
755
+ if isinstance(box, torch.Tensor):
756
+ box_np = _tensor_to_numpy(box)
705
757
  elif hasattr(box, "numpy"):
706
758
  box_np = box.numpy()
707
759
  else:
@@ -715,7 +767,7 @@ class SamGeo3:
715
767
  converted_scores = []
716
768
  if isinstance(scores, torch.Tensor):
717
769
  # If it's a 1D tensor of scores
718
- scores_np = scores.cpu().numpy()
770
+ scores_np = _tensor_to_numpy(scores)
719
771
  if scores_np.ndim == 0:
720
772
  converted_scores.append(float(scores_np))
721
773
  else:
@@ -723,11 +775,11 @@ class SamGeo3:
723
775
  converted_scores.append(float(s))
724
776
  else:
725
777
  for score in scores:
726
- if hasattr(score, "cpu"):
778
+ if isinstance(score, torch.Tensor):
727
779
  score_val = (
728
- score.cpu().item()
729
- if hasattr(score, "numel") and score.numel() == 1
730
- else score.cpu().numpy()
780
+ score.item()
781
+ if score.numel() == 1
782
+ else _tensor_to_numpy(score)
731
783
  )
732
784
  elif hasattr(score, "item"):
733
785
  score_val = score.item()
@@ -1144,9 +1196,10 @@ class SamGeo3:
1144
1196
  """
1145
1197
  if self.backend == "meta":
1146
1198
  self.processor.reset_all_prompts(self.inference_state)
1147
- output = self.processor.set_text_prompt(
1148
- state=self.inference_state, prompt=prompt
1149
- )
1199
+ with self._meta_autocast():
1200
+ output = self.processor.set_text_prompt(
1201
+ state=self.inference_state, prompt=prompt
1202
+ )
1150
1203
 
1151
1204
  self.masks = output["masks"]
1152
1205
  self.boxes = output["boxes"]
@@ -1384,7 +1437,8 @@ class SamGeo3:
1384
1437
  self.pil_image = pil_image
1385
1438
 
1386
1439
  if self.backend == "meta":
1387
- self.inference_state = self.processor.set_image(pil_image)
1440
+ with self._meta_autocast():
1441
+ self.inference_state = self.processor.set_image(pil_image)
1388
1442
  else:
1389
1443
  # For transformers backend, process directly
1390
1444
  pass
@@ -1737,9 +1791,10 @@ class SamGeo3:
1737
1791
  norm_box = [cx / width, cy / height, w / width, h / height]
1738
1792
 
1739
1793
  # Add geometric prompt
1740
- self.inference_state = self.processor.add_geometric_prompt(
1741
- state=self.inference_state, box=norm_box, label=label
1742
- )
1794
+ with self._meta_autocast():
1795
+ self.inference_state = self.processor.add_geometric_prompt(
1796
+ state=self.inference_state, box=norm_box, label=label
1797
+ )
1743
1798
 
1744
1799
  # Get the masks from the inference state
1745
1800
  output = self.inference_state
@@ -2199,11 +2254,11 @@ class SamGeo3:
2199
2254
  # Convert masks to numpy
2200
2255
  converted_masks = []
2201
2256
  for mask in self.masks:
2202
- if hasattr(mask, "cpu"):
2203
- # PyTorch tensor on GPU
2204
- mask_np = mask.cpu().numpy()
2257
+ if isinstance(mask, torch.Tensor):
2258
+ # PyTorch tensor (upcasts bf16/fp16 which numpy cannot handle)
2259
+ mask_np = _tensor_to_numpy(mask)
2205
2260
  elif hasattr(mask, "numpy"):
2206
- # PyTorch tensor on CPU
2261
+ # Array-like exposing numpy()
2207
2262
  mask_np = mask.numpy()
2208
2263
  else:
2209
2264
  # Already numpy or other array-like
@@ -2215,8 +2270,8 @@ class SamGeo3:
2215
2270
  if self.boxes is not None:
2216
2271
  converted_boxes = []
2217
2272
  for box in self.boxes:
2218
- if hasattr(box, "cpu"):
2219
- box_np = box.cpu().numpy()
2273
+ if isinstance(box, torch.Tensor):
2274
+ box_np = _tensor_to_numpy(box)
2220
2275
  elif hasattr(box, "numpy"):
2221
2276
  box_np = box.numpy()
2222
2277
  else:
@@ -2228,11 +2283,11 @@ class SamGeo3:
2228
2283
  if self.scores is not None:
2229
2284
  converted_scores = []
2230
2285
  for score in self.scores:
2231
- if hasattr(score, "cpu"):
2286
+ if isinstance(score, torch.Tensor):
2232
2287
  score_val = (
2233
- score.cpu().item()
2288
+ score.item()
2234
2289
  if score.numel() == 1
2235
- else score.cpu().numpy()
2290
+ else _tensor_to_numpy(score)
2236
2291
  )
2237
2292
  elif hasattr(score, "item"):
2238
2293
  score_val = score.item()
@@ -3283,16 +3338,17 @@ class SamGeo3:
3283
3338
  box = np.array(transformed_boxes)
3284
3339
 
3285
3340
  # Call the model's predict_inst method
3286
- masks, scores, logits = self.model.predict_inst(
3287
- self.inference_state,
3288
- point_coords=point_coords,
3289
- point_labels=point_labels,
3290
- box=box,
3291
- mask_input=mask_input,
3292
- multimask_output=multimask_output,
3293
- return_logits=return_logits,
3294
- normalize_coords=normalize_coords,
3295
- )
3341
+ with self._meta_autocast():
3342
+ masks, scores, logits = self.model.predict_inst(
3343
+ self.inference_state,
3344
+ point_coords=point_coords,
3345
+ point_labels=point_labels,
3346
+ box=box,
3347
+ mask_input=mask_input,
3348
+ multimask_output=multimask_output,
3349
+ return_logits=return_logits,
3350
+ normalize_coords=normalize_coords,
3351
+ )
3296
3352
 
3297
3353
  # Store results
3298
3354
  self.masks = (
@@ -3420,16 +3476,17 @@ class SamGeo3:
3420
3476
  )
3421
3477
 
3422
3478
  # Call the model's predict_inst_batch method
3423
- masks_batch, scores_batch, logits_batch = self.model.predict_inst_batch(
3424
- self.batch_state,
3425
- point_coords_batch,
3426
- point_labels_batch,
3427
- box_batch=box_batch,
3428
- mask_input_batch=mask_input_batch,
3429
- multimask_output=multimask_output,
3430
- return_logits=return_logits,
3431
- normalize_coords=normalize_coords,
3432
- )
3479
+ with self._meta_autocast():
3480
+ masks_batch, scores_batch, logits_batch = self.model.predict_inst_batch(
3481
+ self.batch_state,
3482
+ point_coords_batch,
3483
+ point_labels_batch,
3484
+ box_batch=box_batch,
3485
+ mask_input_batch=mask_input_batch,
3486
+ multimask_output=multimask_output,
3487
+ return_logits=return_logits,
3488
+ normalize_coords=normalize_coords,
3489
+ )
3433
3490
 
3434
3491
  return masks_batch, scores_batch, logits_batch
3435
3492
 
@@ -3647,22 +3704,26 @@ class SamGeo3:
3647
3704
  # Use set_image_batch with the current image
3648
3705
  if self.images_batch is None:
3649
3706
  pil_image = Image.fromarray(self.image)
3650
- self.batch_state = self.processor.set_image_batch([pil_image], state=None)
3707
+ with self._meta_autocast():
3708
+ self.batch_state = self.processor.set_image_batch(
3709
+ [pil_image], state=None
3710
+ )
3651
3711
  self.images_batch = [self.image]
3652
3712
  self.sources_batch = [self.source]
3653
3713
 
3654
3714
  # Call predict_inst_batch with the formatted points
3655
3715
  # predict_inst_batch expects batches per image, we have one image with multiple points
3656
- masks_batch, scores_batch, logits_batch = self.model.predict_inst_batch(
3657
- self.batch_state,
3658
- [points], # One entry for our single image
3659
- [labels], # One entry for our single image
3660
- box_batch=None,
3661
- mask_input_batch=None,
3662
- multimask_output=multimask_output,
3663
- return_logits=False,
3664
- normalize_coords=True,
3665
- )
3716
+ with self._meta_autocast():
3717
+ masks_batch, scores_batch, logits_batch = self.model.predict_inst_batch(
3718
+ self.batch_state,
3719
+ [points], # One entry for our single image
3720
+ [labels], # One entry for our single image
3721
+ box_batch=None,
3722
+ mask_input_batch=None,
3723
+ multimask_output=multimask_output,
3724
+ return_logits=False,
3725
+ normalize_coords=True,
3726
+ )
3666
3727
 
3667
3728
  # Extract results for our single image
3668
3729
  masks = masks_batch[0]
@@ -4032,6 +4093,13 @@ class SamGeo3Video:
4032
4093
  >>> sam.close()
4033
4094
  """
4034
4095
 
4096
+ # Weak reference to the most recently created instance so a new instance
4097
+ # can tear down a previous one before initializing (see
4098
+ # _cleanup_previous_predictor). A weakref is used so this class-level
4099
+ # tracking does not itself keep the instance (and its worker processes /
4100
+ # GPU memory) alive after the user drops their own reference.
4101
+ _active_predictor: Optional["weakref.ReferenceType[SamGeo3Video]"] = None
4102
+
4035
4103
  def __init__(
4036
4104
  self,
4037
4105
  gpus_to_use: Optional[List[int]] = None,
@@ -4078,9 +4146,17 @@ class SamGeo3Video:
4078
4146
 
4079
4147
  print(f"Using GPUs: {gpus_to_use}")
4080
4148
 
4149
+ # The SAM3 multi-GPU predictor asserts that no torch.distributed process
4150
+ # group is already initialized. A previous SamGeo3Video created in the
4151
+ # same session (e.g. re-running a notebook cell) leaves its group and
4152
+ # worker processes alive, which would trip that assertion. Tear down any
4153
+ # previous predictor and stale process group before building a new one.
4154
+ self._cleanup_previous_predictor()
4155
+
4081
4156
  self.predictor = build_sam3_video_predictor(
4082
4157
  gpus_to_use=gpus_to_use, bpe_path=bpe_path, **kwargs
4083
4158
  )
4159
+ SamGeo3Video._active_predictor = weakref.ref(self)
4084
4160
  self.gpus_to_use = gpus_to_use
4085
4161
  self.session_id = None
4086
4162
  self.video_path = None
@@ -4092,6 +4168,66 @@ class SamGeo3Video:
4092
4168
  self._tif_dir = None
4093
4169
  self._tif_names = None
4094
4170
 
4171
+ @staticmethod
4172
+ def _cleanup_previous_predictor() -> None:
4173
+ """Tear down a previously created predictor and any stale process group.
4174
+
4175
+ The SAM3 multi-GPU video predictor initializes a ``torch.distributed``
4176
+ process group and spawns worker processes, and it asserts that no
4177
+ process group is already initialized when it starts. Because
4178
+ ``__del__`` only closes the active session (not the predictor), a
4179
+ previous ``SamGeo3Video`` instance created in the same Python process
4180
+ keeps its process group and workers alive, causing an ``AssertionError``
4181
+ when a new instance is created (for example, when a notebook cell is
4182
+ re-run).
4183
+
4184
+ This method shuts down the previously tracked predictor (which notifies
4185
+ its workers and destroys its process group) and, as a fallback, destroys
4186
+ any process group that is still initialized. If a process group is found
4187
+ but no previous ``SamGeo3Video`` was tracked, the group may belong to
4188
+ other code in the process, so a warning is emitted before it is
4189
+ destroyed (the SAM3 predictor cannot start while a group is
4190
+ initialized).
4191
+ """
4192
+ import torch
4193
+
4194
+ ref = SamGeo3Video._active_predictor
4195
+ previous = ref() if ref is not None else None
4196
+ if previous is not None:
4197
+ try:
4198
+ previous.shutdown()
4199
+ except Exception:
4200
+ # Don't let a partial teardown block creating the new predictor,
4201
+ # but surface it so cleanup problems can be diagnosed.
4202
+ logger.warning(
4203
+ "Failed to shut down the previous SamGeo3Video cleanly; "
4204
+ "falling back to destroying the process group.",
4205
+ exc_info=True,
4206
+ )
4207
+ finally:
4208
+ SamGeo3Video._active_predictor = None
4209
+
4210
+ # Fallback: a process group may still be initialized (the previous
4211
+ # shutdown failed part-way, the previous instance was garbage-collected
4212
+ # without shutdown(), or it was set up outside of SamGeo3Video).
4213
+ if torch.distributed.is_available() and torch.distributed.is_initialized():
4214
+ if previous is None:
4215
+ warnings.warn(
4216
+ "An existing torch.distributed process group was found and "
4217
+ "will be destroyed so the SAM3 video predictor can "
4218
+ "initialize. If this group belongs to other code, create "
4219
+ "the SamGeo3Video instance before initializing that group.",
4220
+ stacklevel=2,
4221
+ )
4222
+ try:
4223
+ torch.distributed.destroy_process_group()
4224
+ except Exception:
4225
+ logger.warning(
4226
+ "Failed to destroy the existing torch.distributed process "
4227
+ "group.",
4228
+ exc_info=True,
4229
+ )
4230
+
4095
4231
  def set_video(
4096
4232
  self,
4097
4233
  video_path: str,
@@ -5338,6 +5474,9 @@ class SamGeo3Video:
5338
5474
  """
5339
5475
  self.close()
5340
5476
  self.predictor.shutdown()
5477
+ ref = SamGeo3Video._active_predictor
5478
+ if ref is not None and ref() is self:
5479
+ SamGeo3Video._active_predictor = None
5341
5480
  print("Predictor shutdown complete.")
5342
5481
 
5343
5482
  def __del__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: segment-geospatial
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary: Meta AI's Segment Anything Model (SAM) for Geospatial Data.
5
5
  Author-email: Qiusheng Wu <giswqs@gmail.com>
6
6
  License: MIT license