Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TaggingBackends
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nyx
TaggingBackends
Commits
c0ce7942
Commit
c0ce7942
authored
2 years ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
implements #21
parent
ef45018d
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#97340
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/LarvaDatasets.jl
+5
-0
5 additions, 0 deletions
src/LarvaDatasets.jl
src/taggingbackends/data/dataset.py
+5
-2
5 additions, 2 deletions
src/taggingbackends/data/dataset.py
with
10 additions
and
2 deletions
src/LarvaDatasets.jl
+
5
−
0
View file @
c0ce7942
...
@@ -295,6 +295,7 @@ function write_larva_dataset_hdf5(path, counts, files, refs, nsteps_before, nste
...
@@ -295,6 +295,7 @@ function write_larva_dataset_hdf5(path, counts, files, refs, nsteps_before, nste
attributes
(
g
)[
"n_samples"
]
=
sampleid
attributes
(
g
)[
"n_samples"
]
=
sampleid
# extension
# extension
h5
[
"labels"
]
=
collect
(
keys
(
counts
))
h5
[
"labels"
]
=
collect
(
keys
(
counts
))
h5
[
"label_counts"
]
=
collect
(
values
(
counts
))
#h5["files"] = [f.source for f in files]
#h5["files"] = [f.source for f in files]
if
!
isnothing
(
frameinterval
)
if
!
isnothing
(
frameinterval
)
attributes
(
g
)[
"frame_interval"
]
=
frameinterval
attributes
(
g
)[
"frame_interval"
]
=
frameinterval
...
@@ -516,6 +517,10 @@ function write_larva_dataset_hdf5(output_dir::String,
...
@@ -516,6 +517,10 @@ function write_larva_dataset_hdf5(output_dir::String,
end
end
if
!
isnothing
(
labels
)
if
!
isnothing
(
labels
)
labels′
=
p
->
string
(
p
[
1
])
in
labels
labels′
=
p
->
string
(
p
[
1
])
in
labels
missing_labels
=
[
label
for
label
in
labels
if
label
∉
keys
(
counts
)]
if
!
isempty
(
missing_labels
)
@warn
"No occurences found for labels:
\"
$
(join(missing_labels, "
\
",
\"
"
))
\
""
end
filter!
(
labels′
,
counts
)
filter!
(
labels′
,
counts
)
filter!
(
labels′
,
refs
)
filter!
(
labels′
,
refs
)
end
end
...
...
This diff is collapsed.
Click to expand it.
src/taggingbackends/data/dataset.py
+
5
−
2
View file @
c0ce7942
...
@@ -230,6 +230,9 @@ class LarvaDataset:
...
@@ -230,6 +230,9 @@ class LarvaDataset:
@property
@property
def
class_weights
(
self
):
def
class_weights
(
self
):
if
not
isinstance
(
self
.
_class_weights
,
np
.
ndarray
)
and
self
.
_class_weights
in
(
None
,
True
):
if
not
isinstance
(
self
.
_class_weights
,
np
.
ndarray
)
and
self
.
_class_weights
in
(
None
,
True
):
try
:
class_counts
=
np
.
asarray
(
self
.
full_set
[
"
label_counts
"
])
except
KeyError
:
_
,
class_counts
=
np
.
unique
(
self
.
training_labels
,
return_counts
=
True
)
_
,
class_counts
=
np
.
unique
(
self
.
training_labels
,
return_counts
=
True
)
class_counts
=
np
.
array
([
class_counts
[
i
]
for
i
in
range
(
len
(
self
.
labels
))])
class_counts
=
np
.
array
([
class_counts
[
i
]
for
i
in
range
(
len
(
self
.
labels
))])
self
.
_class_weights
=
1
-
class_counts
/
np
.
sum
(
class_counts
)
self
.
_class_weights
=
1
-
class_counts
/
np
.
sum
(
class_counts
)
...
...
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