Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mobile-robotics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
efvega
Mobile-robotics
Commits
d139d9a2
Commit
d139d9a2
authored
2 years ago
by
efvega
Browse files
Options
Downloads
Patches
Plain Diff
Updates figures files and fixes a minor typo in README
parent
9d07c784
Branches
master
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+0
-1
0 additions, 1 deletion
README.md
src/distribution_tools/model_imu_data.py
+11
-14
11 additions, 14 deletions
src/distribution_tools/model_imu_data.py
src/distribution_tools/model_sift_error.py
+62
-0
62 additions, 0 deletions
src/distribution_tools/model_sift_error.py
with
73 additions
and
15 deletions
README.md
+
0
−
1
View file @
d139d9a2
...
...
@@ -21,7 +21,6 @@ pip install -r requirements.txt
### Run code
```
python tmain.py
python -i src/distribution_tools/tmain.py
```
...
...
This diff is collapsed.
Click to expand it.
src/distribution_tools/model_imu_data.py
+
11
−
14
View file @
d139d9a2
...
...
@@ -21,6 +21,7 @@ print(result.keys()) # let's check what objects we got
stats
.
probplot
(
numpy_data
,
dist
=
"
norm
"
,
plot
=
plt
)
plt
.
show
()
plt
.
title
(
'
Probability Plot for IMU Dataset
'
)
realization
=
numpy_data
...
...
@@ -30,9 +31,9 @@ df = 1000
skew
=
0
theta
=
np
.
array
([
loc
,
scale
,
df
,
skew
])
#
#
res = minimize(getObjectiveFunction(realization, use_loglikelihood=True), x0=theta,
#
method='Nelder-Mead')
res
=
minimize
(
getObjectiveFunction
(
realization
,
use_loglikelihood
=
True
),
x0
=
theta
,
method
=
'
Nelder-Mead
'
)
N
=
1_000
xmin
=
-
0.05
...
...
@@ -40,16 +41,12 @@ xmax = 0.05
extent
=
xmax
-
xmin
xvals
=
np
.
linspace
(
xmin
-
0.1
*
extent
,
xmax
+
0.1
*
extent
,
N
)
# plt.figure()
# est_pdf = tspdf_1d(xvals, res.x[0], res.x[1], res.x[2], res.x[3])
# plt.hist(realization, bins=500, density=True, color='green', alpha=0.5)
# plt.plot(xvals, est_pdf, linestyle='--', label='Estimated skew t', linewidth=3, alpha=0.5)
# plt.xlim([xmin, xmax])
# plt.legend()
plt
.
figure
()
est_pdf
=
tspdf_1d
(
xvals
,
res
.
x
[
0
],
res
.
x
[
1
],
res
.
x
[
2
],
res
.
x
[
3
])
plt
.
hist
(
realization
,
bins
=
500
,
density
=
True
,
color
=
'
green
'
,
alpha
=
0.5
)
plt
.
plot
(
xvals
,
est_pdf
,
linestyle
=
'
--
'
,
label
=
'
Estimated skew t
'
,
linewidth
=
3
,
alpha
=
0.5
)
plt
.
xlim
([
xmin
,
xmax
])
plt
.
title
(
r
'
IMU Data Modeled Using Skew-$t$ Distribution
'
)
plt
.
legend
()
loc
=
2.72e-5
scale
=
2.25e-6
df
=
1
skew
=
2.8e-3
# median = ts_invcdf(np.array([0.25, 0.5, 0.75]), loc, scale, df, skew)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/distribution_tools/model_sift_error.py
0 → 100644
+
62
−
0
View file @
d139d9a2
import
numpy
as
np
import
matplotlib.pyplot
as
plt
;
plt
.
ion
()
import
scipy.stats
as
stats
from
scipy.optimize
import
minimize
from
tskew.tskew
import
getObjectiveFunction
,
tspdf_1d
import
pyreadr
esti_delta_r
=
np
.
load
(
'
../../data/deltar_sift.npy
'
)
true_delta_r
=
np
.
load
(
'
../../data/deltar_tru_sift.npy
'
)
error
=
esti_delta_r
-
true_delta_r
fig
,
axs
=
plt
.
subplots
(
1
,
2
,
sharex
=
True
)
fig
.
suptitle
(
'
True and estimated frame-to-frame displacements
'
)
axs
[
0
].
plot
(
true_delta_r
,
label
=
r
'
True $\Delta r$
'
,
linewidth
=
5
)
axs
[
0
].
plot
(
esti_delta_r
,
linestyle
=
'
--
'
,
label
=
r
'
Est. $\Delta r$
'
,
linewidth
=
5
)
axs
[
0
].
set_xlabel
(
'
Frame index
'
)
axs
[
0
].
set_ylabel
(
'
Distance (m)
'
)
axs
[
0
].
set_title
(
'
Overlayed
'
)
axs
[
0
].
legend
()
axs
[
1
].
plot
(
error
)
axs
[
1
].
set_xlabel
(
'
Frame index
'
)
axs
[
1
].
set_ylabel
(
'
Error (m)
'
)
axs
[
1
].
set_title
(
'
Difference
'
)
plt
.
figure
()
stats
.
probplot
(
error
,
dist
=
"
norm
"
,
plot
=
plt
)
plt
.
title
(
'
Probability Plot for Visual Odometry Errors
'
)
plt
.
show
()
realization
=
error
loc
=
np
.
mean
(
realization
)
scale
=
np
.
var
(
realization
)
df
=
10
skew
=
0
theta
=
np
.
array
([
loc
,
scale
,
df
,
skew
])
res
=
minimize
(
getObjectiveFunction
(
realization
,
use_loglikelihood
=
True
),
x0
=
theta
,
method
=
'
Nelder-Mead
'
)
N
=
1_000
xmin
=
np
.
min
(
realization
)
xmax
=
np
.
max
(
realization
)
extent
=
xmax
-
xmin
xvals
=
np
.
linspace
(
xmin
-
0.1
*
extent
,
xmax
+
0.1
*
extent
,
N
)
plt
.
figure
()
est_pdf
=
tspdf_1d
(
xvals
,
res
.
x
[
0
],
res
.
x
[
1
],
res
.
x
[
2
],
res
.
x
[
3
])
plt
.
hist
(
realization
,
bins
=
100
,
density
=
True
,
color
=
'
green
'
,
alpha
=
0.5
)
plt
.
plot
(
xvals
,
est_pdf
,
linestyle
=
'
--
'
,
label
=
'
Estimated skew t
'
,
linewidth
=
3
,
alpha
=
0.5
)
plt
.
xlim
([
xmin
,
xmax
])
plt
.
title
(
r
'
Modeling Visual Odometry Errors using Skew-$t$ Distribution
'
)
plt
.
legend
()
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