Skip to content

Commit ade624d

Browse files
authored
Fix typos (#31)
1 parent 331bc73 commit ade624d

File tree

3 files changed

+99
-50
lines changed

3 files changed

+99
-50
lines changed

docs/examples/automatic_mask_generator.ipynb

Lines changed: 73 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"metadata": {},
6060
"outputs": [],
6161
"source": [
62-
"m = leafmap.Map(center=[37.8713, -122.2580], zoom=17, height='800px')\n",
63-
"m.add_basemap('SATELLITE')\n",
62+
"m = leafmap.Map(center=[37.8713, -122.2580], zoom=17, height=\"800px\")\n",
63+
"m.add_basemap(\"SATELLITE\")\n",
6464
"m"
6565
]
6666
},
@@ -97,8 +97,8 @@
9797
"metadata": {},
9898
"outputs": [],
9999
"source": [
100-
"image = 'satellite.tif'\n",
101-
"tms_to_geotiff(output=image, bbox=bbox, zoom=17, source='Satellite', overwrite=True)"
100+
"image = \"satellite.tif\"\n",
101+
"tms_to_geotiff(output=image, bbox=bbox, zoom=17, source=\"Satellite\", overwrite=True)"
102102
]
103103
},
104104
{
@@ -131,7 +131,7 @@
131131
"outputs": [],
132132
"source": [
133133
"m.layers[-1].visible = False\n",
134-
"m.add_raster(image, layer_name='Image')\n",
134+
"m.add_raster(image, layer_name=\"Image\")\n",
135135
"m"
136136
]
137137
},
@@ -150,8 +150,8 @@
150150
"metadata": {},
151151
"outputs": [],
152152
"source": [
153-
"out_dir = os.path.join(os.path.expanduser('~'), 'Downloads')\n",
154-
"checkpoint = os.path.join(out_dir, 'sam_vit_h_4b8939.pth')"
153+
"out_dir = os.path.join(os.path.expanduser(\"~\"), \"Downloads\")\n",
154+
"checkpoint = os.path.join(out_dir, \"sam_vit_h_4b8939.pth\")"
155155
]
156156
},
157157
{
@@ -161,7 +161,7 @@
161161
"outputs": [],
162162
"source": [
163163
"sam = SamGeo(\n",
164-
" model_type='vit_h',\n",
164+
" model_type=\"vit_h\",\n",
165165
" checkpoint=checkpoint,\n",
166166
" sam_kwargs=None,\n",
167167
")"
@@ -182,7 +182,7 @@
182182
"metadata": {},
183183
"outputs": [],
184184
"source": [
185-
"sam.generate(image, output='masks.tif', foreground=True, unique=True)"
185+
"sam.generate(image, output=\"masks.tif\", foreground=True, unique=True)"
186186
]
187187
},
188188
{
@@ -191,7 +191,7 @@
191191
"metadata": {},
192192
"outputs": [],
193193
"source": [
194-
"sam.show_masks(cmap='binary_r')"
194+
"sam.show_masks(cmap=\"binary_r\")"
195195
]
196196
},
197197
{
@@ -207,7 +207,35 @@
207207
"metadata": {},
208208
"outputs": [],
209209
"source": [
210-
"sam.show_anns(axis='off', alpha=1, output='annotations.tif')"
210+
"sam.show_anns(axis=\"off\", alpha=1, output=\"annotations.tif\")"
211+
]
212+
},
213+
{
214+
"cell_type": "markdown",
215+
"metadata": {},
216+
"source": [
217+
"Compare images with a slider."
218+
]
219+
},
220+
{
221+
"cell_type": "code",
222+
"execution_count": null,
223+
"metadata": {},
224+
"outputs": [],
225+
"source": [
226+
"leafmap.image_comparison(\n",
227+
" \"satellite.tif\",\n",
228+
" \"annotations.tif\",\n",
229+
" label1=\"Satellite Image\",\n",
230+
" label2=\"Image Segmentation\",\n",
231+
")"
232+
]
233+
},
234+
{
235+
"cell_type": "markdown",
236+
"metadata": {},
237+
"source": [
238+
"Add image to the map."
211239
]
212240
},
213241
{
@@ -216,7 +244,7 @@
216244
"metadata": {},
217245
"outputs": [],
218246
"source": [
219-
"m.add_raster('annotations.tif', opacity=0.5, layer_name='Masks')\n",
247+
"m.add_raster(\"annotations.tif\", alpha=0.5, layer_name=\"Masks\")\n",
220248
"m"
221249
]
222250
},
@@ -233,7 +261,7 @@
233261
"metadata": {},
234262
"outputs": [],
235263
"source": [
236-
"sam.tiff_to_vector('masks.tif', 'masks.gpkg')"
264+
"sam.tiff_to_vector(\"masks.tif\", \"masks.gpkg\")"
237265
]
238266
},
239267
{
@@ -252,12 +280,12 @@
252280
"outputs": [],
253281
"source": [
254282
"sam_kwargs = {\n",
255-
" 'points_per_side': 32,\n",
256-
" 'pred_iou_thresh': 0.86,\n",
257-
" 'stability_score_thresh': 0.92,\n",
258-
" 'crop_n_layers': 1,\n",
259-
" 'crop_n_points_downscale_factor': 2,\n",
260-
" 'min_mask_region_area': 100,\n",
283+
" \"points_per_side\": 32,\n",
284+
" \"pred_iou_thresh\": 0.86,\n",
285+
" \"stability_score_thresh\": 0.92,\n",
286+
" \"crop_n_layers\": 1,\n",
287+
" \"crop_n_points_downscale_factor\": 2,\n",
288+
" \"min_mask_region_area\": 100,\n",
261289
"}"
262290
]
263291
},
@@ -268,7 +296,7 @@
268296
"outputs": [],
269297
"source": [
270298
"sam = SamGeo(\n",
271-
" model_type='vit_h',\n",
299+
" model_type=\"vit_h\",\n",
272300
" checkpoint=checkpoint,\n",
273301
" sam_kwargs=sam_kwargs,\n",
274302
")"
@@ -280,7 +308,16 @@
280308
"metadata": {},
281309
"outputs": [],
282310
"source": [
283-
"sam.generate(image, output='masks2.tif', foreground=True)"
311+
"sam.generate(image, output=\"masks2.tif\", foreground=True)"
312+
]
313+
},
314+
{
315+
"cell_type": "code",
316+
"execution_count": null,
317+
"metadata": {},
318+
"outputs": [],
319+
"source": [
320+
"sam.show_masks(cmap=\"binary_r\")"
284321
]
285322
},
286323
{
@@ -289,7 +326,14 @@
289326
"metadata": {},
290327
"outputs": [],
291328
"source": [
292-
"sam.show_masks(cmap='binary_r')"
329+
"sam.show_anns(axis=\"off\", opacity=1, output=\"annotations2.tif\")"
330+
]
331+
},
332+
{
333+
"cell_type": "markdown",
334+
"metadata": {},
335+
"source": [
336+
"Compare images with a slider."
293337
]
294338
},
295339
{
@@ -298,7 +342,12 @@
298342
"metadata": {},
299343
"outputs": [],
300344
"source": [
301-
"sam.show_anns(axis='off', opacity=1, output='annotations2.tif')"
345+
"leafmap.image_comparison(\n",
346+
" \"satellite.tif\",\n",
347+
" \"annotations.tif\",\n",
348+
" label1=\"Satellite Image\",\n",
349+
" label2=\"Image Segmentation\",\n",
350+
")"
302351
]
303352
},
304353
{
@@ -314,7 +363,7 @@
314363
"metadata": {},
315364
"outputs": [],
316365
"source": [
317-
"overlay_images(image, 'annotations2.tif', backend='TkAgg')"
366+
"overlay_images(image, \"annotations2.tif\", backend=\"TkAgg\")"
318367
]
319368
},
320369
{

docs/examples/satellite-predictor.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"source": [
7878
"zoom = 16\n",
7979
"m = leafmap.Map(center=[45, -123], zoom=zoom)\n",
80-
"m.add_basemap('SATELLITE')\n",
80+
"m.add_basemap(\"SATELLITE\")\n",
8181
"m"
8282
]
8383
},
@@ -119,7 +119,7 @@
119119
},
120120
"outputs": [],
121121
"source": [
122-
"image = 'satellite.tif'\n",
122+
"image = \"satellite.tif\"\n",
123123
"# image = '/path/to/your/own/image.tif'"
124124
]
125125
},
@@ -152,7 +152,7 @@
152152
"metadata": {},
153153
"outputs": [],
154154
"source": [
155-
"tms_to_geotiff(output=image, bbox=bbox, zoom=zoom + 1, source='Satellite')"
155+
"tms_to_geotiff(output=image, bbox=bbox, zoom=zoom + 1, source=\"Satellite\")"
156156
]
157157
},
158158
{
@@ -161,7 +161,7 @@
161161
"metadata": {},
162162
"outputs": [],
163163
"source": [
164-
"m.add_raster(image, layer_name='Image')\n",
164+
"m.add_raster(image, layer_name=\"Image\")\n",
165165
"m"
166166
]
167167
},
@@ -212,8 +212,8 @@
212212
"metadata": {},
213213
"outputs": [],
214214
"source": [
215-
"out_dir = os.path.join(os.path.expanduser('~'), 'Downloads')\n",
216-
"checkpoint = os.path.join(out_dir, 'sam_vit_h_4b8939.pth')"
215+
"out_dir = os.path.join(os.path.expanduser(\"~\"), \"Downloads\")\n",
216+
"checkpoint = os.path.join(out_dir, \"sam_vit_h_4b8939.pth\")"
217217
]
218218
},
219219
{
@@ -278,12 +278,12 @@
278278
"outputs": [],
279279
"source": [
280280
"style = {\n",
281-
" 'color': '#3388ff',\n",
282-
" 'weight': 2,\n",
283-
" 'fillColor': '#7c4185',\n",
284-
" 'fillOpacity': 0.5,\n",
281+
" \"color\": \"#3388ff\",\n",
282+
" \"weight\": 2,\n",
283+
" \"fillColor\": \"#7c4185\",\n",
284+
" \"fillOpacity\": 0.5,\n",
285285
"}\n",
286-
"m.add_vector(vector, layer_name='Vector', style=style)\n",
286+
"m.add_vector(vector, layer_name=\"Vector\", style=style)\n",
287287
"m"
288288
]
289289
},

