|
30 | 30 | "metadata": {}, |
31 | 31 | "outputs": [], |
32 | 32 | "source": [ |
33 | | - "# %pip install segment-geospatial leafmap localtileserver" |
| 33 | + "# %pip install segment-geospatial groundingdino-py leafmap localtileserver" |
34 | 34 | ] |
35 | 35 | }, |
36 | 36 | { |
|
56 | 56 | "cell_type": "code", |
57 | 57 | "execution_count": null, |
58 | 58 | "metadata": {}, |
59 | | - "outputs": [ |
60 | | - { |
61 | | - "name": "stderr", |
62 | | - "output_type": "stream", |
63 | | - "text": [ |
64 | | - "No such comm: 96754273fbc94aabbf75b0f2bebca8cd\n" |
65 | | - ] |
66 | | - } |
67 | | - ], |
| 59 | + "outputs": [], |
68 | 60 | "source": [ |
69 | 61 | "m = leafmap.Map(center=[-22.17615, -51.253043], zoom=18, height=\"800px\")\n", |
70 | 62 | "m.add_basemap(\"SATELLITE\")\n", |
|
98 | 90 | "outputs": [], |
99 | 91 | "source": [ |
100 | 92 | "image = \"Image.tif\"\n", |
101 | | - "tms_to_geotiff(output=image, bbox=bbox, zoom=18, source=\"Satellite\", overwrite=True)" |
| 93 | + "tms_to_geotiff(output=image, bbox=bbox, zoom=19, source=\"Satellite\", overwrite=True)" |
102 | 94 | ] |
103 | 95 | }, |
104 | 96 | { |
|
139 | 131 | "cell_type": "markdown", |
140 | 132 | "metadata": {}, |
141 | 133 | "source": [ |
142 | | - "## Initialize LangSAM class" |
| 134 | + "## Initialize LangSAM class\n", |
| 135 | + "\n", |
| 136 | + "The initialization of the LangSAM class might take a few minutes. The initialization downloads the model weights and sets up the model for inference." |
143 | 137 | ] |
144 | 138 | }, |
145 | 139 | { |
|
173 | 167 | "source": [ |
174 | 168 | "## Segment the image\n", |
175 | 169 | "\n", |
176 | | - "Part of the model prediction includes setting appropriate thresholds for object detection and text association with the detected objects. These threshold values range between 0 to 1 and are set while calling the predict method of the LangSAM class.\n", |
| 170 | + "Part of the model prediction includes setting appropriate thresholds for object detection and text association with the detected objects. These threshold values range from 0 to 1 and are set while calling the predict method of the LangSAM class.\n", |
177 | 171 | "\n", |
178 | 172 | "`box_threshold`: This value is used for object detection in the image. A higher value makes the model more selective, identifying only the most confident object instances, leading to fewer overall detections. A lower value, conversely, makes the model more tolerant, leading to increased detections, including potentially less confident ones.\n", |
179 | 173 | "\n", |
|
188 | 182 | "metadata": {}, |
189 | 183 | "outputs": [], |
190 | 184 | "source": [ |
191 | | - "sam.predict('trees.tif', text_prompt, box_threshold=0.24, text_threshold=0.24)" |
| 185 | + "sam.predict(image, text_prompt, box_threshold=0.24, text_threshold=0.24)" |
192 | 186 | ] |
193 | 187 | }, |
194 | 188 | { |
|
208 | 202 | " cmap='Greens', \n", |
209 | 203 | " box_color='red', \n", |
210 | 204 | " title='Automatic Segmentation of Trees', \n", |
| 205 | + " blend=False,\n", |
211 | 206 | " output='trees.tif'\n", |
212 | 207 | ")" |
213 | 208 | ] |
|
216 | 211 | "cell_type": "markdown", |
217 | 212 | "metadata": {}, |
218 | 213 | "source": [ |
219 | | - "" |
| 214 | + "" |
220 | 215 | ] |
221 | 216 | } |
222 | 217 | ], |
|
0 commit comments