geoai-py 0.10.0__tar.gz → 0.11.0__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 (144) hide show
  1. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/pypi.yml +1 -1
  2. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/windows.yml +3 -3
  3. {geoai_py-0.10.0 → geoai_py-0.11.0}/.gitignore +1 -0
  4. {geoai_py-0.10.0 → geoai_py-0.11.0}/PKG-INFO +1 -1
  5. geoai_py-0.11.0/docs/dinov3.md +3 -0
  6. geoai_py-0.11.0/docs/examples/AlphaEarth.ipynb +201 -0
  7. geoai_py-0.11.0/docs/examples/DINOv3.ipynb +157 -0
  8. geoai_py-0.11.0/docs/examples/DINOv3_visualization.ipynb +350 -0
  9. geoai_py-0.11.0/docs/examples/JPEG2000.ipynb +361 -0
  10. geoai_py-0.11.0/docs/map_widgets.md +3 -0
  11. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/__init__.py +2 -1
  12. geoai_py-0.11.0/geoai/dinov3.py +1146 -0
  13. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/geoai.py +11 -0
  14. geoai_py-0.11.0/geoai/map_widgets.py +174 -0
  15. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/train.py +8 -2
  16. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/utils.py +11 -0
  17. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/PKG-INFO +1 -1
  18. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/SOURCES.txt +8 -0
  19. {geoai_py-0.10.0 → geoai_py-0.11.0}/mkdocs.yml +6 -0
  20. {geoai_py-0.10.0 → geoai_py-0.11.0}/pyproject.toml +2 -2
  21. {geoai_py-0.10.0 → geoai_py-0.11.0}/.dockerignore +0 -0
  22. {geoai_py-0.10.0 → geoai_py-0.11.0}/.editorconfig +0 -0
  23. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/FUNDING.yml +0 -0
  24. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  25. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  26. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  27. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/dependabot.yml +0 -0
  28. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/docker-image.yml +0 -0
  29. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/docker-publish.yml +0 -0
  30. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/docs-build.yml +0 -0
  31. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/docs.yml +0 -0
  32. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/macos.yml +0 -0
  33. {geoai_py-0.10.0 → geoai_py-0.11.0}/.github/workflows/ubuntu.yml +0 -0
  34. {geoai_py-0.10.0 → geoai_py-0.11.0}/.pre-commit-config.yaml +0 -0
  35. {geoai_py-0.10.0 → geoai_py-0.11.0}/Dockerfile +0 -0
  36. {geoai_py-0.10.0 → geoai_py-0.11.0}/LICENSE +0 -0
  37. {geoai_py-0.10.0 → geoai_py-0.11.0}/MANIFEST.in +0 -0
  38. {geoai_py-0.10.0 → geoai_py-0.11.0}/README.md +0 -0
  39. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/CNAME +0 -0
  40. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/assets/logo.ico +0 -0
  41. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/assets/logo.png +0 -0
  42. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/assets/logo_rect.png +0 -0
  43. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/change_detection.md +0 -0
  44. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/changelog.md +0 -0
  45. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/classify.md +0 -0
  46. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/contributing.md +0 -0
  47. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/detectron2.md +0 -0
  48. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/download.md +0 -0
  49. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/_template.ipynb +0 -0
  50. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/batch_segmentation.ipynb +0 -0
  51. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/building_detection_lidar.ipynb +0 -0
  52. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/building_footprints_africa.ipynb +0 -0
  53. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/building_footprints_china.ipynb +0 -0
  54. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/building_footprints_usa.ipynb +0 -0
  55. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/building_regularization.ipynb +0 -0
  56. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/car_detection.ipynb +0 -0
  57. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/change_detection.ipynb +0 -0
  58. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/create_vector.ipynb +0 -0
  59. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/data_visualization.ipynb +0 -0
  60. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
  61. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/dataviz/raster_viz.ipynb +0 -0
  62. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/dataviz/vector_viz.ipynb +0 -0
  63. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/download_data.ipynb +0 -0
  64. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/download_naip.ipynb +0 -0
  65. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/download_sentinel2.ipynb +0 -0
  66. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/edit_vector.ipynb +0 -0
  67. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/geometric_properties.ipynb +0 -0
  68. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/globe_projection.ipynb +0 -0
  69. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/grounded_sam.ipynb +0 -0
  70. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/image_chips.ipynb +0 -0
  71. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/image_tiling.ipynb +0 -0
  72. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/instance_segmentation.ipynb +0 -0
  73. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/jupytext.toml +0 -0
  74. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/load_model_checkpoint.ipynb +0 -0
  75. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/parking_spot_detection.ipynb +0 -0
  76. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/planetary_computer.ipynb +0 -0
  77. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
  78. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/regularization.ipynb +0 -0
  79. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/arcgis.ipynb +0 -0
  80. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
  81. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
  82. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/box_prompts.ipynb +0 -0
  83. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/fast_sam.ipynb +0 -0
  84. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/input_prompts.ipynb +0 -0
  85. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
  86. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
  87. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
  88. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/satellite.ipynb +0 -0
  89. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
  90. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/text_prompts.ipynb +0 -0
  91. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
  92. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/samgeo.ipynb +0 -0
  93. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/ship_detection.ipynb +0 -0
  94. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/solar_panel_detection.ipynb +0 -0
  95. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/text_prompt_segmentation.ipynb +0 -0
  96. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_building_footprints_usa.ipynb +0 -0
  97. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_car_detection.ipynb +0 -0
  98. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_landcover_classification.ipynb +0 -0
  99. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_object_detection_model.ipynb +0 -0
  100. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_segmentation_model.ipynb +0 -0
  101. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_ship_detection.ipynb +0 -0
  102. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_solar_panel_detection.ipynb +0 -0
  103. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/train_water_detection.ipynb +0 -0
  104. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/view_metadata.ipynb +0 -0
  105. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/water_detection.ipynb +0 -0
  106. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/water_detection_s2.ipynb +0 -0
  107. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/water_dynamics.ipynb +0 -0
  108. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/wetland_dynamics.ipynb +0 -0
  109. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/examples/wetland_mapping.ipynb +0 -0
  110. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/extract.md +0 -0
  111. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/faq.md +0 -0
  112. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/geoai.md +0 -0
  113. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/hf.md +0 -0
  114. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/index.md +0 -0
  115. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/installation.md +0 -0
  116. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/overrides/main.html +0 -0
  117. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/sam.md +0 -0
  118. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/segment.md +0 -0
  119. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/segmentation.md +0 -0
  120. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/train.md +0 -0
  121. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/usage.md +0 -0
  122. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/utils.md +0 -0
  123. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/workshops/AWS_2025.ipynb +0 -0
  124. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/workshops/GeoAI_Workshop_2025.ipynb +0 -0
  125. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/workshops/TNView_2025.ipynb +0 -0
  126. {geoai_py-0.10.0 → geoai_py-0.11.0}/docs/workshops/jupytext.toml +0 -0
  127. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/change_detection.py +0 -0
  128. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/classify.py +0 -0
  129. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/detectron2.py +0 -0
  130. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/download.py +0 -0
  131. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/extract.py +0 -0
  132. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/hf.py +0 -0
  133. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/sam.py +0 -0
  134. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/segment.py +0 -0
  135. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai/segmentation.py +0 -0
  136. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/dependency_links.txt +0 -0
  137. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/entry_points.txt +0 -0
  138. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/requires.txt +0 -0
  139. {geoai_py-0.10.0 → geoai_py-0.11.0}/geoai_py.egg-info/top_level.txt +0 -0
  140. {geoai_py-0.10.0 → geoai_py-0.11.0}/requirements.txt +0 -0
  141. {geoai_py-0.10.0 → geoai_py-0.11.0}/requirements_docs.txt +0 -0
  142. {geoai_py-0.10.0 → geoai_py-0.11.0}/setup.cfg +0 -0
  143. {geoai_py-0.10.0 → geoai_py-0.11.0}/tests/__init__.py +0 -0
  144. {geoai_py-0.10.0 → geoai_py-0.11.0}/tests/test_geoai.py +0 -0
