Detection
detection
¶
Functions:¶
calculate_scores(geometry_column, confidence_feature, tile_gdf, image_shape)
¶
Calculate pseudo-confidence scores for the detections based on the following features of the tree crown:
1. Height - Taller trees are generally more easier to detect, making their confidence higher
2. Area - Larger tree crowns are easier to detect, hence less likely to be false positives
3. Distance - Trees near the edge of a tile might have incomplete data, reducing confidence
4. All - An option to compute a weighted combination of all factors as the confidence score
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry_column
|
str
|
The name of the column in the GeoDataFrame which has the geometries to be used for scoring |
required |
confidence_feature
|
str
|
The factor to use for scoring. Choose from: "height", "area", "distance", "all" |
required |
tile_gdf
|
GeoDataFrame
|
A GeoDataFrame with "treetop_height" (if using "height" based scoring) and other relevant columns |
required |
image_shape
|
tuple
|
The (i, j, channel) shape of the image that predictions were generated from |
required |
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: Calculated confidence scores. |
Source code in tree_detection_framework/utils/detection.py
use_release_df(save_dir=os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../../data/'), prebuilt_model='NEON', check_release=True)
¶
Check the existence of, or download the latest model release from github Args: save_dir: Directory to save filepath, default to "data" in deepforest repo prebuilt_model: Currently only accepts "NEON", but could be expanded to include other prebuilt models. The local model will be called prebuilt_model.h5 on disk. check_release (logical): whether to check github for a model recent release. In cases where you are hitting the github API rate limit, set to False and any local model will be downloaded. If no model has been downloaded an error will raise.
Returns: release_tag, output_path (str): path to downloaded model