Classify Pixel producing blocky results

1755
8
Jump to solution
08-10-2021 04:34 PM
TimG
by
New Contributor III

Hello

I am trying to identify forest areas and I have trained a UnetClassifier on 12 band Sentinel imagery (10 bands + 2 derived bands), and when I use ClassifyPixelsUsingDeepLearning most of the time it gives good results but in areas it often comes up blocky. Green circled area below.

2021-08-11_11h14_51.png

If I run the classify again but with a different slightly different "Processing Extent",(in other words move the AOI over but still include the green circle area), I get..

2021-08-11_11h15_29.png

So similar result, just blocks appear in different locations

The underlying landscape looks like this

2021-08-11_09h46_43.png

Other models I have run have done this (below), which initially look good, but then are blocky in the left lower corner

2021-08-11_09h45_58.png

Notes

  • I have reduced the batch size to 4 (and even 1) for the classify
  • Im on ArcGIS Pro 2.8.2, with the Deep Learning Framework 2.8
  • Using 64x64 tiles with resnet34
  • GPU 2080 Ti
  • This does look similar to a earlier post of mine just this is on a smaller scale.

Does any body have any ideas on what could cause this?

Many thanks

0 Kudos
2 Solutions

Accepted Solutions
by Anonymous User
Not applicable

I would recommend you to:

1. Use a bigger padding size such as 100 padding with 400 chip size, or 128 padding with 512 chip size. that will give more context to model and hopefully reduce the blocky effect.

2. Check if your exported training data has such samples, you can drop the chips to ArcGIS pro to check. Is there any reason that type of examples are not getting exported (Due to no data at edge of the features).

Thanks,

Sandeep

View solution in original post

TimG
by
New Contributor III

Hi Sandeep

I would have thought the 224 would have been ok but 400 and 512 chip does seem to solve the issue.  It does add huge amounts of time to the training, but thanks a lot for your help. 

Regards

Tim

View solution in original post

8 Replies
Tim_McGinnes
Occasional Contributor III

Sorry, no answers, but would like to ask what the dimensions of the blocky bits are (both in ground units and pixels\cells). What padding are you using in the Classify Pixels tool? Any relation between the measurements and your 64 x 64 tile size by itself or tile size + padding?

Tim_McGinnes_0-1628646203736.png

If there is some sort of underlying error or problem causing this you may need to provide your model and imagery to Esri for them to replicate\diagnose.

0 Kudos
TimG
by
New Contributor III

Thanks for your response Tim..

Yes those blocks on the grid you drew are 32 pixels, so half the 64 pixels tiles and here is the python command

with arcpy.EnvManager(scratchWorkspace=r"C:\Users\[removed]\Documents\ArcGIS\Projects\BlockyTest\BlockyTest.gdb", extent="1427104.74870767 5157534.88046057 1430210.46355023 5159991.76908254", cellSize=10, processorType="GPU", workspace=r"C:\Users\[removed]\Documents\ArcGIS\Projects\BlockyTest\BlockyTest.gdb"):


out_classified_raster = arcpy.ia.ClassifyPixelsUsingDeepLearning("12 Composite Bands", r"C:\LandCover\images\LandUse_SI\models\LandUse_SI\LandUse_SI.dlpk", "padding 16;batch_size 4;predict_background True;tile_size 64", "PROCESS_AS_MOSAICKED_IMAGE", None); out_classified_raster.save(r"C:\Users\[removed]\Documents\ArcGIS\Projects\BlockyTest\BlockyTest.gdb\LandUse_SI")

Would love to provide the model for diagnoses.

Thanks again

Tim

0 Kudos
by Anonymous User
Not applicable

@TimG You mentioned that your tile size is 64 * 64. It can be too low for model a model to get enough context. Also How much padding are you using ? I recommend to use a higher tile size with some padding for better results.

0 Kudos
TimG
by
New Contributor III

@Anonymous User Thanks for your response.  I just tried 112 * 112 with padding 28 and I still get block type results

2021-08-13_09h50_12.png

This is the original image 

2021-08-13_09h47_49.png

0 Kudos
by Anonymous User
Not applicable

Hi @TimG  can you try the same with

1. chip_size of 224 px with 56 padding

2. chip_size of 400 px with 100 padding

Let me know about the results.

Thanks,

Sandeep

0 Kudos
TimG
by
New Contributor III

Hi @Anonymous User

I haven't managed 400px but did try 224px with 56 padding.  Results below.  To me it still looks like it is happening.

2021-08-23_11h12_15.png

2021-08-23_11h14_30.png

On a side note....on my journey to create 224px it has subsequently had some other issues, which I have been detailing here

.

 

0 Kudos
by Anonymous User
Not applicable

I would recommend you to:

1. Use a bigger padding size such as 100 padding with 400 chip size, or 128 padding with 512 chip size. that will give more context to model and hopefully reduce the blocky effect.

2. Check if your exported training data has such samples, you can drop the chips to ArcGIS pro to check. Is there any reason that type of examples are not getting exported (Due to no data at edge of the features).

Thanks,

Sandeep

TimG
by
New Contributor III

Hi Sandeep

I would have thought the 224 would have been ok but 400 and 512 chip does seem to solve the issue.  It does add huge amounts of time to the training, but thanks a lot for your help. 

Regards

Tim