@@ -14,7 +14,7 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/checkout@v5
16
16
  - name: Set up Python
17
- uses: actions/setup-python@v5
17
+ uses: actions/setup-python@v6
18
18
  with:
19
19
  python-version: "3.x"
20
20
  - name: Install dependencies
@@ -35,6 +35,6 @@ jobs:
35
35
  # unzip proj-data.zip -d proj-data
36
36
  # cp -r proj-data/* $(python -m pyproj -v | grep "PROJ_LIB" | cut -d ' ' -f 2)
37
37
 
38
- - name: Test import
39
- run: |
40
- uv run python -c "import geoai; print('geoai import successful')"
38
+ # - name: Test import
39
+ # run: |
40
+ # uv run python -c "import geoai; print('geoai import successful')"
@@ -3,6 +3,7 @@ __pycache__/
3
3
  private/
4
4
  *.py[cod]
5
5
  *$py.class
6
+ *.jp2
6
7
 
7
8
  # C extensions
8
9
  *.so
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geoai-py
3
- Version: 0.10.0
3
+ Version: 0.11.0
4
4
  Summary: A Python package for using Artificial Intelligence (AI) with geospatial data
5
5
  Author-email: Qiusheng Wu <giswqs@gmail.com>
6
6
  License: MIT License
@@ -0,0 +1,3 @@
1
+ # DINOv3 module
2
+
3
+ ::: geoai.dinov3
@@ -0,0 +1,201 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "0",
6
+ "metadata": {},
7
+ "source": [
8
+ "**Visualize AlphaEarth satellite embeddings in 3D**\n",
9
+ "\n",
10
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/batch_segmentation.ipynb)\n",
11
+ "\n",
12
+ "Google DeepMind has released a new satellite embedding dataset called AlphaEarth. This dataset contains annual satellite embeddings from 2017 to 2024, with each pixel representing a 10x10 meter area. The dataset is available on Google Earth Engine, and can be used to train machine learning models to classify satellite imagery.\n",
13
+ "\n",
14
+ "- News release: https://deepmind.google/discover/blog/alphaearth-foundations-helps-map-our-planet-in-unprecedented-detail/\n",
15
+ "- Dataset: https://developers.google.com/earth-engine/datasets/catalog/GOOGLE_SATELLITE_EMBEDDING_V1_ANNUAL#description\n",
16
+ "- Paper: https://storage.googleapis.com/deepmind-media/DeepMind.com/Blog/alphaearth-foundations-helps-map-our-planet-in-unprecedented-detail/alphaearth-foundations.pdf\n",
17
+ "- Blog post: https://medium.com/google-earth/ai-powered-pixels-introducing-googles-satellite-embedding-dataset-31744c1f4650\n",
18
+ "- Tutorials: https://developers.google.com/earth-engine/tutorials/community/satellite-embedding-01-introduction\n",
19
+ "- Similarity search: https://earthengine-ai.projects.earthengine.app/view/embedding-similarity-search\n",
20
+ "- Clustering: https://code.earthengine.google.com/b0871454add885294f633f731b90f946\n",
21
+ "\n",
22
+ "\n",
23
+ "Uncomment the following line to install [leafmap](https://leafmap.org) if needed."
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "id": "1",
30
+ "metadata": {},
31
+ "outputs": [],
32
+ "source": [
33
+ "# %pip install -U leafmap geemap"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": null,
39
+ "id": "2",
40
+ "metadata": {},
41
+ "outputs": [],
42
+ "source": [
43
+ "import ee\n",
44
+ "import geoai"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "markdown",
49
+ "id": "3",
50
+ "metadata": {},
51
+ "source": [
52
+ "To use the AlphaEarth satellite embeddings, you will need to authenticate with Earth Engine.\n",
53
+ "\n",
54
+ "If you don't have an Earth Engine account, you can create one at https://earthengine.google.com.\n",
55
+ "\n",
56
+ "Once you have an Earth Engine account, you can authenticate with Earth Engine by running the following code:"
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": null,
62
+ "id": "4",
63
+ "metadata": {},
64
+ "outputs": [],
65
+ "source": [
66
+ "ee.Authenticate()\n",
67
+ "ee.Initialize(project=\"your-ee-project\")"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": null,
73
+ "id": "5",
74
+ "metadata": {},
75
+ "outputs": [],
76
+ "source": [
77
+ "m = geoai.MapLibre(projection=\"globe\", sidebar_visible=True)\n",
78
+ "m.add_basemap(\"USGS.Imagery\")\n",
79
+ "m.add_alphaearth_gui()\n",
80
+ "m"
81
+ ]
82
+ },
83
+ {
84
+ "cell_type": "markdown",
85
+ "id": "6",
86
+ "metadata": {},
87
+ "source": [
88
+ "![](https://github.com/user-attachments/assets/fdcf844e-6385-4e62-a49f-363c00fa0998)"
89
+ ]
90
+ },
91
+ {
92
+ "cell_type": "code",
93
+ "execution_count": null,
94
+ "id": "7",
95
+ "metadata": {},
96
+ "outputs": [],
97
+ "source": [
98
+ "m = geoai.MapLibre(projection=\"globe\", sidebar_visible=True)\n",
99
+ "m.add_basemap(\"USGS.Imagery\")\n",
100
+ "m"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "code",
105
+ "execution_count": null,
106
+ "id": "8",
107
+ "metadata": {},
108
+ "outputs": [],
109
+ "source": [
110
+ "lon = -121.8036\n",
111
+ "lat = 39.0372\n",
112
+ "m.set_center(lon, lat, zoom=12)"
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": null,
118
+ "id": "9",
119
+ "metadata": {},
120
+ "outputs": [],
121
+ "source": [
122
+ "point = ee.Geometry.Point(lon, lat)\n",
123
+ "dataset = ee.ImageCollection(\"GOOGLE/SATELLITE_EMBEDDING/V1/ANNUAL\")"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "code",
128
+ "execution_count": null,
129
+ "id": "10",
130
+ "metadata": {},
131
+ "outputs": [],
132
+ "source": [
133
+ "image1 = dataset.filterDate(\"2017-01-01\", \"2018-01-01\").filterBounds(point).first()\n",
134
+ "image2 = dataset.filterDate(\"2024-01-01\", \"2025-01-01\").filterBounds(point).first()"
135
+ ]
136
+ },
137
+ {
138
+ "cell_type": "code",
139
+ "execution_count": null,
140
+ "id": "11",
141
+ "metadata": {},
142
+ "outputs": [],
143
+ "source": [
144
+ "vis_params = {\"min\": -0.3, \"max\": 0.3, \"bands\": [\"A01\", \"A16\", \"A09\"]}\n",
145
+ "m.add_ee_layer(image1, vis_params, name=\"Year 1 embeddings\")\n",
146
+ "m.add_ee_layer(image2, vis_params, name=\"Year 2 embeddings\")"
147
+ ]
148
+ },
149
+ {
150
+ "cell_type": "code",
151
+ "execution_count": null,
152
+ "id": "12",
153
+ "metadata": {},
154
+ "outputs": [],
155
+ "source": [
156
+ "dot_prod = image1.multiply(image2).reduce(ee.Reducer.sum())"
157
+ ]
158
+ },
159
+ {
160
+ "cell_type": "code",
161
+ "execution_count": null,
162
+ "id": "13",
163
+ "metadata": {},
164
+ "outputs": [],
165
+ "source": [
166
+ "vis_params = {\"min\": 0, \"max\": 1, \"palette\": [\"white\", \"black\"]}\n",
167
+ "m.add_ee_layer(dot_prod, vis_params, name=\"Similarity\")\n",
168
+ "m"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "markdown",
173
+ "id": "14",
174
+ "metadata": {},
175
+ "source": [
176
+ "![](https://github.com/user-attachments/assets/f7613474-f097-483e-9b24-a188c9d0d430)"
177
+ ]
178
+ }
179
+ ],
180
+ "metadata": {
181
+ "kernelspec": {
182
+ "display_name": "geo",
183
+ "language": "python",
184
+ "name": "python3"
185
+ },
186
+ "language_info": {
187
+ "codemirror_mode": {
188
+ "name": "ipython",
189
+ "version": 3
190
+ },
191
+ "file_extension": ".py",
192
+ "mimetype": "text/x-python",
193
+ "name": "python",
194
+ "nbconvert_exporter": "python",
195
+ "pygments_lexer": "ipython3",
196
+ "version": "3.12.2"
197
+ }
198
+ },
199
+ "nbformat": 4,
200
+ "nbformat_minor": 5
201
+ }
@@ -0,0 +1,157 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "0",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Find similar patches with DINOv3\n",
9
+ "\n",
10
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/DINOv3.ipynb)\n",
11
+ "\n",
12
+ "This notebook demonstrates how to find similar patches with [DINOv3](https://github.com/facebookresearch/dinov3).\n",
13
+ "\n",
14
+ "## Install packages\n",
15
+ "\n",
16
+ "To use the new functionality, ensure the required packages are installed."
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": null,
22
+ "id": "1",
23
+ "metadata": {},
24
+ "outputs": [],
25
+ "source": [
26
+ "# %pip install geoai-py"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "markdown",
31
+ "id": "2",
32
+ "metadata": {},
33
+ "source": [
34
+ "## Import libraries"
35
+ ]
36
+ },
37
+ {
38
+ "cell_type": "code",
39
+ "execution_count": null,
40
+ "id": "3",
41
+ "metadata": {},
42
+ "outputs": [],
43
+ "source": [
44
+ "import geoai"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "markdown",
49
+ "id": "4",
50
+ "metadata": {},
51
+ "source": [
52
+ "## Download sample data"
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "code",
57
+ "execution_count": null,
58
+ "id": "5",
59
+ "metadata": {},
60
+ "outputs": [],
61
+ "source": [
62
+ "url = (\n",
63
+ " \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/naip_rgb_train.tif\"\n",
64
+ ")\n",
65
+ "raster_path = geoai.download_file(url)"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "markdown",
70
+ "id": "6",
71
+ "metadata": {},
72
+ "source": [
73
+ "## Initialize the DINOv3 processor"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "code",
78
+ "execution_count": null,
79
+ "id": "7",
80
+ "metadata": {},
81
+ "outputs": [],
82
+ "source": [
83
+ "processor = geoai.DINOv3GeoProcessor(\n",
84
+ " model_name=\"dinov3_vitl16\",\n",
85
+ ")"
86
+ ]
87
+ },
88
+ {
89
+ "cell_type": "markdown",
90
+ "id": "8",
91
+ "metadata": {},
92
+ "source": [
93
+ "## Extract features"
94
+ ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": null,
99
+ "id": "9",
100
+ "metadata": {},
101
+ "outputs": [],
102
+ "source": [
103
+ "image = \"naip_rgb_train.tif\"\n",
104
+ "features, h_patches, w_patches = processor.extract_features(image)"
105
+ ]
106
+ },
107
+ {
108
+ "cell_type": "markdown",
109
+ "id": "10",
110
+ "metadata": {},
111
+ "source": [
112
+ "## Find similar patches"
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": null,
118
+ "id": "11",
119
+ "metadata": {},
120
+ "outputs": [],
121
+ "source": [
122
+ "m = geoai.Map()\n",
123
+ "m.add_dinov3_gui(image, processor, features)\n",
124
+ "m"
125
+ ]
126
+ },
127
+ {
128
+ "cell_type": "markdown",
129
+ "id": "12",
130
+ "metadata": {},
131
+ "source": [
132
+ "![](https://github.com/user-attachments/assets/5bb0c1d8-cb2a-4e67-ae9d-f31e383bae80)"
133
+ ]
134
+ }
135
+ ],
136
+ "metadata": {
137
+ "kernelspec": {
138
+ "display_name": "geo",
139
+ "language": "python",
140
+ "name": "python3"
141
+ },
142
+ "language_info": {
143
+ "codemirror_mode": {
144
+ "name": "ipython",
145
+ "version": 3
146
+ },
147
+ "file_extension": ".py",
148
+ "mimetype": "text/x-python",
149
+ "name": "python",
150
+ "nbconvert_exporter": "python",
151
+ "pygments_lexer": "ipython3",
152
+ "version": "3.12.2"
153
+ }
154
+ },
155
+ "nbformat": 4,
156
+ "nbformat_minor": 5
157
+ }