Spaces:
Running
Running
Upload 2 files
Browse files- README.md +9 -103
- read_me.md +103 -0
README.md
CHANGED
@@ -1,103 +1,9 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
![demo](assets/demo/cases.png)
|
12 |
-
|
13 |
-
## Installation Guide
|
14 |
-
|
15 |
-
Nodejs, imagemagic, pdflatex are requried packages when render pdf files and convert them to images, here are installation guides.
|
16 |
-
|
17 |
-
### install nodejs
|
18 |
-
|
19 |
-
download the package from [offical website](https://registry.npmmirror.com/binary.html?path=node/latest-v16.x/), and then run these commands.
|
20 |
-
```
|
21 |
-
tar -xvf node-v16.13.1-linux-x64.tar.gz
|
22 |
-
|
23 |
-
mv node-v16.13.1-linux-x64/* /usr/local/nodejs/
|
24 |
-
|
25 |
-
ln -s /usr/local/nodejs/bin/node /usr/local/bin
|
26 |
-
|
27 |
-
ln -s /usr/local/nodejs/bin/npm /usr/local/bin
|
28 |
-
|
29 |
-
node -v
|
30 |
-
```
|
31 |
-
|
32 |
-
### install imagemagic
|
33 |
-
|
34 |
-
the version of imagemagic installed by `apt-gt` usually be 6.x, so we also install it from source code.
|
35 |
-
```
|
36 |
-
git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick-7.1.1
|
37 |
-
|
38 |
-
cd ImageMagick-7.1.1
|
39 |
-
|
40 |
-
./configure
|
41 |
-
|
42 |
-
make
|
43 |
-
|
44 |
-
sudo make install
|
45 |
-
|
46 |
-
sudo ldconfig /usr/local/lib
|
47 |
-
|
48 |
-
convert --version
|
49 |
-
```
|
50 |
-
|
51 |
-
### install latexpdf
|
52 |
-
|
53 |
-
```
|
54 |
-
apt-get update
|
55 |
-
|
56 |
-
sudo apt-get install texlive-full
|
57 |
-
```
|
58 |
-
|
59 |
-
### install python requriements
|
60 |
-
|
61 |
-
```
|
62 |
-
conda create -n CDM python=3.10 # optional
|
63 |
-
|
64 |
-
git clone xxx
|
65 |
-
|
66 |
-
cd xxx
|
67 |
-
|
68 |
-
pip install -r requirements.txt
|
69 |
-
```
|
70 |
-
|
71 |
-
|
72 |
-
## Usage
|
73 |
-
|
74 |
-
Should the installation go well, you may now enjoy the evaluation pipeline.
|
75 |
-
|
76 |
-
### 1. batch evaluation
|
77 |
-
|
78 |
-
```
|
79 |
-
python evaluation.py -i {path_to_your_input_json}
|
80 |
-
```
|
81 |
-
|
82 |
-
the format of input json like this:
|
83 |
-
```
|
84 |
-
[
|
85 |
-
{
|
86 |
-
"img_id": "case_1", # optional key
|
87 |
-
"gt": "y = 2z + 3x",
|
88 |
-
"pred": "y = 2x + 3z"
|
89 |
-
},
|
90 |
-
{
|
91 |
-
"img_id": "case_2",
|
92 |
-
"gt": "y = x^2 + 1",
|
93 |
-
"pred": "y = x^2 + 1"
|
94 |
-
},
|
95 |
-
...
|
96 |
-
]
|
97 |
-
```
|
98 |
-
|
99 |
-
### 2. run a gradio demo
|
100 |
-
|
101 |
-
```
|
102 |
-
python app.py
|
103 |
-
```
|
|
|
1 |
+
---
|
2 |
+
title: CDM
|
3 |
+
emoji: 📈
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
license: mit
|
9 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read_me.md
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Character Detection Matching (CDM)
|
2 |
+
|
3 |
+
## Demo
|
4 |
+
|
5 |
+
CDM: A Reliable Metric for Fair and Accurate Formula Recognition
|
6 |
+
|
7 |
+
![demo](assets/demo/demo.png)
|
8 |
+
|
9 |
+
Compair with BLEU and ExpRate:
|
10 |
+
|
11 |
+
![demo](assets/demo/cases.png)
|
12 |
+
|
13 |
+
## Installation Guide
|
14 |
+
|
15 |
+
Nodejs, imagemagic, pdflatex are requried packages when render pdf files and convert them to images, here are installation guides.
|
16 |
+
|
17 |
+
### install nodejs
|
18 |
+
|
19 |
+
download the package from [offical website](https://registry.npmmirror.com/binary.html?path=node/latest-v16.x/), and then run these commands.
|
20 |
+
```
|
21 |
+
tar -xvf node-v16.13.1-linux-x64.tar.gz
|
22 |
+
|
23 |
+
mv node-v16.13.1-linux-x64/* /usr/local/nodejs/
|
24 |
+
|
25 |
+
ln -s /usr/local/nodejs/bin/node /usr/local/bin
|
26 |
+
|
27 |
+
ln -s /usr/local/nodejs/bin/npm /usr/local/bin
|
28 |
+
|
29 |
+
node -v
|
30 |
+
```
|
31 |
+
|
32 |
+
### install imagemagic
|
33 |
+
|
34 |
+
the version of imagemagic installed by `apt-gt` usually be 6.x, so we also install it from source code.
|
35 |
+
```
|
36 |
+
git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick-7.1.1
|
37 |
+
|
38 |
+
cd ImageMagick-7.1.1
|
39 |
+
|
40 |
+
./configure
|
41 |
+
|
42 |
+
make
|
43 |
+
|
44 |
+
sudo make install
|
45 |
+
|
46 |
+
sudo ldconfig /usr/local/lib
|
47 |
+
|
48 |
+
convert --version
|
49 |
+
```
|
50 |
+
|
51 |
+
### install latexpdf
|
52 |
+
|
53 |
+
```
|
54 |
+
apt-get update
|
55 |
+
|
56 |
+
sudo apt-get install texlive-full
|
57 |
+
```
|
58 |
+
|
59 |
+
### install python requriements
|
60 |
+
|
61 |
+
```
|
62 |
+
conda create -n CDM python=3.10 # optional
|
63 |
+
|
64 |
+
git clone xxx
|
65 |
+
|
66 |
+
cd xxx
|
67 |
+
|
68 |
+
pip install -r requirements.txt
|
69 |
+
```
|
70 |
+
|
71 |
+
|
72 |
+
## Usage
|
73 |
+
|
74 |
+
Should the installation go well, you may now enjoy the evaluation pipeline.
|
75 |
+
|
76 |
+
### 1. batch evaluation
|
77 |
+
|
78 |
+
```
|
79 |
+
python evaluation.py -i {path_to_your_input_json}
|
80 |
+
```
|
81 |
+
|
82 |
+
the format of input json like this:
|
83 |
+
```
|
84 |
+
[
|
85 |
+
{
|
86 |
+
"img_id": "case_1", # optional key
|
87 |
+
"gt": "y = 2z + 3x",
|
88 |
+
"pred": "y = 2x + 3z"
|
89 |
+
},
|
90 |
+
{
|
91 |
+
"img_id": "case_2",
|
92 |
+
"gt": "y = x^2 + 1",
|
93 |
+
"pred": "y = x^2 + 1"
|
94 |
+
},
|
95 |
+
...
|
96 |
+
]
|
97 |
+
```
|
98 |
+
|
99 |
+
### 2. run a gradio demo
|
100 |
+
|
101 |
+
```
|
102 |
+
python app.py
|
103 |
+
```
|