Add deep learning detection func#2288
Closed
CousinRock wants to merge 6 commits intogee-community:masterfrom
CousinRock:master
Closed
Add deep learning detection func#2288CousinRock wants to merge 6 commits intogee-community:masterfrom CousinRock:master
CousinRock wants to merge 6 commits intogee-community:masterfrom
CousinRock:master
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Member
|
Thank you for your contribution. I am sorry that we won't be able to to merge this PR. The geoai package has a lot of heavy dependencies. We won't be able to add it as a dependency for geemap. You can try to contribute this PR to the geoai package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@giswqs Dear Professor Wu,
I have recently developed a new feature for geemap that integrates GeoAI to perform model inference directly on imagery from GEE. This functionality enables users to apply local deep learning models for instance segmentation and semantic segmentation on GEE images in an intuitive and efficient way.
I have tested this extension and it works well for various applications such as building extraction and land cover classification using NAIP imagery. I would like to contribute this feature to the geemap project, and I would greatly appreciate your feedback or suggestions on the integration and contribution process. Thank you for your time and support.
Instance segmentation
import ee
import geemap
ee.Authenticate()
ee.Initialize(project='ee-renjiewu660')
m = geemap.Map(basemap = 'SATELLITE')
m
image = ee.Image('projects/ee-renjiewu660/assets/vgee/naip_test')
dataset = ee.ImageCollection('USDA/NAIP/DOQQ')
.filter(ee.Filter.date('2017-01-01', '2018-12-31')).median().toUint8()
roi = image.geometry()
TrueColor = dataset.select(['R', 'G', 'B']).clip(roi)
TrueColorVis = {
"bands": ['R', 'G', 'B'],
"min": 0,
"max": 255,
}
m.addLayer(TrueColor, TrueColorVis, 'True Color')
m.centerObject(image)
m
model_path = "/mnt/e/DATA/TrainModel/BuildingDec/best_model.pth"
infer_area = geemap.detect_instance_segmentation(

image=TrueColor,
model_path=model_path,
scale=0.6,
window_size=512,
overlap=128,
confidence_threshold=0.5,
batch_size=4,
num_channels=3,
min_area=0,
max_tile_size=1,
max_tile_dim=512,
region = roi
)
infer_area
m.addLayer(infer_area,{},'t')

m
semantic segmentation
import ee
import geemap
ee.Authenticate()
ee.Initialize(project='ee-renjiewu660')
m = geemap.Map(basemap = 'SATELLITE')
m
image = ee.Image('projects/ee-renjiewu660/assets/vgee/m_3807511_se_18_060_20181104')
dataset = ee.ImageCollection('USDA/NAIP/DOQQ')
.filter(ee.Filter.date('2017-01-01', '2018-12-31')).median().toUint8()
roi = m.user_roi
TrueColor = dataset.clip(roi)
TrueColorVis = {
"bands": ['R', 'G', 'B'],
"min": 0,
"max": 255,
}
m.addLayer(TrueColor, TrueColorVis, 'True Color')
m.centerObject(image)
m
model_path = "/mnt/e/DATA/TrainModel/LandcoverDec/best_model.pth"
infer_area = geemap.detect_semantic_segmentation(
image=TrueColor,
model_path=model_path,
scale=0.6,
window_size=512,
overlap=128,
confidence_threshold=0.95,
batch_size=4,
num_channels=4,
num_classes=13,
min_area=0,
max_tile_size=1,
max_tile_dim=512,
region = roi
)
infer_area

m.addLayer(infer_area,{},'t')

m