# edge_assessment
[![standard-readme compliant](https://img.shields.io/badge/edge%20assessment-standard-brightgreen.svg?style=flat-square)](https://github.com/Remote-Sensing-of-Land-Resource-Lab/AssessEdge)
An assessment tool for evaluating the quality of object edges within an input map.
![](/images/pic1.jpg "Agricultural Field Delineation")
## Table of Contents
* [Background](#background)
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)
## Background
An accurate delineation of edge is critical for object-based image analysis on land resources such as agricultural field objects and building objects, and change detection particularly for climate-induced land change such as snow melting and treeline shifts. The traditional F1-score has been widely used for assessing map quality, which, however, often fails to provide information on object boundary quality. To address this problem, we developed a new evaluation index to take account of both thematic and edge accuracy.
## Install
Install AssessEdge using `pip`:
```bash
pip install AssessEdge
```
Use requirements.txt to install the required packages.
```bash
pip install -r requirements.txt
```
## Usage
The two main functions are `eval_edge` and `plot_results` in `edge_buffer.py`
`eval_edge(testing_field, reference_field, step, min_width, initial_max_width)`: input two variables(testing_field & reference_field), the testing_field represents the result of classification, the reference_field represents the real reference object field. The pixel values of target objects should be processed as 1, and pixel values of background should be 0 or no data. The function will return a dictionary include commission error, omission error, edge f1 score, middle point, etc. The `step` defaults as 3, the `initial_max_width` defaults as 0, and the `min_width` defaults as 3.
`plot_results`: show the testing_field and reference_field data fit curves and their data points.
Users can type the following codes to use these two functions
```bash
from AssessEdge import eval_edge, plot_results
from AssessEdge import rasterio_loaddata
def main(map_path, reference_path):
map_path = "/images/testing_field.tif"
reference_path = "/images/reference_field.tif"
map_array = rasterio_loaddata(map_path)
reference_array = rasterio_loaddata(reference_path)
result = eval_edge(map_array, reference_array)
plot_results(result)
if __name__ == "__main__":
main()
```
### Test
Testing images have been placed in the images folder.
The test procedure is assess_image.py in test folder. To test it
```bash
python assess_image.py --map_path map_path --reference_path reference_path
```
It will show the test result as following
![](/images/test_result.png "Test result")
## Contributors
Yingfan Zhang (zhangyingfanuk@163.com), Su Ye
## License
[Apache License](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/Remote-Sensing-of-Land-Resource-Lab/AssessEdge",
"name": "AssessEdge",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, edge, accuracy",
"author": "Yingfan Zhang",
"author_email": "<zhangyingfanuk@163.com>",
"download_url": "https://files.pythonhosted.org/packages/c4/82/07019d09780e926640ec9854ab31a198d441128fcfc600024d831fa81389/assessedge-2.0.tar.gz",
"platform": null,
"description": "# edge_assessment\r\n\r\n[![standard-readme compliant](https://img.shields.io/badge/edge%20assessment-standard-brightgreen.svg?style=flat-square)](https://github.com/Remote-Sensing-of-Land-Resource-Lab/AssessEdge)\r\n\r\nAn assessment tool for evaluating the quality of object edges within an input map.\r\n\r\n![](/images/pic1.jpg \"Agricultural Field Delineation\")\r\n\r\n## Table of Contents\r\n * [Background](#background)\r\n * [Install](#install)\r\n * [Usage](#usage)\r\n * [Contributors](#contributors)\r\n * [License](#license)\r\n\r\n## Background\r\n\r\nAn accurate delineation of edge is critical for object-based image analysis on land resources such as agricultural field objects and building objects, and change detection particularly for climate-induced land change such as snow melting and treeline shifts. The traditional F1-score has been widely used for assessing map quality, which, however, often fails to provide information on object boundary quality. To address this problem, we developed a new evaluation index to take account of both thematic and edge accuracy.\r\n\r\n## Install\r\nInstall AssessEdge using `pip`:\r\n\r\n```bash\r\npip install AssessEdge\r\n```\r\n\r\nUse requirements.txt to install the required packages.\r\n\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n## Usage\r\n\r\nThe two main functions are `eval_edge` and `plot_results` in `edge_buffer.py`\r\n\r\n`eval_edge(testing_field, reference_field, step, min_width, initial_max_width)`: input two variables(testing_field & reference_field), the testing_field represents the result of classification, the reference_field represents the real reference object field. The pixel values of target objects should be processed as 1, and pixel values of background should be 0 or no data. The function will return a dictionary include commission error, omission error, edge f1 score, middle point, etc. The `step` defaults as 3, the `initial_max_width` defaults as 0, and the `min_width` defaults as 3.\r\n\r\n`plot_results`: show the testing_field and reference_field data fit curves and their data points. \r\n\r\nUsers can type the following codes to use these two functions\r\n\r\n```bash\r\nfrom AssessEdge import eval_edge, plot_results\r\nfrom AssessEdge import rasterio_loaddata\r\n\r\ndef main(map_path, reference_path):\r\n map_path = \"/images/testing_field.tif\"\r\n reference_path = \"/images/reference_field.tif\"\r\n map_array = rasterio_loaddata(map_path)\r\n reference_array = rasterio_loaddata(reference_path)\r\n result = eval_edge(map_array, reference_array)\r\n plot_results(result)\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n### Test \r\nTesting images have been placed in the images folder.\r\nThe test procedure is assess_image.py in test folder. To test it \r\n```bash\r\npython assess_image.py --map_path map_path --reference_path reference_path\r\n```\r\nIt will show the test result as following\r\n![](/images/test_result.png \"Test result\")\r\n\r\n## Contributors\r\n\r\nYingfan Zhang (zhangyingfanuk@163.com), Su Ye\r\n\r\n## License\r\n\r\n[Apache License](LICENSE)\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Accuracy assessment on edge",
"version": "2.0",
"project_urls": {
"Homepage": "https://github.com/Remote-Sensing-of-Land-Resource-Lab/AssessEdge"
},
"split_keywords": [
"python",
" edge",
" accuracy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "06d85ec9d1215d4e004938649c0166f347156131a127242fda93bb10153c020c",
"md5": "fc4231b3a5f020bf251df5bd6cb74415",
"sha256": "95b5c10c1e831b99dc50017c676b57af666e1cb8be3bcfc39a197e1af6cb448b"
},
"downloads": -1,
"filename": "AssessEdge-2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fc4231b3a5f020bf251df5bd6cb74415",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6628,
"upload_time": "2024-06-24T14:10:03",
"upload_time_iso_8601": "2024-06-24T14:10:03.124766Z",
"url": "https://files.pythonhosted.org/packages/06/d8/5ec9d1215d4e004938649c0166f347156131a127242fda93bb10153c020c/AssessEdge-2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c48207019d09780e926640ec9854ab31a198d441128fcfc600024d831fa81389",
"md5": "fc12c3a323bfc758fe42703815ae8ff8",
"sha256": "5436e08da2ee0fb8d6145589e34835140a725e556190eaa6fde419a36106fce1"
},
"downloads": -1,
"filename": "assessedge-2.0.tar.gz",
"has_sig": false,
"md5_digest": "fc12c3a323bfc758fe42703815ae8ff8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6693,
"upload_time": "2024-06-24T14:10:07",
"upload_time_iso_8601": "2024-06-24T14:10:07.110878Z",
"url": "https://files.pythonhosted.org/packages/c4/82/07019d09780e926640ec9854ab31a198d441128fcfc600024d831fa81389/assessedge-2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-24 14:10:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Remote-Sensing-of-Land-Resource-Lab",
"github_project": "AssessEdge",
"github_not_found": true,
"lcname": "assessedge"
}