fasdfsa commited on
Commit
c341dbc
·
1 Parent(s): e2eaf63

modify readme.txt

Browse files
Files changed (1) hide show
  1. readme.txt +68 -33
readme.txt CHANGED
@@ -1,24 +1,38 @@
1
- see doc\lang\programming\pytorch\文本检测\DBNET 论文代码都有
2
 
3
  see 深入理解神经网络:从逻辑回归到CNN.md -> autodl
4
 
5
 
6
- vi DB/training/learning_rate.py
7
-
8
- lr = State(default=0.007)
9
-
10
- in the yaml file
11
- learning_rate:
12
- class: DecayLearningRate
13
- lr: 0.001
14
- epochs: 1200
15
- # 学习率要这两个地方一起来成一至后,logs 显示才正常
16
-
17
 
18
  pip install torch==2.0.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html
19
  # apt install -y libsm6 libxrender1 libxext6 libgl1-mesa-glx
20
  # 实测 vgpu-32G 要装这个
21
  # 能正常训练
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  update-alternatives --remove cuda /usr/local/cuda-11.6
24
  update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.8 118 &&
@@ -72,18 +86,40 @@ sed -i 's/epochs\:\ 1200/epochs\:\ 30/1' ~/DB/experiments/seg_detector/td500_res
72
  torch.backends.cudnn.enabled = False
73
 
74
 
75
- vi experiments\seg_detector\ic15_resnet18_deform_thre.yaml
76
- learning_rate:
77
- class: DecayLearningRate
78
- epochs: 1200
79
- epochs: 1200
80
- # 实测这里的 epochs 要和 train 中的 epochs 一致,否则学习率要减到 0
81
-
82
 
83
  # vscode 打开远程文件夹 DB, ctrl + x 安装 python 扩展, ctrl+shift+p 输入 Python,选择选conda的python ,vscode 中修改train.py 在main 函数下加入命令行参数:
84
 
85
- def main():
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  import sys
88
  sys.argv.append( 'experiments/seg_detector/ic15_resnet18_deform_thre.yaml' )
89
  sys.argv.append( '--num_gpus' )
@@ -92,29 +128,28 @@ def main():
92
  sys.argv.append( '16' )
93
  sys.argv.append( '--epochs' )
94
  sys.argv.append( '1200' )
95
- #sys.argv.append( '--resume' ) # 继续上一次训练
96
- #sys.argv.append( '/root/model_epoch_120_minibatch_12000' )
 
 
97
  #sys.argv.append( '--start_iter' )
98
  #sys.argv.append( '18000' )
99
  #sys.argv.append( '--start_epoch' )
100
  #sys.argv.append( '107' )
101
-
102
  torch.backends.cudnn.enabled = False
103
 
104
-
105
  vscode 中然后F5 调试运行train.py
106
 
 
107
 
108
- # CUDA_VISIBLE_DEVICES=0 python train.py experiments/seg_detector/td500_resnet18_deform_thre.yaml --num_gpus 1
109
-
110
- 权重转换:
111
- Usage: python convert_to_onnx.py /path/to/exp/yaml /path/to/pretrained/weight /path/to/save/onnx.
112
-
113
- // 验证
114
- CUDA_VISIBLE_DEVICES=0 python demo.py experiments/seg_detector/td500_resnet18_deform_thre.yaml --image_path datasets/GD500/test_images/IMG_0000.JPG --resume /root/final --polygon --box_thresh 0.7 --visualize
115
-
116
-
117
 
 
 
 
 
 
118
 
119
 
120
 
 
 
1
 
2
  see 深入理解神经网络:从逻辑回归到CNN.md -> autodl
3
 
4
 
5
+ see doc\lang\programming\pytorch\文本检测\DBNET 论文代码都有
 
 
 
 
 
 
 
 
 
 
6
 
7
  pip install torch==2.0.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html
8
  # apt install -y libsm6 libxrender1 libxext6 libgl1-mesa-glx
9
  # 实测 vgpu-32G 要装这个
10
  # 能正常训练
