学习笔记1
| 文件夹/文件 | 描述 |
|------------|------------------------------|
| junc | For training junction detector. |
| linepx | For training straight line pixel detector. |
| wireframe.py | Generate line segments/wireframe from predicted junctions and line pixels. |
| evaluation | Evaluation of junctions and wireframes. |
## 系统需求
- python3
- pytorch==0.3.1
- opencv==3.3.1
- scipy, numpy, progress, protobuf
- joblib (for parallel processing data.)
- tqdm
- [optional] dominate
The code is written and tested in `python3`, please install all requirements in python3.
## 数据准备
- 下载训练数据.
- Download imgs from [OneDrive](https://1drv.ms/u/s!AqQBtmo8Qg_9g37TnqyD9GD3UQwW), put it in __data/__, `unzip v1.1.zip`.
- Download annotation from [OneDrive](https://1drv.ms/u/s!AqQBtmo8Qg_9g3_etkaVndKnqTdm), put it in __data/__, `unzip pointlines.zip`.
- Download mat-files for wireframe evaluation from [OneDrive](https://1drv.ms/u/s!AqQBtmo8Qg_9txsENm9ibTKfxAlI), put it in __evaluation/wireframe/__, `unzip linemat.zip`.
- 数据结构
Each .pkl file contains the annotated wireframe of an image, and it consists of the following variables:
```shell
*.pkl
|-- imagename: the name of the image
|-- img: the image data
|-- points: the set of points in the wireframe, each point is represented by its (x,y)-coordinates in the image
|-- lines: the set of lines in the wireframe, each line is represented by the indices of its two end-points
|-- pointlines: the set of associated lines of each point
|-- pointlines_index: line indexes of lines in 'pointlines'
|-- junction: the junction locations, derived from the 'points' and 'lines'
|-- theta: the angle values of branches of each junction
```
- wireframe可视化
After loading the .pkl file, you can run something like the following in Python to visualize the wireframe:
```python
for idx, (i, j) in enumerate(lines, start=0):
x1, y1 = points[i]
x2, y2 = points[j]
cv2.line(im, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2, cv2.LINE_8)
```
- 数据预处理.
```
cd junc ##文件夹junc为连接点
python3 main.py --create_dataset --exp 1 --json
cd linepx ##文件夹linepx为线段
python3 main.py --genLine
```
Note: `--json` means you put the hype-parameters in __junc/hypes/1.json__.
## 训练集
- train junction detector 训练连接点检测器.
```
cd junc
python3 main.py --exp 1 --json --gpu 0 --balance
```
- train line pixel detecor 训练线段像素检测器.
```
cd linepx
python3 main.py --netType stackedHGB --GPUs 0 --LR 0.001 --batchSize 4
```
## 测试集
- Test junction detector.
```
cd junc
python3 main.py --exp 1 --json --test --checkepoch 16 --gpu 0 --balance
```
- Test line pixel detector.
```
cd linepx
python3 main.py --netType stackedHGB --GPUs 0 --LR 0.001 --testOnly t
```
- 联合连接点和线段像素Combine junction and line pixel prediction.
```
python wireframe.py
```
### 结果评价
The code for evaluation is put in [evaluation/junc](evaluation/junc) and [evaluation/wireframe](evaluation/wireframe).
Expected junction and wireframe precision/recall curve is like
<figure class="half">
<img src="evaluation/junc/junc_1_16.png", width=400/>
</figure>
<figure class="half">
<img src="evaluation/wireframe/1_0.5_0.5.png", width=400/>
</figure>
### 结果可视化
For visualizing the result, we recommend generating an html file using [dominate](https://github.com/Knio/dominate) to
visualize the result of different methods in columns.
## 文献引用
```
@InProceedings{wireframe_cvpr18,
author = {Kun Huang and Yifan Wang and Zihan Zhou and Tianjiao Ding and Shenghua Gao and Yi Ma},
title = {Learning to Parse Wireframes in Images of Man-Made Environments},
booktitle = {CVPR},
month = {June},
year = {2018}
}
```
## License
You can use this code for your research and other usages, following BSD 2-Clause license.
please credit our work when it helps you.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程
2013-09-12 [3D]第一人称相机类Camera
2013-09-12 复习数据库3
2013-09-12 复习数据库2
2013-09-12 复习数据库开发
2012-09-12 Skyline Globe——初识庐山真面目