|
1 | | -# Urban-Code |
2 | | -## Package Structure |
3 | | -urbancode/ |
4 | | -├── urbancode/ |
5 | | -│ ├── __init__.py |
6 | | -│ └── network/ |
7 | | -│ ├── tests/ |
8 | | -│ │ ├── __init__.py |
9 | | -│ │ ├── test_core.py |
10 | | -│ │ ├── test_connectivity.py |
11 | | -│ │ ├── test_centrality.py |
12 | | -│ │ ├── test_utils.py |
13 | | -│ │ └── test_visualization.py |
14 | | -│ ├── __init__.py |
15 | | -│ ├── core.py |
16 | | -│ ├── connectivity.py |
17 | | -│ ├── centrality.py |
18 | | -│ ├── visualization.py |
19 | | -│ └── utils.py |
20 | | -├── examples/ |
21 | | -│ └── urban network analytics.ipynb |
22 | | -├── README.md |
23 | | -├── LICENSE |
24 | | -├── setup.py |
25 | | -├── requirements.txt |
26 | | -└── .gitignore |
| 1 | +# UrbanCode (v0.2.1) |
| 2 | + |
| 3 | +A Python package for street view image perception analysis, providing tools for feature extraction and comfort prediction. |
| 4 | + |
| 5 | +## Related Research |
| 6 | + |
| 7 | +[Thermal Comfort in Sight: Thermal Affordance and Its Visual Assessment](https://github.com/Sijie-Yang/Thermal-Affordance) |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +### Street View Image (SVI) Analysis |
| 12 | +- Semantic segmentation |
| 13 | +- Object detection |
| 14 | +- Color feature extraction |
| 15 | +- Scene recognition |
| 16 | +- Perception analysis (thermal_comfort, visual_comfort, safety, etc.) |
| 17 | + |
| 18 | +## Examples |
| 19 | + |
| 20 | +### 1. Street View Image Feature Extraction |
| 21 | +`examples/test_svi_image_feature.ipynb` |
| 22 | +- Demonstrates how to extract various features from street view images |
| 23 | +- Includes semantic segmentation, object detection, color analysis, and scene recognition |
| 24 | +- Shows how to process multiple images and save results |
| 25 | + |
| 26 | +### 2. Street View Image Comfort Prediction |
| 27 | +`examples/test_svi_comfort_prediction.ipynb` |
| 28 | +- Shows how to predict comfort scores from street view images |
| 29 | +- Demonstrates the use of the comfort function for both single images and folders |
| 30 | +- Includes visualization of perception metrics |
| 31 | +- Automatically normalizes perception scores to 0-5 range |
| 32 | + |
| 33 | +## Installation |
| 34 | + |
| 35 | +```bash |
| 36 | +pip install urbancode |
| 37 | +``` |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +### Feature Extraction |
| 42 | +```python |
| 43 | +import urbancode as uc |
| 44 | +import pandas as pd |
| 45 | + |
| 46 | +# Process a folder of images |
| 47 | +df = uc.svi.filename("path/to/folder") |
| 48 | +df = uc.svi.segmentation(df, folder_path="path/to/folder") |
| 49 | +df = uc.svi.object_detection(df, folder_path="path/to/folder") |
| 50 | +df = uc.svi.color(df, folder_path="path/to/folder") |
| 51 | +df = uc.svi.scene_recognition(df, folder_path="path/to/folder") |
| 52 | + |
| 53 | +# Save results |
| 54 | +df.to_csv("svi_results.csv", index=False) |
| 55 | +``` |
| 56 | + |
| 57 | +### Comfort Prediction |
| 58 | +```python |
| 59 | +import urbancode as uc |
| 60 | + |
| 61 | +# Process a single image |
| 62 | +df = uc.svi.comfort("path/to/image.jpg", mode='image') |
| 63 | + |
| 64 | +# Process a folder of images |
| 65 | +df = uc.svi.comfort("path/to/folder", mode='folder') |
| 66 | + |
| 67 | +# Save results |
| 68 | +df.to_csv("comfort_results.csv", index=False) |
| 69 | +``` |
| 70 | + |
| 71 | +### Perception Metrics |
| 72 | +The comfort function returns a DataFrame with the following perception metrics (normalized to 0-5 range): |
| 73 | +- thermal_comfort |
| 74 | +- visual_comfort |
| 75 | +- temp_intensity |
| 76 | +- sun_intensity |
| 77 | +- humidity_inference |
| 78 | +- wind_inference |
| 79 | +- traffic_flow |
| 80 | +- greenery_rate |
| 81 | +- shading_area |
| 82 | +- material_comfort |
| 83 | +- imageability |
| 84 | +- enclosure |
| 85 | +- human_scale |
| 86 | +- transparency |
| 87 | +- complexity |
| 88 | +- safe |
| 89 | +- lively |
| 90 | +- beautiful |
| 91 | +- wealthy |
| 92 | +- boring |
| 93 | +- depressing |
0 commit comments