Tree detection from aerial imagery
Project description
DetecTree
Overview
DetecTree is a Pythonic library to classify tree/non-tree pixels from aerial imagery, following the methods of Yang et al. [1].
import detectree as dtr
import matplotlib.pyplot as plt
import rasterio as rio
from rasterio import plot
# select the training tiles from the tiled aerial imagery dataset
ts = dtr.TrainingSelector(img_dir='data/tiles')
split_df = ts.train_test_split(method='cluster-I')
# train a tree/non-tree pixel classfier
clf = dtr.ClassifierTrainer().train_classifier(
split_df=split_df, response_img_dir='data/response_tiles')
# use the trained classifier to predict the tree/non-tree pixels
test_filepath = split_df[~split_df['train'].sample(1).iloc[0]['img_filepath']
y_pred = dtr.Classifier().classify_img(test_filepath, clf)
# side-by-side plot of the tile and the predicted tree/non-tree pixels
figwidth, figheight = plt.rcParams['figure.figsize']
fig, axes = plt.subplots(1, 2, figsize=(2 * figwidth, figheight))
with rio.open(img_filepath) as src:
plot.show(src.read(), ax=axes[0])
axes[1].imshow(y_pred)
See the API documentation and the example repository to get started.
Installation
To install use pip:
$ pip install detectree
Acknowledgments
- With the support of the École Polytechnique Fédérale de Lausanne (EPFL)
References
- Yang, L., Wu, X., Praun, E., & Ma, X. (2009). Tree detection from aerial imagery. In Proceedings of the 17th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (pp. 131-137). ACM.
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
detectree-0.3.1.tar.gz
(32.4 kB
view details)
File details
Details for the file detectree-0.3.1.tar.gz.
File metadata
- Download URL: detectree-0.3.1.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200310 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdd6853f386b2096cae5f4c29f9e575cb34648ed2813a97ccbec208606361674
|
|
| MD5 |
87c55eee1db3b0d486b2368e2615d714
|
|
| BLAKE2b-256 |
9f308696653cd7cabb2d7ddb92e7b908b5f0bd54d3621ae988ba1576f260fd5a
|