Skip to main content

Building Footprint Segmentation

Library to train building footprint on satellite and aerial imagery.

Python Contributions welcome Licence Downloads

Buy Me a Coffee at ko-fi.com

merge1

Installation

pip install building-footprint-segmentation

Dataset

Training

Visualize Training

Test images at end of every epoch
Visualizing on Tensorboard
from building_footprint_segmentation.helpers.callbacks import CallbackList, TensorBoardCallback
where_to_log_the_callback = r"path_to_log_callback"   
callbacks = CallbackList()

# Ouptut from all the callbacks caller will be stored at the path specified in log_dir
callbacks.append(TensorBoardCallback(where_to_log_the_callback))

To view Tensorboard dash board

tensorboard --logdir="path_to_log_callback"

Defining Custom Callback

from building_footprint_segmentation.helpers.callbacks import CallbackList, Callback

class CustomCallback(Callback):
    def __init__(self, log_dir):
        super().__init__(log_dir)


where_to_log_the_callback = r"path_to_log_callback"   
callbacks = CallbackList()

# Ouptut from all the callbacks caller will be stored at the path specified in log_dir
callbacks.append(CustomCallback(where_to_log_the_callback))

Split the images in smaller sample

import glob
import os

from image_fragment.fragment import ImageFragment

# FOR .jpg, .png, .jpeg
from imageio import imread, imsave

# FOR .tiff
from tifffile import imread, imsave

ORIGINAL_DIM_OF_IMAGE = (1500, 1500, 3)
CROP_TO_DIM = (384, 384, 3)

image_fragment = ImageFragment.image_fragment_3d(
    fragment_size=(384, 384, 3), org_size=ORIGINAL_DIM_OF_IMAGE
)

IMAGE_DIR = r"pth\to\input\dir"
SAVE_DIR = r"pth\to\save\dir"

for file in glob.glob(
    os.path.join(IMAGE_DIR, "*")
):
    image = imread(file)
    for i, fragment in enumerate(image_fragment):
        # GET DATA THAT BELONGS TO THE FRAGMENT
        fragmented_image = fragment.get_fragment_data(image)

        imsave(
            os.path.join(
                SAVE_DIR,
                f"{i}_{os.path.basename(file)}",
            ),
            fragmented_image,
        )

Segmentation for building footprint

  • binary
  • building with boundary (multi class segmentation)

Weight File

Commonly used utility task when working with Geotiff

Metadata

Release files for building-footprint-segmentation 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for building-footprint-segmentation 0.2.4
File Size Uploaded
building-footprint-segmentation-0.2.4.tar.gz 26.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for building-footprint-segmentation 0.2.4
File Interpreter ABI Platform
building_footprint_segmentation-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 62.7 kB

Release files / building-footprint-segmentation-0.2.4.tar.gz

Download URL building-footprint-segmentation-0.2.4.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
73472a9a9d32cfeaa184f957ffd4cbe2d0afc3fbf1ea520f613e5c11b2b60e8b
BLAKE2b-256 checksum
How to use checksums
9f78c86fc6505e6116d66aad8ef56e188042fc22eb19e0c7cf4b46bc04b51154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / building_footprint_segmentation-0.2.4-py3-none-any.whl

Download URL building_footprint_segmentation-0.2.4-py3-none-any.whl
Size 35.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b88dde2f15f3d139324eca126cad544195caa9051069797ea80ab0d59a3b356
BLAKE2b-256 checksum
How to use checksums
e62c33ff8ca58a6d47f107a095ea41eeb3c116ee04fd309fcaf27a78d4ee9af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page