geoai-py 0.3.3__tar.gz → 0.3.5__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 (78) hide show
  1. {geoai_py-0.3.3 → geoai_py-0.3.5}/PKG-INFO +1 -1
  2. geoai_py-0.3.5/docs/examples/_template.ipynb +132 -0
  3. geoai_py-0.3.5/docs/examples/car_detection.ipynb +260 -0
  4. geoai_py-0.3.5/docs/examples/ship_detection.ipynb +358 -0
  5. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/__init__.py +1 -1
  6. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/extract.py +404 -28
  7. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/utils.py +44 -17
  8. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/PKG-INFO +1 -1
  9. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/SOURCES.txt +3 -0
  10. {geoai_py-0.3.3 → geoai_py-0.3.5}/mkdocs.yml +4 -0
  11. {geoai_py-0.3.3 → geoai_py-0.3.5}/pyproject.toml +2 -2
  12. {geoai_py-0.3.3 → geoai_py-0.3.5}/.editorconfig +0 -0
  13. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  14. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  15. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  16. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/dependabot.yml +0 -0
  17. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/docs-build.yml +0 -0
  18. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/docs.yml +0 -0
  19. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/macos.yml +0 -0
  20. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/pypi.yml +0 -0
  21. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/ubuntu.yml +0 -0
  22. {geoai_py-0.3.3 → geoai_py-0.3.5}/.github/workflows/windows.yml +0 -0
  23. {geoai_py-0.3.3 → geoai_py-0.3.5}/.gitignore +0 -0
  24. {geoai_py-0.3.3 → geoai_py-0.3.5}/.pre-commit-config.yaml +0 -0
  25. {geoai_py-0.3.3 → geoai_py-0.3.5}/LICENSE +0 -0
  26. {geoai_py-0.3.3 → geoai_py-0.3.5}/MANIFEST.in +0 -0
  27. {geoai_py-0.3.3 → geoai_py-0.3.5}/README.md +0 -0
  28. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/CNAME +0 -0
  29. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/changelog.md +0 -0
  30. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/contributing.md +0 -0
  31. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/download.md +0 -0
  32. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/building_footprints_usa.ipynb +0 -0
  33. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/building_regularization.ipynb +0 -0
  34. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/data_visualization.ipynb +0 -0
  35. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/dataviz/lidar_viz.ipynb +0 -0
  36. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/dataviz/raster_viz.ipynb +0 -0
  37. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/dataviz/vector_viz.ipynb +0 -0
  38. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/download_data.ipynb +0 -0
  39. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/geometric_properties.ipynb +0 -0
  40. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/image_chips.ipynb +0 -0
  41. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/jupytext.toml +0 -0
  42. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/rastervision/semantic_segmentation.ipynb +0 -0
  43. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/arcgis.ipynb +0 -0
  44. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/automatic_mask_generator.ipynb +0 -0
  45. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/automatic_mask_generator_hq.ipynb +0 -0
  46. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/box_prompts.ipynb +0 -0
  47. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/fast_sam.ipynb +0 -0
  48. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/input_prompts.ipynb +0 -0
  49. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/input_prompts_hq.ipynb +0 -0
  50. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/maxar_open_data.ipynb +0 -0
  51. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/satellite-predictor.ipynb +0 -0
  52. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/satellite.ipynb +0 -0
  53. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/swimming_pools.ipynb +0 -0
  54. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/text_prompts.ipynb +0 -0
  55. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/samgeo/text_prompts_batch.ipynb +0 -0
  56. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/examples/view_metadata.ipynb +0 -0
  57. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/extract.md +0 -0
  58. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/faq.md +0 -0
  59. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/geoai.md +0 -0
  60. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/index.md +0 -0
  61. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/installation.md +0 -0
  62. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/overrides/main.html +0 -0
  63. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/segmentation.md +0 -0
  64. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/usage.md +0 -0
  65. {geoai_py-0.3.3 → geoai_py-0.3.5}/docs/utils.md +0 -0
  66. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/download.py +0 -0
  67. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/geoai.py +0 -0
  68. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/preprocess.py +0 -0
  69. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai/segmentation.py +0 -0
  70. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/dependency_links.txt +0 -0
  71. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/entry_points.txt +0 -0
  72. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/requires.txt +0 -0
  73. {geoai_py-0.3.3 → geoai_py-0.3.5}/geoai_py.egg-info/top_level.txt +0 -0
  74. {geoai_py-0.3.3 → geoai_py-0.3.5}/requirements.txt +0 -0
  75. {geoai_py-0.3.3 → geoai_py-0.3.5}/requirements_docs.txt +0 -0
  76. {geoai_py-0.3.3 → geoai_py-0.3.5}/setup.cfg +0 -0
  77. {geoai_py-0.3.3 → geoai_py-0.3.5}/tests/__init__.py +0 -0
  78. {geoai_py-0.3.3 → geoai_py-0.3.5}/tests/test_geoai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: geoai-py
