How to use arcgis.learn.ChangeDetector with ArcGIS Pro?

833
3
01-12-2021 11:17 PM
Labels (1)
LinoSun
New Contributor III

How to use arcgis.learn.ChangeDetector with ArcGIS Pro?

Hi everyone,I notice that there is a new model in ArcGIS API for Python,arcgis.learn.ChangeDetector.But after a long time of thinking, I still don’t know how to use gp tool `Export Training Data for DeepLearning ` to export training data which format could be used for arcgis.learn.ChangeDetector model, as this work needs two imagery. 😃

Guys who can share me a sample notebook which using arcgis.learn.ChangeDetector with ArcGIS Pro.

Thanks a lot.😎 

Yours Lino. Waiting for you!

Tags (1)
0 Kudos
3 Replies
Tim_McGinnes
Occasional Contributor III

Browsing through the source code shows that it requires a data folder with 3 subfolders (images_before, images_after, labels). I presume the images should have the same name in each folder. The label images should use black (RGB 0,0,0) for No Change and white (RGB 255,255,255) for Change.

There is a link to the research paper in the help:

https://www.mdpi.com/2072-4292/12/10/1662/htm 

From the research paper you can find links to a sample change detection training dataset on GitHub:

https://justchenhao.github.io/LEVIR/ 

If you download the files, just create the required subfolders listed above and copy the relevant images into each one.

I have managed to get it training in a notebook, but the results are very underwhelming so far. The sample images above are 1024x1024 with lots of No Change and I think that may be causing issues.

from arcgis.learn import ChangeDetector, prepare_data
data_path = r'<path_to_data_folder>'
data = prepare_data(data_path, batch_size=1, dataset_type='ChangeDetection')
model = ChangeDetector(data)
model.fit(10, lr=1e-4)
model.show_results()
model.save(r'<path_to_data_folder>',save_inference_file=True)

 

0 Kudos
LinoSun
New Contributor III

Hi there, I have tried the method you said. I train the model with arcgis.learn and inference with arcgis.learn.ChangeDetector.predict function.So it means that we complete this DeepLearning work using arcgis.learn framework  instead of ArcGIS Pro.And another question is that there is not inferrence GP tool for ChangeDetector in ArcGIS Pro?😅

Whatever,thanks a alot for answering my before.

0 Kudos
Tim_McGinnes
Occasional Contributor III

Correct, this is only possible in arcgis.learn at the moment. It takes a while for the deep learning model types to be useable in the ArcGIS Pro tools, so it may be there in a future release.

I did manage to find a page about ChangeDetection in the Python API Guide in GitHub, although it hasn't made it to the actual website yet:

https://github.com/Esri/arcgis-python-api/blob/master/guide/14-deep-learning/how_change_detection_wo... 

0 Kudos