Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Subsampling
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josef Brandt
Subsampling
Commits
ca10567b
Commit
ca10567b
authored
Apr 16, 2020
by
Josef Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Important bugfixes
parents
fc238b30
de30ddf1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
+21
-15
datasetOperations.py
datasetOperations.py
+5
-2
evaluation.py
evaluation.py
+3
-6
graphs.py
graphs.py
+3
-1
subsampling.py
subsampling.py
+10
-6
unfinished.pkl
unfinished.pkl
+0
-0
No files found.
datasetOperations.py
View file @
ca10567b
...
...
@@ -5,7 +5,7 @@ sys.path.append("C://Users//xbrjos//Desktop//Python")
from
gepard
import
dataset
from
gepard.analysis.particleContainer
import
ParticleContainer
from
cythonModules
import
rotateContour
from
helpers
import
get_filterDimensions_from_dataset
,
get_center_from_filter_dimensions
from
helpers
import
get_filterDimensions_from_dataset
,
get_center_from_filter_dimensions
,
convert_length_to_pixels
class
ParticleVariations
(
object
):
...
...
@@ -18,9 +18,12 @@ class ParticleVariations(object):
def
get_particleContainer_variations
(
self
)
->
ParticleContainer
:
if
self
.
numVariations
>
0
:
offset
,
diameter
,
[
width
,
height
]
=
get_filterDimensions_from_dataset
(
self
.
dataset
)
diameter
:
float
=
convert_length_to_pixels
(
self
.
dataset
,
diameter
)
offset
:
tuple
=
convert_length_to_pixels
(
self
.
dataset
,
offset
[
0
]),
\
convert_length_to_pixels
(
self
.
dataset
,
offset
[
1
])
center
:
np
.
ndarray
=
get_center_from_filter_dimensions
(
offset
,
diameter
)
partContainer
:
ParticleContainer
=
self
.
origParticleContainer
# contours: list = partContainer.getParticleContours()
angles
=
self
.
_get_angles
()
for
i
in
range
(
self
.
numVariations
):
if
i
>
0
:
...
...
evaluation.py
View file @
ca10567b
...
...
@@ -32,7 +32,8 @@ def get_methods_to_test(dataset: dataset.DataSet, fractions: list = []) -> list:
:return: list of measurement Objects that are applicable
"""
if
len
(
fractions
)
==
0
:
fractions
:
list
=
[
0.02
,
0.05
,
0.1
,
0.2
,
0.3
,
0.5
,
0.7
,
0.9
]
fractions
:
list
=
[
0.02
,
0.05
,
0.1
,
0.25
,
0.5
,
0.7
,
0.9
]
# fractions: list = [0.02, 0.1, 0.5, 0.9]
methods
:
list
=
[]
particleContainer
=
dataset
.
particleContainer
...
...
@@ -199,10 +200,6 @@ class SubsamplingResult(object):
:param subParticles:
:return:
"""
# if type(self.method) == cmeth.ChemometricSubsampling:
# print('chemometric subsamling found')
# error: float = self._get_mp_count_error(origParticles, subParticles, 1.0)
# else:
error
:
float
=
self
.
_get_mp_count_error
(
origParticles
,
subParticles
,
self
.
method
.
fraction
)
self
.
origParticleCount
=
len
(
origParticles
)
self
.
mpCountErrors
.
append
(
error
)
...
...
@@ -247,7 +244,7 @@ class SampleResult(object):
"""
An object the stores all generated results per sample and can update and report on them.
"""
def
__init__
(
self
,
filepath
:
str
,
numVariations
:
int
=
10
):
def
__init__
(
self
,
filepath
:
str
,
numVariations
:
int
=
5
):
super
(
SampleResult
,
self
).
__init__
()
self
.
filepath
:
str
=
filepath
self
.
dataset
:
dataset
.
DataSet
=
None
...
...
graphs.py
View file @
ca10567b
...
...
@@ -11,7 +11,7 @@ def get_error_vs_frac_plot(totalResults: TotalResults, attributes: list = [], me
methods
=
[[]]
*
len
(
attributes
)
assert
len
(
attributes
)
==
len
(
methods
)
fig
:
Figure
=
plt
.
figure
()
fig
:
Figure
=
plt
.
figure
(
figsize
=
(
10
,
5
)
)
numRows
:
int
=
1
numCols
:
int
=
1
if
len
(
attributes
)
==
0
:
...
...
@@ -48,6 +48,8 @@ def get_error_vs_frac_plot(totalResults: TotalResults, attributes: list = [], me
ax
.
legend
()
index
+=
1
fig
.
tight_layout
()
return
fig
...
...
subsampling.py
View file @
ca10567b
...
...
@@ -12,8 +12,7 @@ SET GEPARD TO EVALUATION BRANCH (WITHOUT THE TILING STUFF), OTHERWISE SOME OF TH
"""
if
__name__
==
'__main__'
:
# results: TotalResults = TotalResults()
results
:
TotalResults
=
load_results
(
'results1.res'
)
results
:
TotalResults
=
TotalResults
()
pklsInFolders
=
get_pkls_from_directory
(
r
'C:\Users\xbrjos\Desktop\temp MP\NewDatasets'
)
for
folder
in
pklsInFolders
.
keys
():
...
...
@@ -26,9 +25,14 @@ if __name__ == '__main__':
results
.
update_all
()
print
(
'updating all took'
,
time
.
time
()
-
t0
,
'seconds'
)
save_results
(
'results
1
.res'
,
results
)
results
:
TotalResults
=
load_results
(
'results1.res'
)
save_results
(
'results
2
.res'
,
results
)
#
results: TotalResults = load_results('results1.res')
plot
:
Figure
=
get_error_vs_frac_plot
(
results
,
attributes
=
[[
'air'
,
'water'
],
[
'sediment'
,
'soil'
,
'beach'
,
'slush'
]],
methods
=
[])
# plot: Figure = get_error_vs_frac_plot(results, attributes=[['air', 'water'], ['sediment', 'soil', 'beach', 'slush']],
# methods=[['Boxes random']]*2)
# methods=[['Random Subsampling', 'Sizebin']] * 2)
plot
:
Figure
=
get_error_vs_frac_plot
(
results
,
attributes
=
[[
'air'
,
'water'
],
[
'sediment'
,
'soil'
,
'beach'
,
'slush'
]],
methods
=
[[
'layout (7'
,
'layout (10'
,
'layout (15'
,
'cross'
,
'random subsampling'
,
'sizebin'
]]
*
2
)
plot
.
show
()
unfinished.pkl
0 → 100644
View file @
ca10567b
File added
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