11
+ # 这套用官方训练好的权重 eval 比论文的精度低了很多,但确实框出来了
12
+ # 试试用它再继续微调会不会好点
13
+
14
+
15
+ conda create --name DB python==3.7 ipython pip -y \
16
+ && conda activate DB \
17
+ && pip install https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-manylinux1_x86_64.whl \
18
+
19
+
20
+
21
+ https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
22
+ # 最接近 cu10.1 + torch 1.2.0 的是这个
23
+ # numpy-1.21.6
24
+ # 这套用官方训练好的权重 eval 能达到论文的精度
25
+ https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux
26
+ # cuda10.0 for ubuntu 18.04
27
+
28
+
29
+ # python dependencies
30
+ pip install -r requirement.txt
31
+
32
+ # install PyTorch with cuda-10.1
33
+ conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
34
+
35
+
36
 
37
  update-alternatives --remove cuda /usr/local/cuda-11.6
38
  update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.8 118 &&
 
86
  torch.backends.cudnn.enabled = False
87
 
88
 
89
+ https://matpool.com/supports/doc-vscode-connect-matpool/
90
+ Remote Development 安装插件
91
+ VS Code 远程连接矩池云机器教程
 
 
 
 
92
 
93
  # vscode 打开远程文件夹 DB, ctrl + x 安装 python 扩展, ctrl+shift+p 输入 Python,选择选conda的python ,vscode 中修改train.py 在main 函数下加入命令行参数:
94
 
 
95
 
96
+ vi DB/training/learning_rate.py
97
+
98
+ lr = State(default=0.007)
99
+
100
+ vi experiments/seg_detector/ic15_resnet18_deform_thre.yaml
101
+ learning_rate:
102
+ class: DecayLearningRate
103
+ lr: 0.001
104
+ epochs: 1200
105
+ # 学习率要这两个地方一起改成一至后,logs 显示才正常
106
+
107
+
108
+ vi data/image_dataset.py
109
+ if 'TD' in self.data_dir[0] and label == '1':
110
+ label = '###'
111
+ # 注释掉这两行
112
+ # https://github.com/MhLiao/DB/issues/186
113
+
114
+ File "/root/miniforge3/envs/DB/lib/python3.7/site-packages/anyconfig/processors/utils.py", line 14, in <module>
115
+ import importlib.metadata
116
+ ModuleNotFoundError: No module named 'importlib.metadata'
117
+ # 只有 py3.7 会错
118
+ # pip install importlib-metadata
119
+ # import importlib_metadata as metadata # 改成这样
120
+
121
+
122
+ def main():
123
  import sys
124
  sys.argv.append( 'experiments/seg_detector/ic15_resnet18_deform_thre.yaml' )
125
  sys.argv.append( '--num_gpus' )
 
128
  sys.argv.append( '16' )
129
  sys.argv.append( '--epochs' )
130
  sys.argv.append( '1200' )
131
+ sys.argv.append( '--lr' )
132
+ sys.argv.append( '0.0001' )
133
+ sys.argv.append( '--resume' ) # 继续上一次训练
134
+ sys.argv.append( '/root/final7' )
135
  #sys.argv.append( '--start_iter' )
136
  #sys.argv.append( '18000' )
137
  #sys.argv.append( '--start_epoch' )
138
  #sys.argv.append( '107' )
 
139
  torch.backends.cudnn.enabled = False
140
 
 
141
  vscode 中然后F5 调试运行train.py
142
 
143
+ CUDA_VISIBLE_DEVICES=0 python eval.py experiments/seg_detector/ic15_resnet18_deform_thre.yaml --resume /root/final8 --box_thresh 0.55
144
 
145
+ CUDA_VISIBLE_DEVICES=0 python demo.py experiments/seg_detector/ic15_resnet18_deform_thre.yaml --image_path datasets/icdar2015/test_images/img_2.jpg --resume /root/final8 --polygon --box_thresh 0.55 --visualize
146
+ # img_1 用官方训练好的模型也是框不出的!!!
 
 
 
 
 
 
 
147
 
148
+ CUDA_VISIBLE_DEVICES=0 python eval.py experiments/seg_detector/ic15_resnet18_deform_thre.yaml --resume /root/ic15_resnet18 --box_thresh 0.55
149
+ # 官方
150
+
151
+ CUDA_VISIBLE_DEVICES=0 python demo.py experiments/seg_detector/ic15_resnet18_deform_thre.yaml --image_path datasets/icdar2015/test_images/img_2.jpg --resume /root/ic15_resnet18 --polygon --box_thresh 0.55 --visualize
152
+ # 官方
153
 
154
 
155