# DeepForest-pytorch
[![Conda package](https://github.com/weecology/DeepForest-pytorch/actions/workflows/Conda-app.yml/badge.svg)](https://github.com/weecology/DeepForest-pytorch/actions/workflows/Conda-app.yml)
[![Documentation Status](https://readthedocs.org/projects/deepforest-pytorch/badge/?version=latest)](https://deepforest-pytorch.readthedocs.io/?badge=latest)
A pytorch implementation of the DeepForest model for individual tree crown detection in RGB images. DeepForest is a python package for training and predicting individual tree crowns from airborne RGB imagery. DeepForest comes with a prebuilt model trained on data from the National Ecological Observatory Network. Users can extend this model by annotating and training custom models starting from the prebuilt model.
<sub> DeepForest es un paquete de python para la predicción de coronas de árboles individuales basada en modelos entrenados con imágenes remotas RVA ( RGB, por sus siglas en inglés). DeepForest viene con un modelo entrenado con datos proveídos por la Red Nacional de Observatorios Ecológicos (NEON, por sus siglas en inglés). Los usuarios pueden ampliar este modelo pre-construido por anotación de etiquetas y entrenamiento con datos locales. La documentación de DeepForest está escrita en inglés, sin embargo, agradeceríamos contribuciones con fin de hacerla accesible en otros idiomas. <sub>
<sub> DeepForest(PyTorch版本)是一个Python软件包,它可以被用来训练以及预测机载RGB图像中的单个树冠。DeepForest内部带有一个基于国家生态观测站网络(NEON : National Ecological Observatory Network)数据训练的预训练模型。在此模型基础上,用户可以注释新的数据然后训练自己的模型。DeepForest的文档是用英文编写的,如果您有兴趣为翻译文档做出贡献。欢迎与我们团队联系。<sub>
## Motivation
The original DeepForest repo is written in tensorflow and can be found on pypi, conda and source (https://github.com/Weecology/DeepForest). After https://github.com/fizyr/keras-retinanet was deprecated, it became obvious that the shelf life of models that depend on tensorflow 1.0 was limited. The machine learning community is moving more towards pytorch, where many new models can be found.
# Installation
Compiled wheels have been made for linux, osx and windows
```
#Install DeepForest-pytorch
pip install deepforest-pytorch
```
# Usage
## Train a model
```Python
from deepforest import main
m = main.deepforest()
m.create_trainer()
m.run_train()
m.evaluate(csv_file=m.config["validation"]["csv_file"], root_dir=m.config["validation"]["root_dir"])
```
[Google colab demo on model training](https://colab.research.google.com/drive/1AJUcw5dEpXeDPHd0sotAz5lpWedFYSIL#offline=true&sandboxMode=true)
## Predict a single image
```Python
from deepforest import main
csv_file = '/Users/benweinstein/Documents/DeepForest-pytorch/deepforest/data/OSBS_029.tif'
df = trained_model.predict_file(csv_file, root_dir = os.path.dirname(csv_file))
```
## Predict a large tile
```Python
prediction = trained_model.predict_tile(raster_path = raster_path,
patch_size = 300,
patch_overlap = 0.5,
return_plot = False)
```
## Evaluate a file of annotations using intersection-over-union
```Python
csv_file = get_data("example.csv")
root_dir = os.path.dirname(csv_file)
precision, recall = m.evaluate(csv_file, root_dir, iou_threshold = 0.5)
```
# Config
DeepForest comes with a default config file (deepforest_config.yml) to control the location of training and evaluation data, the number of gpus, batch size and other hyperparameters. This file can be edited directly, or using the config dictionary after loading a deepforest object.
```Python
from deepforest import main
m = main.deepforest()
m.config["train"]["batch_size"] = 10
```
Config parameters are documented [here](https://deepforest-pytorch.readthedocs.io/en/latest/ConfigurationFile.html).
# Tree Detection Benchmark score
Tree detection is a central task in forest ecology and remote sensing. The Weecology Lab at the University of Florida has built a tree detection benchmark for evaluation. After building a model, you can compare it to the benchmark using the evaluate method.
```
git clone https://github.com/weecology/NeonTreeEvaluation.git
cd NeonTreeEvaluation
```
```Python
results = m.evaluate(csv_file = "evaluation/RGB/benchmark_annotations.csv", root_dir = "evaluation/RGB/")
results["recall"]
results["precision"]
```
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | deepforest-pytorch-0.1.41.tar.gz
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 201 浏览量
2022-01-10
12:17:55
上传
评论
收藏 19.08MB GZ 举报
温馨提示
共57个文件
py:30个
csv:5个
png:5个
资源来自pypi官网。 资源全名:deepforest-pytorch-0.1.41.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
deepforest-pytorch-0.1.41.tar.gz (57个子文件)
deepforest-pytorch-0.1.41
MANIFEST.in 754B
PKG-INFO 2KB
deepforest
visualize.py 5KB
utilities.py 10KB
main.py 18KB
callbacks.py 3KB
data
2019_YELL_2_541000_4977000_image_crop.xml 91KB
2019_YELL_2_528000_4978000_image_crop2.png 14.62MB
SOAP_061.png 361KB
testfile_multi.csv 1KB
OSBS_029.xml 20KB
OSBS_029.tif 594KB
OSBS_029.csv 2KB
classes.csv 17B
SOAP_031.png 346KB
__init__.py 0B
testfile_deepforest.csv 2KB
SOAP_061.xml 12KB
2019_YELL_2_541000_4977000_image_crop.png 2.76MB
OSBS_029.png 403KB
example.csv 5KB
deepforest_config.yml 628B
2019_YELL_2_528000_4978000_image_crop2.xml 189KB
predict.py 12KB
dataset.py 4KB
evaluate.py 6KB
__init__.py 345B
preprocess.py 11KB
IoU.py 4KB
model.py 2KB
_version.py 39B
deepforest_pytorch.egg-info
PKG-INFO 2KB
requires.txt 181B
not-zip-safe 1B
SOURCES.txt 2KB
top_level.txt 17B
dependency_links.txt 1B
tests
test_IoU.py 1KB
test_callbacks.py 2KB
profile_evaluate.py 871B
test_data.py 681B
conftest.py 234B
test_environment.py 123B
test_dataset.py 3KB
test_visualize.py 2KB
profile_predict_file.py 1KB
test_evaluate.py 3KB
__init__.py 64B
test_model.py 573B
profile_dataset.py 694B
test_preprocess.py 6KB
test_utilities.py 1KB
test_main.py 10KB
LICENSE 1KB
setup.cfg 670B
setup.py 2KB
README.md 5KB
共 57 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功