Landscape-Health Score (LHS) is an auxiliary evaluation tool based on Paddlepaddle framework. You can simply drag and drop image files to automatically analyze images and generate simple evaluation reports. The currently supported Bisenet and PSPNet models can realize the identification and segmentation of 9 kinds of environmental elements, and real-time statistics of the proportion of environmental elements, the green vision rate and the scores of 6 psychological indicators such as happy / relaxed / depressive / social / motivated / focused.
The image segmentation function is based on the principle of image semantic segmentation technology, using deep learning technology and Cityscapes data set training model, through the model to identify and classify pixels and count the area ratio of each element on the image.
Currently, the environmental elements that support identification are:
- sky
- terrain
- vegetation
- pole
- fence
- wall
- building
- sidewalk
- road
- water
- hill/mountain
Green vision rate is one of the reference indicators of environmental greening evaluation. Traditional green vision rate is counted by using the principle of RGB value of image pixels, which is obviously affected by environmental factors. Based on deep learning technology, green plants in the image can be identified, and other interference factors (such as green clothes / billboards, etc.) can be eliminated, so as to achieve more accurate proportion calculation.
It supports the evaluation and analysis of six psychological dimensions such as happy / relaxed / depressive / social / motivated / focused for the input image. At present, the function is still in the research and testing stage, and the algorithm will continue to upgrade and iterate.
- Windows10(Recommended)
- CPU Intel i5 or AMD equivalent processor
- GPU RTX1060 6G and above configuration (optional)
- npm >= 7.15
- Vite 2
- VUE 3.0
2021.08.03 - The stable version v1.0.1 optimized for windows has been released, click here to download
Usage: unzip directly, and then run "启动程序.exe" or "使用兼容模式运行.cmd". Bisenetv2 model is included by default.
Press Win+R
, enter cmd
Enter cd [LHS folder]
Enter pip install -r requirement.txt
Wait patiently for the installation to complete.
Go to Model List to download and decompress package of the model,and copy all the files to the folder named model
.We recommend downloading BiSeNetv2
model.
Press Win+R
,enter cmd
Enter cd [LHS folder]
Enter python app.py
to run the program
Open any browser except IE and enterhttp://127.0.0.1:5000
to the operation interface.
In order to meet the requirements for batch processing of images, I added a http API, which can initiate POST requests through any codes while running the program.
HTTP Method:POST
Request URL:http://127.0.0.1:5000/api/v1/json
Header:
Parameter | Value |
---|---|
Content-Type | application/json |
Request Parameter:
Parameter | Type | Description |
---|---|---|
image | string | Image information, Base64 encoding, bytes type need to be converted to UTF-8 |
Return Parameter:
Parameter | Type | Description |
---|---|---|
image | string | Base64 coding of image segmentation |
gvr | double | Green vision rate |
proportion | json | Proportion of environmental elements |
score | json | 6 dimensions of psychological index score |
The following three request cases are provided: curl / PHP and python:
curl -i -k 'http://127.0.0.1:5000/api/v1/json' --data 'image=[Image Base64 encoding, need URLEncode]' -H 'Content-Type:application/x-www-form-urlencoded'
<?php
function request_post($url = '', $param = '')
{
if (empty($url) || empty($param)) {
return false;
}
$postUrl = $url;
$curlPost = $param;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $postUrl);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
$url = 'http://127.0.0.1:5000/api/v1/json';
$img = file_get_contents('[Image filepath]');
$img = base64_encode($img);
$bodys = array(
'image' => $img
);
$res = request_post($url, $bodys);
var_dump($res);
import requests
import base64
import json
request_url = "http://127.0.0.1:5000/api/v1/json"
f = open('[Image filepath]', 'rb')
img = base64.b64encode(f.read()).decode('utf-8')
params = {'image':img}
headers = {'content-type': 'application/json'}
response = requests.post(request_url, data=json.dumps(params), headers=headers)
if response:
print (response.json())
* requirement.txt --list of dependent files
* app.py --main program for app
* infer_api.py --program for inference
* Qscore_algorithm.py --program for calculating health scores
* dist --front-end program (compiled)
* model --deep learning model
* frontend --front-end program (source code)
Currently, the BiSeNetv2 and PSPNet models are supported. The BiSeNetv2 model is small in size, has a fast predictive operation speed, and is suitable for a CPU operating environment, but the accuracy is poor. The PSPNet model has higher requirements for GPU, slower running speed, but higher accuracy. Note: Before using PSPNet, you need to install and configure the CUDA9.0+ .
Network Structure | Size | Requirement | Download Link |
---|---|---|---|
BiSeNetv2 | 8.4 MB | CPU | http://www.gis.show/index/article/id/18 |
PSPNet | 307.7 MB | GPU | http://www.gis.show/index/article/id/19 |
This project uses The GNU General Public License v3.0 (GPL3.0). Any program using this project needs to follow the content of the GPL3.0 and add citation sources.
SCULAB https://www.scurbanlab.com/
If you find our project useful in your research, please consider citing:
@article{CHEN2021151605,
title = {Predicting the effect of street environment on residents' mood states in large urban areas using machine learning and street view images},
journal = {Science of The Total Environment},
pages = {151605},
year = {2021},
issn = {0048-9697},
doi = {https://doi.org/10.1016/j.scitotenv.2021.151605},
author = {Chongxian Chen and Haiwei Li and Weijing Luo and Jiehang Xie and Jing Yao and Longfeng Wu and Yu Xia}
}
Paddlepaddle http://www.paddlepaddle.org.cn
GT https://github.com/GT-ZhangAcer