Skip to content

Parskatt/skyseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkySeg

Segments sky, hopefully mostly correctly.

The model is pretty conservative, so you might want to use something else if you really dont want sky (see examples below).

Basically just pixel-wise robust single model linear regression based on an initial coarse skymask.

NOTE: Does not deal with clouds yet.

Installation

Install dependencies using uv (or your preferred package manager):

uv sync

Or install manually:

pip install tqdm onnxruntime numpy torch imageio requests opencv-python

Usage

Basic Usage

from skyseg import load_skyseg_model, segment_sky_mask
from pathlib import Path

# Load the model (downloads automatically if not found)
model = load_skyseg_model()

# Segment sky in an image
image_path = Path("path/to/your/image.jpg")
mask = segment_sky_mask(image_path, model)

# Save the mask
import imageio.v2 as imageio
imageio.imwrite("sky_mask.png", mask)

Running Tests

Run the test script to process all images in the assets/ directory:

python tests/test_segmentation.py

This will generate sky masks and overlay visualizations in tests/outputs/.

Examples

Here are some example results from the test suite:

Input: assets/981256188_8f690e95b1_o.jpg.jpg

Input image
Input
Sky mask
Sky Mask
Overlay visualization
Overlay

The overlay shows the original image with non-sky regions highlighted in red.

Input: assets/525678483_c9b1a3665a_o.jpg.jpg

Input image
Input
Sky mask
Sky Mask
Overlay visualization
Overlay

Input: assets/331810308_2fe422b1ec_o.jpg.jpg

Input image
Input
Sky mask
Sky Mask
Overlay visualization
Overlay

Input: assets/264489593_6de914a0ab_o.jpg.jpg

Input image
Input
Sky mask
Sky Mask
Overlay visualization
Overlay
Input image
Input
Sky mask
Sky Mask
Overlay visualization
Overlay

Output Format

The segmentation mask uses the format:

  • 0 = Sky region (black in visualization)
  • 255 = Non-sky region (white in visualization)

Model

The model is based on the work from Sky-Segmentation-and-Post-processing and is automatically downloaded from Hugging Face if not found locally.

License

See the original model repository for license information.

Citation

Just link to this Github page if you use this for something :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages