CLI tool to convert TIF files to GeoJSON with automatic mask generation using Meta AI's Segment Anything Model (SAM)
Project description
TIF to GeoJSON Converter
A CLI tool that converts TIF files to GeoJSON format with automatic mask generation.
Installation
pip install orthomasker
Usage
# Using CLI
orthomasker your_input_filename.tif your_output_filename.geojson --sam-checkpoint sam_vit_h_4b8939.pth --confidence-threshold 80 --verbose
# Using Python
from orthomasker.converter import TifToGeoJsonConverter
# Set up the converter (use the path to your .pth file)
converter = TifToGeoJsonConverter(
sam_checkpoint="sam_vit_h_4b8939.pth",
confidence_threshold=80.0,
verbose=True,
)
# Provide your own test TIF file (upload or use a sample)
input_tif = "your_input_filename.tif"
output_geojson = "your_output_filename.geojson"
converter.convert(input_tif, output_geojson)
Options
-
--sam-checkpoint: Path to SAM model weights (default: sam_vit_h_4b8939.pth) -
--model-type: SAM model type (vit_h,vit_l,vit_b; default: vit_h) -
--confidence-threshold: Minimum stability score to keep a mask (0–100; default: 0, no filter) -
--tile-size: Tile size for processing (default: 1024) -
--overlap: Tile overlap in pixels (default: 128) -
--class-name: Class label for output features (default: sam_object) -
--fixed-bounds: Bounding box (minx, miny, maxx, maxy) in image CRS -
--verbose: Enable verbose output
Development
Setup
git clone https://github.com/nickmccarty/orthomasker.git
cd orthomasker
pip install -r requirements.txt
pip install -e ".[ml,dev]"
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orthomasker-0.2.0.tar.gz.
File metadata
- Download URL: orthomasker-0.2.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0258d3c758340d5c4c498b47eba3f70658a1537efc3239c8051e6cbc04fe12ac
|
|
| MD5 |
1892b11f676004f9808f096e100e040f
|
|
| BLAKE2b-256 |
9f82e93db80ce4e024cd30cf85b110aa654457c9ceebabe8befb21985d85a35f
|
File details
Details for the file orthomasker-0.2.0-py3-none-any.whl.
File metadata
- Download URL: orthomasker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87f8b2acfc4974e8ee6255aba60ad084e04dd0c2588817452396d72a913253f2
|
|
| MD5 |
a23f75c4251df552e26028e5d399c4f3
|
|
| BLAKE2b-256 |
014dcd11d416e65b79a41037bf1b5ce92d1105d371e92fddeea314bdb6b67124
|