Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
XrayGLM_pytorch
Commits
93994f98
Unverified
Commit
93994f98
authored
May 28, 2023
by
MPU王荣胜
Committed by
GitHub
May 28, 2023
Browse files
add random prompt
parent
0f642342
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32146 additions
and
0 deletions
+32146
-0
data/build_ch_prompt-random.py
data/build_ch_prompt-random.py
+29
-0
data/openi-ch-random.json
data/openi-ch-random.json
+32117
-0
No files found.
data/build_ch_prompt-random.py
0 → 100644
View file @
93994f98
import
json
from
tqdm
import
tqdm
import
random
with
open
(
'openi-zh.json'
)
as
f
:
data
=
json
.
load
(
f
)
data_info
=
[]
for
i
in
tqdm
(
range
(
len
(
data
[
'annotations'
]))):
prompt_temp
=
[
'通过这张胸部X光影像可以诊断出什么?'
,
'这张图片的背景里有什么内容?'
,
'详细描述一下这张图片'
,
'看看这张图片并描述你注意到的内容'
,
'请提供图片的详细描述'
,
'你能为我描述一下这张图片的内容吗?'
]
img
=
data
[
'annotations'
][
i
][
'image_id'
]
prompt
=
random
.
choice
(
prompt_temp
)
label
=
data
[
'annotations'
][
i
][
'caption'
]
json_data
=
{
'img'
:
'./data/Xray/'
+
str
(
img
)
+
'.png'
,
'prompt'
:
prompt
,
'label'
:
str
(
label
)
}
data_info
.
append
(
json_data
)
with
open
(
'openi-ch-prompt.json'
,
'w+'
)
as
f1
:
json
.
dump
(
data_info
,
f1
)
\ No newline at end of file
data/openi-ch-random.json
0 → 100644
View file @
93994f98
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment