duan8/DBNet/README.md
2020-11-06 22:22:23 +08:00

50 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DBNet
The Pytorch implementation is [DBNet](https://github.com/BaofengZan/DBNet.pytorch).
<p align="center">
<img src="https://user-images.githubusercontent.com/20653176/89722330-00c36900-da1b-11ea-97f4-c61f9cd196fa.png">
</p>
## How to Run
win版本请看最后的链接。
* 1 生成wts
从pytoch仓库下载到代码和模型。配置好环境后
在tools/predict.py中将save_wts属性置为True运行后就在在tools文件夹下生成wts文件。
同时也可以导出onnx。将onnx属性设置为True即可。
* 2 cmake 生成工程
```
mkdir build
cd build
cmake ..
make
sudo ./dbnet -s // serialize model to plan file i.e. 'DBNet.engine'
sudo ./dbnet -d ../samples // deserialize plan file and run inference, the images in samples will be processed.
```
## windows版本
https://github.com/BaofengZan/DBNet-TensorRT
## 不足之处
* 1 common文件中下面两个函数可以合并自己偷了个懒。
```c++
ILayer* convBnLeaky(INetworkDefinition *network, std::map<std::string, Weights>& weightMap, ITensor& input, int outch, int ksize, int s, int g, std::string lname, bool bias = true)
```
```c++
ILayer* convBnLeaky2(INetworkDefinition *network, std::map<std::string, Weights>& weightMap, ITensor& input, int outch, int ksize, int s, int g, std::string lname, bool bias = true)
```
* 2 后处理中与pytorch版本也有好多不同之处这都是可以改进提升的。
* 3 在pyorch中数据预处理是将图像短边resize到1024长边按比例缩放最后将新的宽高截到32的倍数。而在自己的repo中直接将图像resize到640*640较为粗暴。