File size: 7,603 Bytes
173dcbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | ---
title: "Development"
description: "Development setup, testing, and contributing to Image Matching WebUI"
---
# Development
This section covers development setup, testing, and contributing to Image Matching WebUI.
## Development Installation
First, clone the repository and install in development mode:
```bash
git clone https://github.com/Vincentqyw/image-matching-webui.git
cd image-matching-webui
pip install -e .
```
For development with testing dependencies:
```bash
pip install -e .[dev]
```
## Running Tests
### Test Structure
The project uses pytest for testing. Tests are organized in the `tests/` directory.
### Running All Tests
```bash
pytest tests/ -v
```
### Running Specific Tests
```bash
# Run a single test
pytest tests/test_image_matching.py::test_one -v
# Run all tests in a file
pytest tests/test_api.py -v
```
### Test Coverage
```bash
pytest --cov=imcui tests/ --cov-report=html
```
## Pre-commit Hooks
The project includes pre-commit hooks for code quality checks:
```bash
# Install pre-commit hooks
pre-commit install
# Run hooks manually
pre-commit run -a
```
The hooks check for:
- Code formatting (ruff-format)
- Linting (ruff)
- Type checking (mypy)
- C++ formatting (clang-format)
## Code Quality Standards
### Python Code
- **Formatting**: Uses `ruff-format`
- **Linting**: Uses `ruff`
- **Type Checking**: Uses `mypy`
### C++ Code
- **Formatting**: Uses `clang-format`
## Adding New Features
### Steps for Adding Features
1. Create a feature branch
2. Implement your changes
3. Write tests for new functionality
4. Update documentation
5. Run all tests and pre-commit checks
6. Submit a pull request
### Branch Naming
Use descriptive branch names:
```bash
# Good
git checkout -b feat/add-ransac-optimization
git checkout -b fix/geometry-calculation-error
git checkout -b docs/update-installation-guide
# Avoid
git checkout -b feature-branch
git checkout -b my-branch
```
## Debugging
### Verbose Mode
Enable verbose output for debugging:
```bash
imcui --verbose
```
### Debug Logs
Logs are written to `log.txt` by default. Check this file for detailed error messages.
### Common Debugging Steps
1. Enable verbose mode
2. Check log outputs
3. Verify configuration files
4. Test with simple examples
5. Check GPU availability if using CUDA
## Contributing
### Contribution Guidelines
1. Follow the existing code style
2. Write tests for new functionality
3. Update relevant documentation
4. Ensure all tests pass
5. Get code review before merging
### Issue Reporting
When reporting issues, include:
- Operating system and version
- Python version
- Installed package versions
- Error messages and logs
- Steps to reproduce
- Expected vs actual behavior
### Pull Request Process
1. Fork the repository
2. Create a feature branch
3. Implement changes
4. Add tests and documentation
5. Run pre-commit checks
6. Submit pull request with clear description
## Architecture
### System Overview
```mermaid
graph TD
User[User] --> CLI[CLI Interface]
User --> WebUI[Web Interface]
CLI --> API[ImageMatchingAPI]
WebUI --> API
API --> MatcherZoo[Matcher Zoo]
API --> Matching[Matching Engine]
API --> Geometry[Geometry Computation]
API --> Visualization[Visualization]
MatcherZoo --> VismatchExternal[vismatch library]
Matching --> ModelCache[Model Cache]
Geometry --> RANSAC[RANSAC Filtering]
Visualization --> ImageUtils[Image Utilities]
subgraph DataLayer[Data Layer]
ModelCache
ConfigFiles[Config Files]
ExampleData[Example Data]
end
API --> ConfigFiles
API --> ExampleData
style User fill:#4F46E5,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style CLI fill:#8B5CF6,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style WebUI fill:#8B5CF6,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style API fill:#6366F1,stroke:#ffffff,stroke-width:3px,color:#ffffff,font-size:11px
style MatcherZoo fill:#10B981,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style Matching fill:#F59E0B,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style Geometry fill:#F59E0B,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style Visualization fill:#EC4899,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style VismatchExternal fill:#059669,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style ModelCache fill:#D97706,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style RANSAC fill:#D97706,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style ImageUtils fill:#DB2777,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:11px
style DataLayer fill:#374151,stroke:#6366F1,stroke-width:2px,color:#ffffff,stroke-dasharray: 5 5
```
### Project Structure
```mermaid
graph TD
root[image-matching-webui] --> imcui[imcui/ - Python Package]
root --> tests[tests/ - Test Suite]
root --> cpp[cpp/ - C++ Implementation]
root --> docs[docs/ - Documentation]
root --> docker[docker/ - Deployment Config]
imcui --> cli[cli/ - CLI Entry Point]
imcui --> ui[ui/ - Web Interface]
imcui --> api[api/ - Core API]
imcui --> configFiles[config/ - Config Files]
ui --> app[image_matching_app.py]
ui --> config[config.py]
ui --> configUtils[config_utils.py]
ui --> matching[matching.py]
ui --> geometry[geometry.py]
ui --> imageUtils[image_utils.py]
ui --> visualization[visualization.py]
ui --> examples[examples.py]
ui --> modelCache[model_cache.py]
cli --> main[main.py]
api --> server[server.py]
api --> client[client.py]
style root fill:#1F2937,stroke:#6366F1,stroke-width:3px,color:#ffffff,font-size:14px
style imcui fill:#4F46E5,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style ui fill:#6366F1,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style api fill:#818CF8,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style cli fill:#8B5CF6,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style tests fill:#10B981,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style cpp fill:#F59E0B,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
style docs fill:#EC4899,stroke:#ffffff,stroke-width:2px,color:#ffffff,font-size:12px
```
### Component Details
- `imcui/` - Main package
- `cli/` - Command-line interface
- `ui/` - User interface components
- `api/` - Core API implementation
- `config/` - Configuration files
- `tests/` - Test suite
- `cpp/` - C++ API implementation
### Key Components
- **ImageMatchingAPI**: Core matching API
- **ImageMatchingApp**: Gradio web interface
- **MatcherZoo**: Dynamic matcher loading
- **Visualization**: Result visualization utilities
## Release Process
### Version Management
Version is managed in `pyproject.toml`. Update the version number when preparing a release.
### Creating a Release
1. Update version in `pyproject.toml`
2. Ensure all tests pass
3. Update CHANGELOG.md
4. Create git tag: `git tag v1.0.0`
5. Push tag: `git push origin v1.0.0`
6. Build and publish to PyPI
## Resources
- **Project Repository**: https://github.com/Vincentqyw/image-matching-webui
- **Issues**: https://github.com/Vincentqyw/image-matching-webui/issues
- **Discussions**: https://github.com/Vincentqyw/image-matching-webui/discussions
- **Related Projects**:
- [Vismatch](https://github.com/gmberton/vismatch) - Matcher collection library
|