3
- Version: 0.3.3
3
+ Version: 0.3.5
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,132 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Template\n",
8
+ "\n",
9
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/template.ipynb)\n",
10
+ "\n",
11
+ "## Install package\n",
12
+ "To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "# %pip install geoai-py"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "markdown",
26
+ "metadata": {},
27
+ "source": [
28
+ "## Import libraries"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": null,
34
+ "metadata": {},
35
+ "outputs": [],
36
+ "source": [
37
+ "import geoai"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {},
43
+ "source": [
44
+ "## Download sample data"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {},
51
+ "outputs": [],
52
+ "source": []
53
+ },
54
+ {
55
+ "cell_type": "markdown",
56
+ "metadata": {},
57
+ "source": [
58
+ "## Visualize data"
59
+ ]
60
+ },
61
+ {
62
+ "cell_type": "code",
63
+ "execution_count": null,
64
+ "metadata": {},
65
+ "outputs": [],
66
+ "source": []
67
+ },
68
+ {
69
+ "cell_type": "markdown",
70
+ "metadata": {},
71
+ "source": [
72
+ "## Initialize model"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "code",
77
+ "execution_count": null,
78
+ "metadata": {},
79
+ "outputs": [],
80
+ "source": []
81
+ },
82
+ {
83
+ "cell_type": "markdown",
84
+ "metadata": {},
85
+ "source": [
86
+ "## Run inference"
87
+ ]
88
+ },
89
+ {
90
+ "cell_type": "code",
91
+ "execution_count": null,
92
+ "metadata": {},
93
+ "outputs": [],
94
+ "source": []
95
+ },
96
+ {
97
+ "cell_type": "markdown",
98
+ "metadata": {},
99
+ "source": [
100
+ "## Visualize results"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "code",
105
+ "execution_count": null,
106
+ "metadata": {},
107
+ "outputs": [],
108
+ "source": []
109
+ }
110
+ ],
111
+ "metadata": {
112
+ "kernelspec": {
113
+ "display_name": "torch",
114
+ "language": "python",
115
+ "name": "python3"
116
+ },
117
+ "language_info": {
118
+ "codemirror_mode": {
119
+ "name": "ipython",
120
+ "version": 3
121
+ },
122
+ "file_extension": ".py",
123
+ "mimetype": "text/x-python",
124
+ "name": "python",
125
+ "nbconvert_exporter": "python",
126
+ "pygments_lexer": "ipython3",
127
+ "version": "3.11.8"
128
+ }
129
+ },
130
+ "nbformat": 4,
131
+ "nbformat_minor": 2
132
+ }
@@ -0,0 +1,260 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Car Detection\n",
8
+ "\n",
9
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/geoai/blob/main/docs/examples/car_detection.ipynb)\n",
10
+ "\n",
11
+ "## Install package\n",
12
+ "To use the `geoai-py` package, ensure it is installed in your environment. Uncomment the command below if needed."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "# %pip install geoai-py"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "markdown",
26
+ "metadata": {},
27
+ "source": [
28
+ "## Import libraries"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": null,
34
+ "metadata": {},
35
+ "outputs": [],
36
+ "source": [
37
+ "import geoai"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "markdown",
42
+ "metadata": {},
43
+ "source": [
44
+ "## Download sample data\n",
45
+ "\n",
46
+ "We will download a sample image from Hugging Face Hub to use for car detection. You can find more high-resolution images from [OpenAerialMap](https://openaerialmap.org)."
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": null,
52
+ "metadata": {},
53
+ "outputs": [],
54
+ "source": [
55
+ "raster_url = (\n",
56
+ " \"https://huggingface.co/datasets/giswqs/geospatial/resolve/main/cars_7cm.tif\"\n",
57
+ ")"
58
+ ]
59
+ },
60
+ {
61
+ "cell_type": "code",
62
+ "execution_count": null,
63
+ "metadata": {},
64
+ "outputs": [],
65
+ "source": [
66
+ "raster_path = geoai.download_file(raster_url)"
67
+ ]
68
+ },
69
+ {
70
+ "cell_type": "markdown",
71
+ "metadata": {},
72
+ "source": [
73
+ "## Visualize the image"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "code",
78
+ "execution_count": null,
79
+ "metadata": {},
80
+ "outputs": [],
81
+ "source": [
82
+ "geoai.view_raster(raster_url)"
83
+ ]
84
+ },
85
+ {
86
+ "cell_type": "markdown",
87
+ "metadata": {},
88
+ "source": [
89
+ "## Initialize the model"
90
+ ]
91
+ },
92
+ {
93
+ "cell_type": "code",
94
+ "execution_count": null,
95
+ "metadata": {},
96
+ "outputs": [],
97
+ "source": [
98
+ "detector = geoai.CarDetector()"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "markdown",
103
+ "metadata": {},
104
+ "source": [
105
+ "## Extract cars\n",
106
+ "\n",
107
+ "Extract cars from the image using the model and save the output image."
108
+ ]
109
+ },
110
+ {
111
+ "cell_type": "code",
112
+ "execution_count": null,
113
+ "metadata": {},
114
+ "outputs": [],
115
+ "source": [
116
+ "mask_path = detector.generate_masks(\n",
117
+ " raster_path=raster_path,\n",
118
+ " output_path=\"cars_masks.tif\",\n",
119
+ " confidence_threshold=0.3,\n",
120
+ " mask_threshold=0.5,\n",
121
+ " overlap=0.25,\n",
122
+ " chip_size=(400, 400),\n",
123
+ ")"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "markdown",
128
+ "metadata": {},
129
+ "source": [
130
+ "Convert the image masks to polygons and save the output GeoJSON file."
131
+ ]
132
+ },
133
+ {
134
+ "cell_type": "code",
135
+ "execution_count": null,
136
+ "metadata": {},
137
+ "outputs": [],
138
+ "source": [
139
+ "gdf = detector.vectorize_masks(\n",
140
+ " masks_path=\"cars_masks.tif\",\n",
141
+ " output_path=\"cars.geojson\",\n",
142
+ " min_object_area=100,\n",
143
+ " max_object_area=2000,\n",
144
+ ")"
145
+ ]
146
+ },
147
+ {
148
+ "cell_type": "markdown",
149
+ "metadata": {},
150
+ "source": [
151
+ "## Add geometric properties"
152
+ ]
153
+ },
154
+ {
155
+ "cell_type": "code",
156
+ "execution_count": null,
157
+ "metadata": {},
158
+ "outputs": [],
159
+ "source": [
160
+ "gdf = geoai.add_geometric_properties(gdf)"
161
+ ]
162
+ },
163
+ {
164
+ "cell_type": "markdown",
165
+ "metadata": {},
166
+ "source": [
167
+ "## Visualize initial results"
168
+ ]
169
+ },
170
+ {
171
+ "cell_type": "code",
172
+ "execution_count": null,
173
+ "metadata": {},
174
+ "outputs": [],
175
+ "source": [
176
+ "geoai.view_vector_interactive(gdf, column=\"confidence\", tiles=raster_url)"
177
+ ]
178
+ },
179
+ {
180
+ "cell_type": "markdown",
181
+ "metadata": {},
182
+ "source": [
183
+ "## Filter cars by area"
184
+ ]
185
+ },
186
+ {
187
+ "cell_type": "code",
188
+ "execution_count": null,
189
+ "metadata": {},
190
+ "outputs": [],
191
+ "source": [
192
+ "gdf_filter = gdf[\n",
193
+ " (gdf[\"area_m2\"] > 8) & (gdf[\"area_m2\"] < 60) & (gdf[\"minor_length_m\"] > 1)\n",
194
+ "]"
195
+ ]
196
+ },
197
+ {
198
+ "cell_type": "code",
199
+ "execution_count": null,
200
+ "metadata": {},
201
+ "outputs": [],
202
+ "source": [
203
+ "len(gdf_filter)"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type": "markdown",
208
+ "metadata": {},
209
+ "source": [
210
+ "## Visualiza final results"
211
+ ]
212
+ },
213
+ {
214
+ "cell_type": "code",
215
+ "execution_count": null,
216
+ "metadata": {},
217
+ "outputs": [],
218
+ "source": [
219
+ "geoai.view_vector_interactive(gdf_filter, column=\"confidence\", tiles=raster_url)"
220
+ ]
221
+ },
222
+ {
223
+ "cell_type": "code",
224
+ "execution_count": null,
225
+ "metadata": {},
226
+ "outputs": [],
227
+ "source": [
228
+ "geoai.view_vector_interactive(gdf_filter, tiles=raster_url)"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "markdown",
233
+ "metadata": {},
234
+ "source": [
235
+ "![image](https://github.com/user-attachments/assets/a1e4c871-b152-466a-b902-7c00e62e5444)"
236
+ ]
237
+ }
238
+ ],
239
+ "metadata": {
240
+ "kernelspec": {
241
+ "display_name": "torch",
242
+ "language": "python",
243
+ "name": "python3"
244
+ },
245
+ "language_info": {
246
+ "codemirror_mode": {
247
+ "name": "ipython",
248
+ "version": 3
249
+ },
250
+ "file_extension": ".py",
251
+ "mimetype": "text/x-python",
252
+ "name": "python",
253
+ "nbconvert_exporter": "python",
254
+ "pygments_lexer": "ipython3",
255
+ "version": "3.11.8"
256
+ }
257
+ },
258
+ "nbformat": 4,
259
+ "nbformat_minor": 2
260
+ }