Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eds_22_23
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Lucas
eds_22_23
Commits
4b8077e1
Commit
4b8077e1
authored
2 years ago
by
Antoine Lucas
⛷️
Browse files
Options
Downloads
Patches
Plain Diff
Replace libLab3_Lidar.py
parent
816af9df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Labs/Lab_3_LiDAR_ML_Segmentation/libLab3_Lidar.py
+13
-8
13 additions, 8 deletions
Labs/Lab_3_LiDAR_ML_Segmentation/libLab3_Lidar.py
with
13 additions
and
8 deletions
Labs/Lab_3_LiDAR_ML_Segmentation/libLab3_Lidar.py
+
13
−
8
View file @
4b8077e1
...
...
@@ -109,7 +109,7 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
"""
from
sklearn.decomposition
import
PCA
from
scipy
import
spatial
#
from scipy import spatial
...
...
@@ -123,7 +123,7 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
print
(
"
shape of Y
"
,
np
.
shape
(
Y
))
# Estimate the distance of one point with every neighbour around
dist
=
spatial
.
distance
.
squareform
(
spatial
.
distance
.
pdist
(
Y
))
#
dist = spatial.distance.squareform(spatial.distance.pdist(Y))
...
...
@@ -139,13 +139,18 @@ def getEigenvaluePCA(a, b, c, dim, decim=2):
# 3. Using PCA scikit-learn function, we estimate the 3 eigenvalues of these points
# 4. We concatenate these 3 eigenvalues in a single array which will be return at the end.
for
kk
in
range
(
0
,
n_samples
):
pts
=
np
.
where
((
dist
[
kk
,:]
<=
dim
/
2
))
# Mask of values corresp. to the criteria
dist
=
np
.
sqrt
((
Y
[
kk
,
0
]
-
Y
[:,
0
])
**
2
+
(
Y
[
kk
,
1
]
-
Y
[:,
1
])
**
2
+
(
Y
[
kk
,
2
]
-
Y
[:,
2
])
**
2
)
# Mask of values corresp. to the criteria
pts
=
np
.
where
((
dist
<=
dim
/
2
))
if
np
.
size
(
pts
)
<
3
:
# Check if the number of neighbour is sufficient
print
(
"
Revise dims:
"
)
print
(
pts
)
print
(
dist
)
#print("Revise dims: ")
#print(pts)
#print(dist)
eigenvalues
=
np
.
array
([
0.
,
0.
,
0.
])
else
:
Ytmp
=
Y
[
pts
,:]
# Apply the criteria on the dataset
Ytmp
=
Ytmp
[
0
,:,:]
# Reduce the depth of the array
...
...
@@ -483,7 +488,7 @@ def plot_3dcladd(dx,dy,dz,y,density=1):
for
xb
,
yb
,
zb
in
zip
(
Xb
,
Yb
,
Zb
):
ax
.
plot
([
xb
],
[
yb
],
[
zb
],
'
w
'
)
plt
.
show
()
def
plot_confMat
(
cnf_matrix
,
ClaName
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment