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
30d632bb
Commit
30d632bb
authored
Jan 27, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新
parent
1f61685d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
trans_and_export_data_multi.py
script/trans_and_export_data_multi.py
+20
-13
No files found.
script/trans_and_export_data_multi.py
View file @
30d632bb
...
@@ -465,21 +465,23 @@ g_showCloud = 0 #0不显示,1显示
...
@@ -465,21 +465,23 @@ g_showCloud = 0 #0不显示,1显示
g_pcd_info
=
{}
g_pcd_info
=
{}
g_no_save_count
=
0
g_no_save_count
=
0
g_save_count
=
0
g_save_count
=
0
MAX_SAVE_FILE_NUM
=
100
MAX_SAVE_FILE_NUM
=
100
0
g_thread_lock
=
threading
.
Lock
()
g_thread_lock
=
threading
.
Lock
()
g_map_lock
=
threading
.
Lock
()
def
Save_Cloud_File
(
cloud
,
json
):
def
Save_Cloud_File
(
cloud
,
json
):
global
g_saveFileType
global
g_saveFileType
global
g_showCloud
global
g_showCloud
global
g_save_count
global
g_save_count
global
MAX_SAVE_FILE_NUM
global
MAX_SAVE_FILE_NUM
global
g_thread_lock
#去除boxx内的点
#去除boxx内的点
drawpointcloud
=
[]
drawpointcloud
=
[]
jsn_pcd
=
{}
jsn_pcd
=
{}
jsn_pcd
[
"fileuri"
]
=
""
jsn_pcd
[
"labels_box3D"
]
=
[]
jsn_pcd
[
"box_num"
]
=
{
'big'
:
0
,
'little'
:
0
,
'pedestrian'
:
0
,
'mid'
:
0
,
'cyclist'
:
0
}
jsn_pcd
[
"box_num"
]
=
{
'big'
:
0
,
'little'
:
0
,
'pedestrian'
:
0
,
'mid'
:
0
,
'cyclist'
:
0
}
jsn_pcd
[
"labels_box3D"
]
=
[]
for
bbox
in
cloud
[
"boxes"
]:
for
bbox
in
cloud
[
"boxes"
]:
jsn_box
=
{}
jsn_box
=
{}
jsn_box
[
"box3D"
]
=
{}
jsn_box
[
"box3D"
]
=
{}
...
@@ -526,7 +528,7 @@ def Save_Cloud_File(cloud,json):
...
@@ -526,7 +528,7 @@ def Save_Cloud_File(cloud,json):
drawpointcloud
+=
[
axis_pcd
]
drawpointcloud
+=
[
axis_pcd
]
custom_draw_geometry_with_key_callback
(
drawpointcloud
,
""
)
custom_draw_geometry_with_key_callback
(
drawpointcloud
,
""
)
g_save_count
+=
1
g_save_count
+=
1
print
(
"save file g_save_count = "
,
g_save_count
,
" file = "
,
cloud
[
"pcdName"
])
print
(
"save file g_save_count = "
,
g_save_count
,
" file = "
,
cloud
[
"pcdName"
]
,
" box num = "
,
jsn_pcd
[
"box_num"
]
)
g_thread_lock
.
release
()
g_thread_lock
.
release
()
...
@@ -564,6 +566,7 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
...
@@ -564,6 +566,7 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
elif
index
==
1
and
len
(
save_cloud
)
>=
100
:
elif
index
==
1
and
len
(
save_cloud
)
>=
100
:
save_cloud
[
0
][
"isSave"
]
=
1
save_cloud
[
0
][
"isSave"
]
=
1
if
add_idx
==
-
1
:
if
add_idx
==
-
1
:
if
len
(
save_cloud
)
<
60
:
new_cloud
=
{}
new_cloud
=
{}
new_cloud
[
"np_pcd"
]
=
np
.
array
(
pcd
.
points
)
new_cloud
[
"np_pcd"
]
=
np
.
array
(
pcd
.
points
)
new_cloud
[
"boxes"
]
=
[]
new_cloud
[
"boxes"
]
=
[]
...
@@ -572,9 +575,11 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
...
@@ -572,9 +575,11 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
new_cloud
[
"path"
]
=
path
new_cloud
[
"path"
]
=
path
save_cloud
.
append
(
new_cloud
)
save_cloud
.
append
(
new_cloud
)
add_idx
=
len
(
save_cloud
)
-
1
;
add_idx
=
len
(
save_cloud
)
-
1
;
else
:
print
(
" save_cloud is too big > 100"
)
return
add_idx
return
add_idx
Thread_NUM
=
2
Thread_NUM
=
3
threads
=
[]
threads
=
[]
threadID
=
1
threadID
=
1
...
@@ -595,12 +600,12 @@ class pcdThread (threading.Thread):
...
@@ -595,12 +600,12 @@ class pcdThread (threading.Thread):
global
g_save_count
global
g_save_count
global
MAX_SAVE_FILE_NUM
global
MAX_SAVE_FILE_NUM
global
g_saveFileType
global
g_saveFileType
global
g_map_lock
print
(
"开启线程:"
+
self
.
name
)
print
(
"开启线程:"
+
self
.
name
)
isStop
=
0
isStop
=
0
index
=
self
.
begin
index
=
self
.
begin
dir_pcd_list
=
self
.
_dir_pcd_list
dir_pcd_list
=
self
.
_dir_pcd_list
dirs
=
self
.
_dirs
dirs
=
self
.
_dirs
thread_idx
=
self
.
begin
save_cloud_list
=
self
.
save_list
#保存点云的数组
save_cloud_list
=
self
.
save_list
#保存点云的数组
json_list
=
self
.
jsn_list
json_list
=
self
.
jsn_list
while
isStop
==
0
:
while
isStop
==
0
:
...
@@ -631,7 +636,9 @@ class pcdThread (threading.Thread):
...
@@ -631,7 +636,9 @@ class pcdThread (threading.Thread):
lidar_loc_ex
,
out_BL_ex
,
exportCenterBL
=
get_loc
([
bbox
[
4
][
0
],
bbox
[
4
][
1
],
bbox
[
4
][
2
],
bbox
[
6
][
0
],
bbox
[
6
][
1
],
bbox
[
6
][
2
],
bbox
[
2
]],
0
,
self
.
trans
,
self
.
kit2ori
)
lidar_loc_ex
,
out_BL_ex
,
exportCenterBL
=
get_loc
([
bbox
[
4
][
0
],
bbox
[
4
][
1
],
bbox
[
4
][
2
],
bbox
[
6
][
0
],
bbox
[
6
][
1
],
bbox
[
6
][
2
],
bbox
[
2
]],
0
,
self
.
trans
,
self
.
kit2ori
)
# print(exportCenterBL)
# print(exportCenterBL)
angle2
=
car_yaw_cal
(
generate_car_yaw_cal_angle
,
bbox
[
2
])
angle2
=
car_yaw_cal
(
generate_car_yaw_cal_angle
,
bbox
[
2
])
g_map_lock
.
acquire
()
mapInfoExport
=
get_map_data
(
exportCenterBL
[
0
],
exportCenterBL
[
1
],
angle2
)
mapInfoExport
=
get_map_data
(
exportCenterBL
[
0
],
exportCenterBL
[
1
],
angle2
)
g_map_lock
.
release
()
# print("call get ex data isInMap = ",mapInfoExport)
# print("call get ex data isInMap = ",mapInfoExport)
if
mapInfoExport
[
0
]
!=
1
:
if
mapInfoExport
[
0
]
!=
1
:
continue
;
continue
;
...
@@ -678,10 +685,10 @@ class pcdThread (threading.Thread):
...
@@ -678,10 +685,10 @@ class pcdThread (threading.Thread):
if
isDeal
==
1
:
if
isDeal
==
1
:
index
+=
self
.
idx
index
+=
self
.
idx
if
(
index
-
self
.
begin
)
%
10
*
self
.
idx
==
0
:
if
(
index
-
self
.
begin
)
%
2
*
self
.
idx
==
0
:
print
(
"while thread idx = "
,
self
.
begin
,
" index = "
,
index
)
print
(
"while thread idx = "
,
self
.
threadID
,
" index = "
,
index
,
" cloud list = "
,
len
(
save_cloud_list
)
)
if
index
>=
5
0
:
# if index >= 10
0:
break
#
break
else
:
else
:
isStop
=
1
isStop
=
1
print
(
"finish all the data"
)
print
(
"finish all the data"
)
...
@@ -748,16 +755,16 @@ if __name__ == '__main__':
...
@@ -748,16 +755,16 @@ if __name__ == '__main__':
for
an
in
annos
:
for
an
in
annos
:
fileuri
=
os
.
path
.
join
(
origin_root_path
,
dir
)
+
"/pcd/"
+
an
[
'fileuri'
]
.
split
(
"/"
)[
-
1
]
fileuri
=
os
.
path
.
join
(
origin_root_path
,
dir
)
+
"/pcd/"
+
an
[
'fileuri'
]
.
split
(
"/"
)[
-
1
]
anno
[
fileuri
]
=
an
[
'labels_box3D'
]
anno
[
fileuri
]
=
an
[
'labels_box3D'
]
fp
.
close
()
dir_pcd_list
[
dir
]
.
append
(
anno
)
dir_pcd_list
[
dir
]
.
append
(
anno
)
for
i
in
range
(
Thread_NUM
):
for
i
in
range
(
Thread_NUM
):
list
=
[]
list
=
[]
save_cloud_list
.
append
(
list
)
save_cloud_list
.
append
(
list
)
jsn_list
=
[]
jsn_list
=
[]
save_json_list
.
append
(
jsn_list
)
save_json_list
.
append
(
jsn_list
)
thread
=
pcdThread
(
threadID
,
"Thread"
+
str
(
i
)
,
i
,
Thread_NUM
,
dirs
,
dir_pcd_list
,
save_cloud_list
[
i
],
save_json_list
[
i
],
generate_Trans
,
generate_kitti2origin
)
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
)
thread
.
start
()
thread
.
start
()
threads
.
append
(
thread
)
threads
.
append
(
thread
)
threadID
+=
1
for
t
in
threads
:
for
t
in
threads
:
t
.
join
()
t
.
join
()
for
_ind
,
cloud_i
in
enumerate
(
save_cloud_list
):
for
_ind
,
cloud_i
in
enumerate
(
save_cloud_list
):
...
@@ -770,7 +777,7 @@ if __name__ == '__main__':
...
@@ -770,7 +777,7 @@ if __name__ == '__main__':
jsn_path
=
os
.
path
.
join
(
generate_root_path
,
generate_child_dir
+
".json"
)
jsn_path
=
os
.
path
.
join
(
generate_root_path
,
generate_child_dir
+
".json"
)
with
open
(
jsn_path
,
'w'
)
as
file_obj
:
with
open
(
jsn_path
,
'w'
)
as
file_obj
:
json
.
dump
(
save_json
,
file_obj
,
cls
=
NumpyEncoder
)
json
.
dump
(
save_json
,
file_obj
,
cls
=
NumpyEncoder
,
indent
=
4
)
# isStop = 0
# isStop = 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