Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfxmap_python
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
jfxmap_python
Commits
2b8e05d9
Commit
2b8e05d9
authored
Jan 28, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交统计逻辑
parent
8ae15a70
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
trans_and_export_data_multi.py
script/trans_and_export_data_multi.py
+23
-8
No files found.
script/trans_and_export_data_multi.py
View file @
2b8e05d9
...
...
@@ -550,7 +550,7 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
#查找可以添加的点云
interactive
=
0
for
box
in
cloud
[
"boxes"
]:
if
abs
(
bbox
[
4
][
0
]
-
box
[
4
][
0
])
<
(
bbox
[
6
][
0
]
+
box
[
6
][
0
])
*
2
/
3
and
abs
(
bbox
[
4
][
1
]
-
box
[
4
][
1
])
<
(
bbox
[
6
][
0
]
+
box
[
6
][
0
])
*
2
/
3
:
if
abs
(
bbox
[
4
][
0
]
-
box
[
4
][
0
])
<
(
bbox
[
6
][
0
]
+
box
[
6
][
0
])
and
abs
(
bbox
[
4
][
1
]
-
box
[
4
][
1
])
<
(
bbox
[
6
][
0
]
+
box
[
6
][
0
])
:
interactive
=
1
if
interactive
==
1
:
continue
...
...
@@ -559,11 +559,11 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
break
;
if
add_idx
==
-
1
:
#需要保存数据了
if
index
==
1
and
len
(
save_cloud
)
>=
50
and
len
(
save_cloud
[
0
][
"boxes"
])
>=
10
:
if
index
==
1
and
len
(
save_cloud
)
>=
100
and
len
(
save_cloud
[
0
][
"boxes"
])
>=
5
:
save_cloud
[
0
][
"isSave"
]
=
1
elif
index
==
1
and
len
(
save_cloud
)
>
0
and
len
(
save_cloud
[
0
][
"boxes"
])
>
2
0
:
elif
index
==
1
and
len
(
save_cloud
)
>
0
and
len
(
save_cloud
[
0
][
"boxes"
])
>
3
0
:
save_cloud
[
0
][
"isSave"
]
=
1
elif
index
==
1
and
len
(
save_cloud
)
>=
1
00
:
elif
index
==
1
and
len
(
save_cloud
)
>=
2
00
:
save_cloud
[
0
][
"isSave"
]
=
1
max_cloud_list_num
=
200
if
add_idx
==
-
1
:
...
...
@@ -580,12 +580,12 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
print
(
" save_cloud is too big > "
,
max_cloud_list_num
)
return
add_idx
Thread_NUM
=
5
Thread_NUM
=
10
threads
=
[]
threadID
=
1
class
pcdThread
(
threading
.
Thread
):
def
__init__
(
self
,
threadID
,
name
,
start
,
idx
,
_dirs
,
_dir_pcd_list
,
save_list
,
jsn_list
,
trans
,
kit2o
):
def
__init__
(
self
,
threadID
,
name
,
start
,
idx
,
_dirs
,
_dir_pcd_list
,
save_list
,
jsn_list
,
trans
,
kit2o
,
box_info_count
):
threading
.
Thread
.
__init__
(
self
)
self
.
threadID
=
threadID
self
.
name
=
name
...
...
@@ -597,6 +597,7 @@ class pcdThread (threading.Thread):
self
.
jsn_list
=
jsn_list
self
.
trans
=
trans
self
.
kit2ori
=
kit2o
self
.
box_info_count
=
box_info_count
def
run
(
self
):
global
g_save_count
global
MAX_SAVE_FILE_NUM
...
...
@@ -661,6 +662,7 @@ class pcdThread (threading.Thread):
print
(
"pedestrian in cross, pos = ["
,
exportCenterBL
[
0
],
","
,
exportCenterBL
[
1
],
"]"
)
#获取到汽车点云符合条件,可以添加到新点云里
# f1.write('%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n'%(exportCenterBL[0],exportCenterBL[1],bbox[4][0], bbox[4][1], bbox[4][2],bbox[6][0], bbox[6][1], bbox[6][2],angle2,laneAngle))
self
.
box_info_count
[
bbox
[
0
]]
+=
1
name
=
pcd_file
.
split
(
"/"
)[
-
1
]
if
g_saveFileType
==
1
:
name
=
name
[
0
:
-
3
]
+
"bin"
...
...
@@ -742,6 +744,7 @@ if __name__ == '__main__':
save_json
=
{}
save_json
[
"annotations"
]
=
[]
save_json_list
=
[]
cloud_box_count
=
[]
#统计box的数据
dir_pcd_list
=
{}
dirsAll
=
os
.
listdir
(
origin_root_path
)
...
...
@@ -770,7 +773,9 @@ if __name__ == '__main__':
save_cloud_list
.
append
(
list
)
jsn_list
=
[]
save_json_list
.
append
(
jsn_list
)
thread
=
pcdThread
(
i
,
"Thread"
+
str
(
i
)
,
i
,
Thread_NUM
,
dirs
,
dir_pcd_list
,
save_cloud_list
[
i
],
save_json_list
[
i
],
generate_Trans
,
generate_kitti2origin
)
box_info_cout
=
{
'big'
:
0
,
'little'
:
0
,
'pedestrian'
:
0
,
'mid'
:
0
,
'cyclist'
:
0
}
cloud_box_count
.
append
(
box_info_cout
)
thread
=
pcdThread
(
i
,
"Thread"
+
str
(
i
)
,
i
,
Thread_NUM
,
dirs
,
dir_pcd_list
,
save_cloud_list
[
i
],
save_json_list
[
i
],
generate_Trans
,
generate_kitti2origin
,
cloud_box_count
[
i
])
thread
.
start
()
threads
.
append
(
thread
)
for
t
in
threads
:
...
...
@@ -786,7 +791,17 @@ if __name__ == '__main__':
jsn_path
=
os
.
path
.
join
(
generate_root_path
,
generate_child_dir
+
".json"
)
with
open
(
jsn_path
,
'w'
)
as
file_obj
:
json
.
dump
(
save_json
,
file_obj
,
cls
=
NumpyEncoder
,
indent
=
4
)
totel_count
=
{
'big'
:
0
,
'little'
:
0
,
'pedestrian'
:
0
,
'mid'
:
0
,
'cyclist'
:
0
}
for
count
in
cloud_box_count
:
totel_count
[
'big'
]
+=
count
[
'big'
]
totel_count
[
'little'
]
+=
count
[
'little'
]
totel_count
[
'pedestrian'
]
+=
count
[
'pedestrian'
]
totel_count
[
'mid'
]
+=
count
[
'mid'
]
totel_count
[
'cyclist'
]
+=
count
[
'cyclist'
]
cloud_box_count
.
append
(
totel_count
)
count_jsn_path
=
os
.
path
.
join
(
generate_root_path
,
"count.json"
)
with
open
(
count_jsn_path
,
'w'
)
as
file_o
:
json
.
dump
(
cloud_box_count
,
file_o
,
cls
=
NumpyEncoder
,
indent
=
4
)
# isStop = 0
# index = 0
...
...
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