Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LarvaTagger.jl
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
Container 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
Nyx
LarvaTagger.jl
Commits
d0146d8a
Commit
d0146d8a
authored
2 years ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
implements
#111
parent
90383bb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#102341
failed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Taggers.jl
+8
-3
8 additions, 3 deletions
src/Taggers.jl
src/cli.jl
+4
-2
4 additions, 2 deletions
src/cli.jl
src/cli_toolkit.jl
+6
-1
6 additions, 1 deletion
src/cli_toolkit.jl
with
18 additions
and
6 deletions
src/Taggers.jl
+
8
−
3
View file @
d0146d8a
...
...
@@ -8,14 +8,18 @@ struct Tagger
backend_dir
::
String
model_instance
::
String
sandbox
::
Union
{
Nothing
,
String
}
output_filenames
::
Dict
{
String
,
String
}
end
Tagger
(
backend_dir
,
model_instance
)
=
Tagger
(
backend_dir
,
model_instance
,
nothing
)
function
Tagger
(
backend_dir
,
model_instance
)
Tagger
(
backend_dir
,
model_instance
,
nothing
,
Dict
{
String
,
String
}())
end
function
isolate
(
tagger
)
mkpath
(
joinpath
(
tagger
.
backend_dir
,
"data"
,
"raw"
))
rawdatadir
=
mktempdir
(
joinpath
(
tagger
.
backend_dir
,
"data"
,
"raw"
);
cleanup
=
false
)
Tagger
(
tagger
.
backend_dir
,
tagger
.
model_instance
,
basename
(
rawdatadir
))
Tagger
(
tagger
.
backend_dir
,
tagger
.
model_instance
,
basename
(
rawdatadir
),
tagger
.
output_filenames
)
end
isbackend
(
path
)
=
isdir
(
joinpath
(
path
,
"models"
))
&&
...
...
@@ -134,7 +138,8 @@ function pull(tagger::Tagger, dest_dir::String)
parent′
=
joinpath
(
dest_dir
,
relpath
(
parent
,
proc_data_dir
))
for
file
in
files
src_file
=
normpath
(
joinpath
(
parent
,
file
))
dest_file
=
normpath
(
joinpath
(
parent′
,
file
))
file′
=
get
(
tagger
.
output_filenames
,
file
,
file
)
dest_file
=
normpath
(
joinpath
(
parent′
,
file′
))
if
dest_file
!=
src_file
open
(
src_file
,
"r"
)
do
f
open
(
dest_file
,
"w"
)
do
g
...
...
This diff is collapsed.
Click to expand it.
src/cli.jl
+
4
−
2
View file @
d0146d8a
...
...
@@ -11,8 +11,8 @@ usage = """Larva Tagger.
Usage:
larvatagger.jl open <file-path> [--backends=<path>] [--port=<number>] [--quiet] [--viewer] [--browser] [--manual-label=<label>]
larvatagger.jl import <input-path> [<output-file>] [--id=<id>] [--framerate=<fps>] [--pixelsize=<μm>] [--overrides=<comma-separated-list>] [--default-label=<label>] [--manual-label=<label>] [--decode]
larvatagger.jl train <backend-path> <data-path> <model-instance> [--pretrained-model=<instance>] [--labels=<comma-separated-list>] [--sample-size=<N>] [--balancing-strategy=<strategy>] [--class-weights=<csv>] [--manual-label=<label>] [--layers=<N>] [--iterations=<N>]
larvatagger.jl predict <backend-path> <model-instance> <data-path> [--make-dataset] [--skip-make-dataset] [--data-isolation]
larvatagger.jl train <backend-path> <data-path> <model-instance> [--pretrained-model=<instance>] [--labels=<comma-separated-list>] [--sample-size=<N>] [--balancing-strategy=<strategy>] [--class-weights=<csv>] [--manual-label=<label>] [--layers=<N>] [--iterations=<N>]
[--seed=<seed>]
larvatagger.jl predict <backend-path> <model-instance> <data-path>
[--output=<filename>]
[--make-dataset] [--skip-make-dataset] [--data-isolation]
larvatagger.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger.jl -V | --version
larvatagger.jl -h | --help
...
...
@@ -34,6 +34,7 @@ Options:
--sample-size=<N> Sample only N track segments from the data repository.
--layers=<N> (MaggotUBA) Number of layers of the classifier.
--iterations=<N> (MaggotUBA) Number of training iterations (can be two integers separated by a comma).
--seed=<seed> Seed for the backend's random number generators.
--decode Do not encode the labels into integer indices.
--default-label=<label> Label all untagged data as <label>.
--manual-label=<label> Secondary label for manually labelled data [default: edited].
...
...
@@ -42,6 +43,7 @@ Options:
--pretrained-model=<instance> Name of the pretrained encoder (from `pretrained_models` registry).
--balancing-strategy=<strategy> Any of `auto`, `maggotuba`, `none` [default: auto].
--overrides=<comma-separated-list> Comma-separated list of key:value pairs.
-o <filename> --output=<filename> Predicted labels filename.
Commands:
...
...
This diff is collapsed.
Click to expand it.
src/cli_toolkit.jl
+
6
−
1
View file @
d0146d8a
...
...
@@ -15,7 +15,7 @@ usage = """Larva Tagger.
Usage:
larvatagger-toolkit.jl import <input-path> [<output-file>] [--id=<id>] [--framerate=<fps>] [--pixelsize=<μm>] [--overrides=<comma-separated-list>] [--default-label=<label>] [--manual-label=<label>] [--decode]
larvatagger-toolkit.jl train <backend-path> <data-path> <model-instance> [--pretrained-model=<instance>] [--labels=<comma-separated-list>] [--sample-size=<N>] [--balancing-strategy=<strategy>] [--class-weights=<csv>] [--manual-label=<label>] [--layers=<N>] [--iterations=<N>] [--seed=<seed>]
larvatagger-toolkit.jl predict <backend-path> <model-instance> <data-path> [--make-dataset] [--skip-make-dataset] [--data-isolation]
larvatagger-toolkit.jl predict <backend-path> <model-instance> <data-path>
[--output=<filename>]
[--make-dataset] [--skip-make-dataset] [--data-isolation]
larvatagger-toolkit.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger-toolkit.jl -V | --version
larvatagger-toolkit.jl -h | --help
...
...
@@ -41,6 +41,7 @@ Options:
--pretrained-model=<instance> Name of the pretrained encoder (from `pretrained_models` registry).
--balancing-strategy=<strategy> Any of `auto`, `maggotuba`, `none` [default: auto].
--overrides=<comma-separated-list> Comma-separated list of key:value pairs.
-o <filename> --output=<filename> Predicted labels filename.
Commands:
...
...
@@ -277,6 +278,7 @@ function main(args=ARGS; exit_on_error=true)
model_instance
=
parsed_args
[
"<model-instance>"
]
data_path
=
parsed_args
[
"<data-path>"
]
data_isolation
=
parsed_args
[
"--data-isolation"
]
output_filename
=
parsed_args
[
"--output"
]
#
datapath
=
abspath
(
data_path
)
destination
=
if
isfile
(
datapath
)
...
...
@@ -292,6 +294,9 @@ function main(args=ARGS; exit_on_error=true)
end
#
tagger
=
Tagger
(
backend_path
,
model_instance
)
if
!
isnothing
(
output_filename
)
tagger
.
output_filenames
[
"predicted.label"
]
=
output_filename
end
if
data_isolation
tagger
=
Taggers
.
isolate
(
tagger
)
@info
"Tagger isolated"
sandbox
=
tagger
.
sandbox
...
...
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