Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
test_on_pytorch
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9a4eb652
authored
2022-12-12 15:46:24 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add shell
1 parent
3310e154
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
15 deletions
data/create_dataset.py
train.sh
data/create_dataset.py
View file @
9a4eb65
...
...
@@ -60,8 +60,6 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save
# else:
# os.makedirs(save_dir, exist_ok=True)
count
=
0
un_count
=
0
top_text_count
=
len
(
top_text_list
)
for
img_name
in
sorted
(
os
.
listdir
(
img_dir
)):
if
img_name
in
skip_list
:
...
...
@@ -153,22 +151,18 @@ def build_dataset(img_dir, go_res_dir, label_dir, top_text_list, skip_list, save
input_label
=
copy
.
deepcopy
(
src_label_list
)
input_label
[
idx
]
=
1
# with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, find_go_key)))), 'w') as fp:
# json.dump([input_list, input_label], fp)
count
+=
1
for
go_key
,
((
x0
,
y0
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
),
_
)
in
go_res
.
items
():
if
go_key
in
go_key_set
:
continue
input_list
=
copy
.
deepcopy
(
input_key_list
)
input_list
.
append
([
x0
/
w
,
y0
/
h
,
x1
/
w
,
y1
/
h
,
x2
/
w
,
y2
/
h
,
x3
/
w
,
y3
/
h
])
with
open
(
os
.
path
.
join
(
save_dir
,
'{0}.json'
.
format
(
uuid
.
uuid3
(
uuid
.
NAMESPACE_DNS
,
'{0}-{1}'
.
format
(
img_name
,
find_go_key
)))),
'w'
)
as
fp
:
json
.
dump
([
input_list
,
input_label
],
fp
)
# for go_key, ((x0, y0, x1, y1, x2, y2, x3, y3), _) in go_res.items():
# if go_key in go_key_set:
# continue
# input_list = copy.deepcopy(input_key_list)
# input_list.append([x0/w, y0/h, x1/w, y1/h, x2/w, y2/h, x3/w, y3/h])
# with open(os.path.join(save_dir, '{0}.json'.format(uuid.uuid3(uuid.NAMESPACE_DNS, '{0}-{1}'.format(img_name, go_key)))), 'w') as fp:
# json.dump([input_list, src_label_list], fp)
un_count
+=
1
# break
print
(
count
)
print
(
un_count
)
if
__name__
==
'__main__'
:
...
...
@@ -246,7 +240,7 @@ if __name__ == '__main__':
# build_dataset(train_image_path, train_go_path, train_label_path, filter_from_top_text_list, skip_list_train, train_dataset_dir)
build_dataset
(
valid_image_path
,
valid_go_path
,
valid_label_path
,
filter_from_top_text_list
,
skip_list_valid
,
valid_dataset_dir
)
#
build_dataset(valid_image_path, valid_go_path, valid_label_path, filter_from_top_text_list, skip_list_valid, valid_dataset_dir)
# build_anno_file(train_dataset_dir, train_anno_file_path)
# build_anno_file(valid_dataset_dir, valid_anno_file_path)
...
...
train.sh
0 → 100644
View file @
9a4eb65
CUDA_VISIBLE_DEVICES
=
0 nohup python main.py > train.log 2>&1 &
\ No newline at end of file
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment