Metadata-Version: 2.4
Name: urbancode
Version: 0.2.3
Summary: A package for universal urban analysis
Home-page: https://github.com/Sijie-Yang/urbancode
Author: Sijie Yang
Author-email: sijiey@u.nus.edu
Project-URL: Bug Tracker, https://github.com/Sijie-Yang/urbancode/issues
Project-URL: Changelog, https://github.com/Sijie-Yang/urbancode/blob/main/CHANGELOG.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=2.5
Requires-Dist: osmnx>=1.1.1
Requires-Dist: momepy>=0.5.3
Requires-Dist: geopandas>=0.9.0
Requires-Dist: matplotlib>=3.3.4
Requires-Dist: torch>=2.0.0
Requires-Dist: torchvision>=0.15.0
Requires-Dist: pillow>=9.0.0
Requires-Dist: pandas>=1.2.0
Requires-Dist: scikit-learn>=0.24.0
Requires-Dist: tqdm>=4.60.0
Requires-Dist: tensorboard>=2.5.0
Requires-Dist: opencv-python>=4.5.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: transformers>=4.30.0
Requires-Dist: accelerate>=0.20.0
Requires-Dist: safetensors>=0.3.1
Requires-Dist: urllib3>=2.0.0
Requires-Dist: requests>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0; extra == "dev"
Requires-Dist: flake8>=3.9.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: isort>=5.0; extra == "dev"
Requires-Dist: jupyter>=1.0.0; extra == "dev"
Requires-Dist: ipywidgets>=8.0.0; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# UrbanCode (v0.2.1)

A Python package for street view image perception analysis, providing tools for feature extraction and comfort prediction.

## Related Research

[Thermal Comfort in Sight: Thermal Affordance and Its Visual Assessment](https://github.com/Sijie-Yang/Thermal-Affordance)

## Features

### Street View Image (SVI) Analysis
- Semantic segmentation
- Object detection
- Color feature extraction
- Scene recognition
- Perception analysis (thermal_comfort, visual_comfort, safety, etc.)

## Examples

### 1. Street View Image Feature Extraction
`examples/test_svi_image_feature.ipynb`
- Demonstrates how to extract various features from street view images
- Includes semantic segmentation, object detection, color analysis, and scene recognition
- Shows how to process multiple images and save results

### 2. Street View Image Comfort Prediction
`examples/test_svi_comfort_prediction.ipynb`
- Shows how to predict comfort scores from street view images
- Demonstrates the use of the comfort function for both single images and folders
- Includes visualization of perception metrics
- Automatically normalizes perception scores to 0-5 range

## Installation

```bash
pip install urbancode
```

## Usage

### Feature Extraction
```python
import urbancode as uc
import pandas as pd

# Process a folder of images
df = uc.svi.filename("path/to/folder")
df = uc.svi.segmentation(df, folder_path="path/to/folder")
df = uc.svi.object_detection(df, folder_path="path/to/folder")
df = uc.svi.color(df, folder_path="path/to/folder")
df = uc.svi.scene_recognition(df, folder_path="path/to/folder")

# Save results
df.to_csv("svi_results.csv", index=False)
```

### Comfort Prediction
```python
import urbancode as uc

# Process a single image
df = uc.svi.comfort("path/to/image.jpg", mode='image')

# Process a folder of images
df = uc.svi.comfort("path/to/folder", mode='folder')

# Save results
df.to_csv("comfort_results.csv", index=False)
```

### Perception Metrics
The comfort function returns a DataFrame with the following perception metrics (normalized to 0-5 range):
- thermal_comfort
- visual_comfort
- temp_intensity
- sun_intensity
- humidity_inference
- wind_inference
- traffic_flow
- greenery_rate
- shading_area
- material_comfort
- imageability
- enclosure
- human_scale
- transparency
- complexity
- safe
- lively
- beautiful
- wealthy
- boring
- depressing
