Skip to content

Commit

Permalink
Olive trees
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Sep 27, 2024
1 parent 35f1997 commit df0f676
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 38 deletions.
49 changes: 49 additions & 0 deletions data_prep/OliveTrees_spain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os
import json
import pandas as pd
import geopandas as gpd
from deepforest import utilities

def extract_annotations(json_path, image_dir):
with open(json_path) as f:
data = json.load(f)

annotations = []
for key, value in data.items():
filename = value['filename']
regions = value['regions']
for key, value in regions.items():
shape_attributes = value['shape_attributes']
all_points_x = shape_attributes['all_points_x']
all_points_y = shape_attributes['all_points_y']
polygon = [(x, y) for x, y in zip(all_points_x, all_points_y)]
annotations.append({
'image_path': os.path.join(image_dir, filename),
'polygon': polygon
})

df = pd.DataFrame(annotations)
# Convert polygon to well known text string
df['polygon'] = df['polygon'].apply(lambda x: f"POLYGON(({', '.join([f'{p[0]} {p[1]}' for p in x])}))")
gdf = utilities.read_file(df)

return gdf

# Paths to the annotation files and directories
train_json_path = '/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/train/via_region_data.json'
val_json_path = '/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/val/via_region_data.json'
train_image_dir = '/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/train'
val_image_dir = '/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/val'

# Extract annotations
train_annotations = extract_annotations(train_json_path, train_image_dir)
val_annotations = extract_annotations(val_json_path, val_image_dir)

# Concatenate annotations
all_annotations = pd.concat([train_annotations, val_annotations], ignore_index=True)

# Save to CSV
output_csv_path = '/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/annotations.csv'
all_annotations["source"] = "Safonova et al. 2021"
all_annotations["label"] = "Tree"
all_annotations.to_csv(output_csv_path, index=False)
8 changes: 6 additions & 2 deletions data_prep/collect_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@
'/orange/ewhite/DeepForest/individual_urban_tree_crown_detection/annotations.csv',
'/orange/ewhite/DeepForest/ReForestTree/images/train.csv']

TreePoints = ["/orange/ewhite/DeepForest/TreeFormer/all_images/annotations.csv","/orange/ewhite/DeepForest/Ventura_2022/urban-tree-detection-data/images/annotations.csv"]
TreePoints = [
"/orange/ewhite/DeepForest/TreeFormer/all_images/annotations.csv",
"/orange/ewhite/DeepForest/Ventura_2022/urban-tree-detection-data/images/annotations.csv"]

TreePolygons = [
"/orange/ewhite/DeepForest/Jansen_2023/pngs/annotations.csv",
"/orange/ewhite/DeepForest/Troles_Bamberg/coco2048/annotations/annotations.csv",
"/orange/ewhite/DeepForest/Cloutier2023/images/annotations.csv",
"/orange/ewhite/DeepForest/Firoze2023/annotations.csv",
"/orange/ewhite/DeepForest/Wagner_Australia/annotations.csv",
"/orange/ewhite/DeepForest/Alejandro_Chile/alejandro/annotations.csv",
"/orange/ewhite/DeepForest/UrbanLondon/annotations.csv"
"/orange/ewhite/DeepForest/UrbanLondon/annotations.csv",
"/orange/ewhite/DeepForest/OliveTrees_spain/Dataset_RGB/annotations.csv"
]

# Current errors
Expand Down
87 changes: 51 additions & 36 deletions docs/datasets.md
Original file line number Diff line number Diff line change
@@ -1,112 +1,127 @@
# Datasets
There are three datasets within the MillionTrees package, TreeBoxes, TreePoints, TreePolygons. Those datasets contain many source datasets from dozens of papers and research efforts. Below, each source is briefly described. The images for each dataset are generated directly from the dataloaders to allow rapid verification of the annotation status and are regenerated automatically when a new dataset is released or updated.
There are three datasets within the MillionTrees package: TreeBoxes, TreePoints, and TreePolygons. These datasets contain many source datasets from dozens of papers and research efforts. Below, each source is briefly described. The images for each dataset are generated directly from the dataloaders to allow rapid verification of the annotation status and are regenerated automatically when a new dataset is released or updated.

