Over the last weeks, I shared a three part tutorial on training a model to identify homes damaged by wildfire, hurricane or tornado using Azure Cognitive services. In the final part we looked at how to use the Cognitive Services API to automate analysis of properties. Building on that, I’ve used the API to create an app to read a CSV file of coordinates, request the imagery from Vexcel API, and run each through the Cognitive services model. the results are written out to a CSV file that you can then do further analysis with, as well as a KML file to load into a GIS. You will need your Vexcel Platform account credentials to run the app.
You can download a zip file containing the app (runs on Any flavor of Windows) and a couple of sample CSV files to run through it. Unzip everything to a folder and launch the .exe to get started.
Choose Your Input File
Use the … button to browse and select your input CSV. The first column should contain latitude and the second column, longitude. Additional fields can follow. A couple of sample files are included in the zip that you can use as a template. (I’ll cover the building footprints option in the next article.)
Set a name for your output file
a CSV and KML file will be created in the same folder as your input file. Specify a name for the root of the file. The appropriate extensions will be appended on.
Choose the appropriate model and processing threads
there are two choices for model; Wildfire and Wind Damage. choose the one appropriate for the type of damage you are analyzing. You can choose from 1 to 8 processing threads.
Finally enter your Vexcel Platform credentials and hit the Go! button to get things started.

While the app is running, have a look in the output folder. You’ll see some temporary files being created there of the form OutputFilename_thread#. To prevent IO conflict, each thread writes to it’s own files and when the run is finished, these files will be appended together to form your final output KML and CSV files. You can then delete these temp files if you wish.
After processing is complete, open up the .CSV file in Excel or a text editor. You’ll see three fields have been appended to your input file representing the prediction from the model, the date of the image used in the analysis and a link to the image itself. In the screenshot below you can see this in columns D, E, and F respectively. If you were running the wind damage model, the predictions will go from Damage0 (no visible damage) to Damage4 (complete loss). The score shown is the probability the prediction is correct. For Wildfire, there are just 2 possible tags; Fire0 (undamaged) and fire2 (burned).

Let’s look at row 4, which scored Damage4 with very high probability. the ImageURL in Column F returns this image:

You can load the CSV or KML file into just about any mapping application which will certainly have support for either CSV or KML files. Lets use the Vexcel viewer to visualize a file of Fire Damaged properties in Otis Oregon. After the run was complete, I loaded the CSV file into Excel, sorted by the AI_Probability column, then cut all of the damage2 records into 1 file, and damage0 into another. this allows me to load them as two sperate layers in the Vexcel viewer.
In this first image you can see all of the properties in the region that were run through the app.

And in these next two, you can see the properties tagged Damage2 in red.

and here zoomed in to the damaged cluster in the northeast

KNOWN APP ISSUES
After appending the individual KML file there is a stray character on the last line of the file that prevents it from loading in some client apps. if you encounter this, load the file in a text editor and delete the last line with the odd control character. I’ll fix this as soon as I figure out what’s causing it 🙂