File size: 1,462 Bytes
0b4516f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python
import os.path as osp
import re

# This script reads /projects/selected.txt and generate projectzoo.md

files = []

project_zoo = """
# 前沿模型

这里是一些已经复现,但是尚未包含在 MMOCR 包中的前沿模型。

"""

files = open('../../projects/selected.txt').readlines()

for file in files:
    file = file.strip()
    with open(osp.join('../../', file)) as f:
        content = f.read()

    # Extract title
    expr = '# (.*?)\n'
    title = re.search(expr, content).group(1)
    project_zoo += f'## {title}\n\n'

    # Locate the description
    expr = '## Description\n(.*?)##'
    description = re.search(expr, content, re.DOTALL).group(1)
    project_zoo += f'{description}\n'

    # check milestone 1
    expr = r'- \[(.?)\] Milestone 1'
    state = re.search(expr, content, re.DOTALL).group(1)
    infer_state = '✔' if state == 'x' else '❌'

    # check milestone 2
    expr = r'- \[(.?)\] Milestone 2'
    state = re.search(expr, content, re.DOTALL).group(1)
    training_state = '✔' if state == 'x' else '❌'

    # add table
    readme_link = f'https://github.com/open-mmlab/mmocr/blob/dev-1.x/{file}'
    project_zoo += '### 模型状态 \n'
    project_zoo += '| 推理 | 训练 | README |\n'
    project_zoo += '| --------- | -------- | ------ |\n'
    project_zoo += f'|️{infer_state}|{training_state}|[link]({readme_link})|\n'

with open('projectzoo.md', 'w') as f:
    f.write(project_zoo)