zezeze97 commited on
Commit
167441a
·
1 Parent(s): d6a8642
Files changed (2) hide show
  1. README.md +23 -26
  2. sample/diagram_formalizer.png +0 -0
README.md CHANGED
@@ -1,14 +1,24 @@
1
  ---
2
  license: apache-2.0
3
  ---
4
- # 基于FormalGeo7K的结构识别模型
 
5
 
6
- ## 快速开始
7
- 在运行脚本之前,首先安装如下必要的依赖。
 
 
 
 
 
 
 
 
8
 
9
  ```shell
10
  pip install torch transformers==4.40.0 accelerate pillow sentencepiece
11
  ```
 
12
 
13
  ```python
14
  import torch
@@ -24,12 +34,12 @@ torch.set_default_device(device)
24
 
25
  # create model
26
  model = AutoModelForCausalLM.from_pretrained(
27
- 'NaughtyDog97/GeoFormalizer',
28
  torch_dtype=torch.float16, # float32 for cpu
29
  device_map='auto',
30
  trust_remote_code=True)
31
  tokenizer = AutoTokenizer.from_pretrained(
32
- 'NaughtyDog97/GeoFormalizer',
33
  use_fast=True,
34
  padding_side="right",
35
  trust_remote_code=True)
@@ -89,41 +99,28 @@ print(respones)
89
 
90
  ```
91
 
92
- 我们的模型支持的识别方式有如下几种:
93
- - 自然语言描述:
94
  - Describe what you see in the figure.
95
  - Tell me what you observe in the image.
96
- - 使用自然语言描述这幅图像。
97
- - 只预测construction_cdl
98
  - Based on the image, predict the construction_cdl.
99
- - 根据图像识别出construction_cdl。
100
  - Based on the image, predict the construction_cdl and calibrate it.
101
- - 根据图像识别出construction_cdl并进行矫正。
102
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl.
103
- - 根据图像,首先描述图像,之后识别出construction_cdl。
104
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and calibrate it.
105
- - 根据图像,首先描述图像,之后识别出construction_cdl并进行矫正。
106
- - 只预测image_cdl
107
  - Based on the image, predict the image_cdl.
108
- - 根据图像识别出image_cdl。
109
  - Based on the image, predict the image_cdl and calibrate it.
110
- - 根据图像识别出image_cdl并进行矫正。
111
  - Based on the image, first describe what you see in the figure, then predict the image_cdl.
112
- - 根据图像,首先描述图像,之后识别出image_cdl。
113
  - Based on the image, first describe what you see in the figure, then predict the image_cdl and calibrate it.
114
- - 根据图像,首先描述图像,之后识别出image_cdl并进行矫正。
115
- - 同时预测construction_cdl和image_cdl
116
  - Based on the image, predict the construction_cdl and image_cdl.
117
- - 根据图像识别出construction_cdl和image_cdl。
118
  - Based on the image, first predict the construction_cdl and image_cdl and calibrate it.
119
- - 根据图像识别出construction_cdl和image_cdl并进行矫正。
120
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl.
121
- - 根据图像,首先描述图像,之后识别出construction_cdl和image_cdl。
122
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl and calibrate it.
123
- - 根据图像,首先描述图像,之后识别出construction_cdl和image_cdl并矫正。
124
 
125
 
126
- ## Performance
127
- | | ConsCdlAcc | ConsCdlPerfect | ImgCdlAcc | ImgCdlPerfect | BothPerfect |
128
  |-----|----------------|---------------------|---------------|-------------------|------------------|
129
- | siglip-0.4B-qwen2-0.5B | 90.25 | 72.29 | 92.88 | 84.38 | 65.05 |
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ # Diagram Formalizer
5
+ Model Structure:
6
 
7
+ <img src="sample/diagram_formalizer.png" alt="Alt text" width="20%" height="auto">
8
+
9
+ Diagram Encoder: [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384)
10
+
11
+ Lightweight LLM: [Qwen2-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct)
12
+
13
+
14
+
15
+ ## Quick Start
16
+ Before running the script, install the following necessary dependencies.
17
 
18
  ```shell
19
  pip install torch transformers==4.40.0 accelerate pillow sentencepiece
20
  ```
21
+ You can use the following script to predict the ConsCDL and ImgCDL for geometric diagram.
22
 
23
  ```python
24
  import torch
 
34
 
35
  # create model
36
  model = AutoModelForCausalLM.from_pretrained(
37
+ 'NaughtyDog97/DiagramFormalizer',
38
  torch_dtype=torch.float16, # float32 for cpu
39
  device_map='auto',
40
  trust_remote_code=True)
41
  tokenizer = AutoTokenizer.from_pretrained(
42
+ 'NaughtyDog97/DiagramFormalizer',
43
  use_fast=True,
44
  padding_side="right",
45
  trust_remote_code=True)
 
99
 
100
  ```
101
 
102
+ Our model supports the following recognition instrutions:
103
+ - Natural Language Description:
104
  - Describe what you see in the figure.
105
  - Tell me what you observe in the image.
106
+ - Predicting ConsCDL only
 
107
  - Based on the image, predict the construction_cdl.
 
108
  - Based on the image, predict the construction_cdl and calibrate it.
 
109
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl.
 
110
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and calibrate it.
111
+ - Predicting ImgCDL only:
 
112
  - Based on the image, predict the image_cdl.
 
113
  - Based on the image, predict the image_cdl and calibrate it.
 
114
  - Based on the image, first describe what you see in the figure, then predict the image_cdl.
 
115
  - Based on the image, first describe what you see in the figure, then predict the image_cdl and calibrate it.
116
+ - Predicting construction_cdl and image_cdl simultaneously:
 
117
  - Based on the image, predict the construction_cdl and image_cdl.
 
118
  - Based on the image, first predict the construction_cdl and image_cdl and calibrate it.
 
119
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl.
 
120
  - Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl and calibrate it.
 
121
 
122
 
123
+ ## Performance of Diagram Formalizer on formalgeo7k test set
124
+ | Model | ConsCdlAcc | ConsCdlPerfect | ImgCdlAcc | ImgCdlPerfect | BothPerfect |
125
  |-----|----------------|---------------------|---------------|-------------------|------------------|
126
+ | Diagram Formalizer | 90.25 | 72.29 | 92.88 | 84.38 | 65.05 |
sample/diagram_formalizer.png ADDED