<jupyter_start><jupyter_text>Segmentation Data from Satellite Imagery Segmentation is process of partitioning raster into some non-overlapping partitions, called segments [1] . Input of segmentation is patched raster for all Indonesia grid. We use segutils.runShepherdSegmentation function on rsgislib library. This segmentation method has four steps: 1. A seeding step: identifies the unique spectral signatures within the image,  2. A clumping process : to create unique regions, 3. An elimination process : to remove regions below the minimum mapping unit, and, 4. Relabelled the image<jupyter_code>import matplotlib.pyplot as plt
import rasterio
from rasterio.plot import show
from rsgislib.segmentation import segutils
from rsgislib.segmentation import tiledsegsingle<jupyter_output><empty_output><jupyter_text>The input raster we used is patched raster. The input raster we use is showed below:<jupyter_code>inImage='input/32_Jabar_2020_ID-1897.tif'
outputClumps='output clumps/ID-1897_notile_1000px_processInMem_specBand.tif'

rds = rasterio.open(inImage)
fig, ax = plt.subplots(1,1, figsize=(10,10))
show(rds, ax=ax, title = "TRAIN_CLASS")
plt.show()<jupyter_output><empty_output><jupyter_text>The initial number of cluster centres to be produced is 6 and the minimum pixel of each clumps is 500 pixel.<jupyter_code>%%time
segutils.runShepherdSegmentation(inImage,
                                 outputClumps,
                                 numClusters=8,
                                 minPxls=1000,
                                 bands=[1,2,3],
                                 gdalformat='GTiff',
                                 kmMaxIter=5,
                                 distThres=500,
                                 noStats=True,
                                 noStretch=True,
                                 processInMem=True)
rds = rasterio.open(outputClumps)
fig, ax = plt.subplots(1,1, figsize=(10,10))
show(rds, ax=ax, title = "TRAIN_CLASS")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07288051561725335, 'fraction_numerical': 0.02528507684680218, 'mean_word_length': 2.7790262172284645, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '451789', 'license': 'MIT', 'n_tokens_mistral': 625, 'n_tokens_neox': 578, 'n_words': 165, 'path': 'sampleData/Segmen_Notebook.ipynb', 'repo_name': 'achmfirmansyah/mldocs_st2023', 'size': '2017'}