## Boxes

### Kwon et al. 2023

![sample_image](public/Kwon_et_al_2023.png)
Citation: Ryoungseob Kwon, Youngryel Ryu, Tackang Yang, Zilong Zhong, Jungho Im,
Merging multiple sensing platforms and deep learning empowers individual tree mapping and species detection at the city scale,
ISPRS Journal of Photogrammetry and Remote Sensing, Volume 206, 2023,

Location: Suwon, South Korea
**Citation:** Ryoungseob Kwon, Youngryel Ryu, Tackang Yang, Zilong Zhong, Jungho Im,
*Merging multiple sensing platforms and deep learning empowers individual tree mapping and species detection at the city scale*,
ISPRS Journal of Photogrammetry and Remote Sensing, Volume 206, 2023

**Location:** Suwon, South Korea

### Velasquez-Camacho et al. 2023

![sample_image](public/Velasquez-Camacho_et_al._2023.png)

[https://zenodo.org/records/10246449](https://zenodo.org/records/10246449)
**Link:** [https://zenodo.org/records/10246449](https://zenodo.org/records/10246449)

Location: Spain
**Location:** Spain

### Zamboni et al. 2022

![sample_image](public/Zamboni_et_al._2021.png)

[https://github.com/pedrozamboni/individual_urban_tree_crown_detection](https://github.com/pedrozamboni/individual_urban_tree_crown_detection)
**Link:** [https://github.com/pedrozamboni/individual_urban_tree_crown_detection](https://github.com/pedrozamboni/individual_urban_tree_crown_detection)

Location: Mato Grosso do Sul, Brazil
**Location:** Mato Grosso do Sul, Brazil

## Points

### Amirkolaee et al. 2023

Amirkolaee, Hamed Amini, Miaojing Shi, and Mark Mulligan. "TreeFormer: a Semi-Supervised Transformer-based Framework for Tree Counting from a Single High Resolution Image." IEEE Transactions on Geoscience and Remote Sensing (2023). [https://github.com/HAAClassic/TreeFormer](https://github.com/HAAClassic/TreeFormer)
![sample_image](public/Amirkolaee_et_al._2023.png)

London, England
**Citation:** Amirkolaee, Hamed Amini, Miaojing Shi, and Mark Mulligan.
*TreeFormer: a Semi-Supervised Transformer-based Framework for Tree Counting from a Single High Resolution Image*.
IEEE Transactions on Geoscience and Remote Sensing (2023)

![sample_image](public/Amirkolaee_et_al._2023.png)
**Link:** [https://github.com/HAAClassic/TreeFormer](https://github.com/HAAClassic/TreeFormer)

**Location:** London, England

### Ventura et al. 2022

J. Ventura, C. Pawlak, M. Honsberger, C. Gonsalves, J. Rice, N.L.R. Love, S. Han, V. Nguyen, K. Sugano, J. Doremus, G.A. Fricker, J. Yost, and M. Ritter (2024). Individual Tree Detection in Large-Scale Urban Environments using High-Resolution Multispectral Imagery. International Journal of Applied Earth Observation and Geoinformation, 130, 103848. [https://github.com/jonathanventura/urban-tree-detection-data](https://github.com/jonathanventura/urban-tree-detection-data)
![sample_image](public/Ventura_et_al._2022.png)

Location: Southern California, United States
**Citation:** J. Ventura, C. Pawlak, M. Honsberger, C. Gonsalves, J. Rice, N.L.R. Love, S. Han, V. Nguyen, K. Sugano, J. Doremus, G.A. Fricker, J. Yost, and M. Ritter.
*Individual Tree Detection in Large-Scale Urban Environments using High-Resolution Multispectral Imagery*.
International Journal of Applied Earth Observation and Geoinformation, 130, 103848 (2024)

![sample_image](public/Ventura_et_al._2022.png)
**Link:** [https://github.com/jonathanventura/urban-tree-detection-data](https://github.com/jonathanventura/urban-tree-detection-data)

**Location:** Southern California, United States

## Polygons

### Zúñiga-González et al. 2023

[https://zenodo.org/records/8113842](https://zenodo.org/records/8113842)

![sample_image](public/Zuniga-Gonzalez_et_al._2023.png)

### Miranda et al. 2024
**Link:** [https://zenodo.org/records/8113842](https://zenodo.org/records/8113842)

[Courtesy of Alejandro Miranda](http://www.lepfor.ufro.cl/)
### Miranda et al. 2024

![sample_image](public/Alejandro_Miranda.png)

### Hickman et al. 2021
**Link:** [Courtesy of Alejandro Miranda](http://www.lepfor.ufro.cl/)

[https://zenodo.org/records/5515408](https://zenodo.org/records/5515408)
### Hickman et al. 2021

Sabah, Malaysia
**Link:** [https://zenodo.org/records/5515408](https://zenodo.org/records/5515408)

**Location:** Sabah, Malaysia

### Ball et al. 2023

[https://zenodo.org/records/8136161](https://zenodo.org/records/8136161)
**Link:** [https://zenodo.org/records/8136161](https://zenodo.org/records/8136161)

Danum, Malaysia
**Location:** Danum, Malaysia

### Cloutier et al. 2023

![sample_image](public/Cloutier_et_al._2023.png)
[https://zenodo.org/records/8148479](https://zenodo.org/records/8148479)

Location: Quebec, Canada
**Link:** [https://zenodo.org/records/8148479](https://zenodo.org/records/8148479)

**Location:** Quebec, Canada

### Firoze et al. 2023

[https://openaccess.thecvf.com/content/CVPR2023/papers/Firoze_Tree_Instance_Segmentation_With_Temporal_Contour_Graph_CVPR_2023_paper.pdf](https://openaccess.thecvf.com/content/CVPR2023/papers/Firoze_Tree_Instance_Segmentation_With_Temporal_Contour_Graph_CVPR_2023_paper.pdf)
![sample_image](public/Firoze_et_al._2023.png)

Indiana, United States
**Link:** [https://openaccess.thecvf.com/content/CVPR2023/papers/Firoze_Tree_Instance_Segmentation_With_Temporal_Contour_Graph_CVPR_2023_paper.pdf](https://openaccess.thecvf.com/content/CVPR2023/papers/Firoze_Tree_Instance_Segmentation_With_Temporal_Contour_Graph_CVPR_2023_paper.pdf)

![sample_image](public/Firoze_et_al._2023.png)
**Location:** Indiana, United States

### Jansen et al. 2022

![sample_image](public/Jansen_et_al._2023.png)

[https://zenodo.org/records/7094916](https://zenodo.org/records/7094916)
**Link:** [https://zenodo.org/records/7094916](https://zenodo.org/records/7094916)

Location: Northern Australia
**Location:** Northern Australia

### Troles et al. 2024
### Safonova et al. 2021

**Link:** [https://www.mdpi.com/1424-8220/21/5/1617](https://www.mdpi.com/1424-8220/21/5/1617)

Location: Bamberg, Germany
**Location:** Spain

### Troles et al. 2024

![sample_image](public/Troles_et_al._2024.png)

**Location:** Bamberg, Germany

### Wagner et al. 2023

[https://www.mdpi.com/2504-446X/7/3/155](https://www.mdpi.com/2504-446X/7/3/155)
![sample_image](public/Wagner_et_al._2023.png)

Australia
**Link:** [https://www.mdpi.com/2504-446X/7/3/155](https://www.mdpi.com/2504-446X/7/3/155)
[https://www.mdpi.com/2072-4292/16/11/1935](https://www.mdpi.com/2072-4292/16/11/1935)

![sample_image](public/Wagner_et_al._2023.png)
**Location:** Australia
Binary file added docs/public/Safonova_et_al._2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit df0f676

Please sign in to comment.