docs/examples/satellite.ipynb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"outputs": [],
7171
"source": [
7272
"m = leafmap.Map(center=[29.676840, -95.369222], zoom=19)\n",
73-
"m.add_basemap('SATELLITE')\n",
73+
"m.add_basemap(\"SATELLITE\")\n",
7474
"m"
7575
]
7676
},
@@ -108,7 +108,7 @@
108108
"metadata": {},
109109
"outputs": [],
110110
"source": [
111-
"image = 'satellite.tif'"
111+
"image = \"satellite.tif\""
112112
]
113113
},
114114
{
@@ -140,7 +140,7 @@
140140
"metadata": {},
141141
"outputs": [],
142142
"source": [
143-
"tms_to_geotiff(output=image, bbox=bbox, zoom=20, source='Satellite', overwrite=True)"
143+
"tms_to_geotiff(output=image, bbox=bbox, zoom=20, source=\"Satellite\", overwrite=True)"
144144
]
145145
},
146146
{
@@ -173,7 +173,7 @@
173173
"outputs": [],
174174
"source": [
175175
"m.layers[-1].visible = False # turn off the basemap\n",
176-
"m.add_raster(image, layer_name='Image')\n",
176+
"m.add_raster(image, layer_name=\"Image\")\n",
177177
"m"
178178
]
179179
},
@@ -197,8 +197,8 @@
197197
"metadata": {},
198198
"outputs": [],
199199
"source": [
200-
"out_dir = os.path.join(os.path.expanduser('~'), 'Downloads')\n",
201-
"checkpoint = os.path.join(out_dir, 'sam_vit_h_4b8939.pth')"
200+
"out_dir = os.path.join(os.path.expanduser(\"~\"), \"Downloads\")\n",
201+
"checkpoint = os.path.join(out_dir, \"sam_vit_h_4b8939.pth\")"
202202
]
203203
},
204204
{
@@ -208,7 +208,7 @@
208208
"outputs": [],
209209
"source": [
210210
"sam = SamGeo(\n",
211-
" model_type='vit_h',\n",
211+
" model_type=\"vit_h\",\n",
212212
" checkpoint=checkpoint,\n",
213213
" sam_kwargs=None,\n",
214214
")"
@@ -229,7 +229,7 @@
229229
"metadata": {},
230230
"outputs": [],
231231
"source": [
232-
"mask = 'segment.tiff'\n",
232+
"mask = \"segment.tiff\"\n",
233233
"sam.generate(\n",
234234
" image, mask, batch=True, foreground=True, erosion_kernel=(3, 3), mask_multiplier=255\n",
235235
")"
@@ -250,7 +250,7 @@
250250
"metadata": {},
251251
"outputs": [],
252252
"source": [
253-
"vector = 'segment.gpkg'\n",
253+
"vector = \"segment.gpkg\"\n",
254254
"sam.tiff_to_gpkg(mask, vector, simplify_tolerance=None)"
255255
]
256256
},
@@ -267,7 +267,7 @@
267267
"metadata": {},
268268
"outputs": [],
269269
"source": [
270-
"shapefile = 'segment.shp'\n",
270+
"shapefile = \"segment.shp\"\n",
271271
"sam.tiff_to_vector(mask, shapefile)"
272272
]
273273
},
@@ -285,12 +285,12 @@
285285
"outputs": [],
286286
"source": [
287287
"style = {\n",
288-
" 'color': '#3388ff',\n",
289-
" 'weight': 2,\n",
290-
" 'fillColor': '#7c4185',\n",
291-
" 'fillOpacity': 0.5,\n",
288+
" \"color\": \"#3388ff\",\n",
289+
" \"weight\": 2,\n",
290+
" \"fillColor\": \"#7c4185\",\n",
291+
" \"fillOpacity\": 0.5,\n",
292292
"}\n",
293-
"m.add_vector(vector, layer_name='Vector', style=style)\n",
293+
"m.add_vector(vector, layer_name=\"Vector\", style=style)\n",
294294
"m"
295295
]
296296
},

0 commit comments

Comments
 (0)