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
ab9e7cea
Commit
ab9e7cea
authored
1 year ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
--embeddings option
parent
98e25a4d
No related branches found
No related tags found
1 merge request
!15
Set of commits to be tagged v0.17
Pipeline
#119739
passed
1 year ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
scripts/larvatagger
+2
-0
2 additions, 0 deletions
scripts/larvatagger
src/Taggers.jl
+11
-1
11 additions, 1 deletion
src/Taggers.jl
src/cli.jl
+2
-0
2 additions, 0 deletions
src/cli.jl
src/cli_toolkit.jl
+10
-2
10 additions, 2 deletions
src/cli_toolkit.jl
with
25 additions
and
3 deletions
scripts/larvatagger
+
2
−
0
View file @
ab9e7cea
...
@@ -34,6 +34,7 @@ Usage:
...
@@ -34,6 +34,7 @@ Usage:
larvatagger 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>] [--debug]
larvatagger 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>] [--debug]
larvatagger train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger predict <backend-path> <model-instance> <data-path> --embeddings [--data-isolation] [--debug]
larvatagger merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger -V | --version
larvatagger -V | --version
larvatagger -h | --help
larvatagger -h | --help
...
@@ -59,6 +60,7 @@ Options:
...
@@ -59,6 +60,7 @@ Options:
--seed=<seed> Seed for the backend's random number generators.
--seed=<seed> Seed for the backend's random number generators.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--debug Lower the logging level to DEBUG.
--debug Lower the logging level to DEBUG.
--embeddings (MaggotUBA) Call the backend to generate embeddings instead of labels.
--decode Do not encode the labels into integer indices.
--decode Do not encode the labels into integer indices.
--copy-labels Replicate discrete behavior data from the input file.
--copy-labels Replicate discrete behavior data from the input file.
--default-label=<label> Label all untagged data as <label>.
--default-label=<label> Label all untagged data as <label>.
...
...
This diff is collapsed.
Click to expand it.
src/Taggers.jl
+
11
−
1
View file @
ab9e7cea
...
@@ -2,7 +2,7 @@ module Taggers
...
@@ -2,7 +2,7 @@ module Taggers
import
PlanarLarvae
.
Formats
,
PlanarLarvae
.
Dataloaders
import
PlanarLarvae
.
Formats
,
PlanarLarvae
.
Dataloaders
export
Tagger
,
isbackend
,
resetmodel
,
resetdata
,
train
,
predict
,
finetune
export
Tagger
,
isbackend
,
resetmodel
,
resetdata
,
train
,
predict
,
finetune
,
embed
struct
Tagger
struct
Tagger
backend_dir
::
String
backend_dir
::
String
...
@@ -247,4 +247,14 @@ function finetune(tagger::Tagger; original_instance=nothing, kwargs...)
...
@@ -247,4 +247,14 @@ function finetune(tagger::Tagger; original_instance=nothing, kwargs...)
return
ret
return
ret
end
end
function
embed
(
tagger
::
Tagger
;
kwargs
...
)
args
=
[
"--model-instance"
,
tagger
.
model_instance
]
if
!
isnothing
(
tagger
.
sandbox
)
push!
(
args
,
"--sandbox"
)
push!
(
args
,
tagger
.
sandbox
)
end
parsekwargs!
(
args
,
kwargs
)
run
(
Cmd
(
`poetry run tagging-backend embed $(args)`
;
dir
=
tagger
.
backend_dir
))
end
end
# module
end
# module
This diff is collapsed.
Click to expand it.
src/cli.jl
+
2
−
0
View file @
ab9e7cea
...
@@ -14,6 +14,7 @@ Usage:
...
@@ -14,6 +14,7 @@ Usage:
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>] [--debug]
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>] [--debug]
larvatagger.jl train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger.jl train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger.jl predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger.jl predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger.jl predict <backend-path> <model-instance> <data-path> --embeddings [--data-isolation] [--debug]
larvatagger.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger.jl -V | --version
larvatagger.jl -V | --version
larvatagger.jl -h | --help
larvatagger.jl -h | --help
...
@@ -39,6 +40,7 @@ Options:
...
@@ -39,6 +40,7 @@ Options:
--seed=<seed> Seed for the backend's random number generators.
--seed=<seed> Seed for the backend's random number generators.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--debug Lower the logging level to DEBUG.
--debug Lower the logging level to DEBUG.
--embeddings (MaggotUBA) Call the backend to generate embeddings instead of labels.
--decode Do not encode the labels into integer indices.
--decode Do not encode the labels into integer indices.
--copy-labels Replicate discrete behavior data from the input file.
--copy-labels Replicate discrete behavior data from the input file.
--default-label=<label> Label all untagged data as <label>.
--default-label=<label> Label all untagged data as <label>.
...
...
This diff is collapsed.
Click to expand it.
src/cli_toolkit.jl
+
10
−
2
View file @
ab9e7cea
...
@@ -19,6 +19,7 @@ Usage:
...
@@ -19,6 +19,7 @@ Usage:
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>] [--debug]
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>] [--debug]
larvatagger-toolkit.jl train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger-toolkit.jl train <backend-path> <data-path> <model-instance> --fine-tune=<instance> [--balancing-strategy=<strategy>] [--manual-label=<label>] [--iterations=<N>] [--seed=<seed>] [--debug]
larvatagger-toolkit.jl predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger-toolkit.jl predict <backend-path> <model-instance> <data-path> [--output=<filename>] [--make-dataset] [--skip-make-dataset] [--data-isolation] [--debug]
larvatagger-toolkit.jl predict <backend-path> <model-instance> <data-path> --embeddings [--data-isolation] [--debug]
larvatagger-toolkit.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger-toolkit.jl merge <input-path> <input-file> [<output-file>] [--manual-label=<label>] [--decode]
larvatagger-toolkit.jl -V | --version
larvatagger-toolkit.jl -V | --version
larvatagger-toolkit.jl -h | --help
larvatagger-toolkit.jl -h | --help
...
@@ -38,6 +39,7 @@ Options:
...
@@ -38,6 +39,7 @@ Options:
--seed=<seed> Seed for the backend's random number generators.
--seed=<seed> Seed for the backend's random number generators.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--segment=<t0,t1> Start and end times (included, comma-separated) for cropping and including tracks.
--debug Lower the logging level to DEBUG.
--debug Lower the logging level to DEBUG.
--embeddings (MaggotUBA) Call the backend to generate embeddings instead of labels.
--decode Do not encode the labels into integer indices.
--decode Do not encode the labels into integer indices.
--copy-labels Replicate discrete behavior data from the input file.
--copy-labels Replicate discrete behavior data from the input file.
--default-label=<label> Label all untagged data as <label>.
--default-label=<label> Label all untagged data as <label>.
...
@@ -188,6 +190,7 @@ function main(args=ARGS; exit_on_error=true)
...
@@ -188,6 +190,7 @@ function main(args=ARGS; exit_on_error=true)
data_path
=
parsed_args
[
"<data-path>"
]
data_path
=
parsed_args
[
"<data-path>"
]
data_isolation
=
parsed_args
[
"--data-isolation"
]
data_isolation
=
parsed_args
[
"--data-isolation"
]
output_filename
=
parsed_args
[
"--output"
]
output_filename
=
parsed_args
[
"--output"
]
embeddings
=
parsed_args
[
"--embeddings"
]
#
#
datapath
=
abspath
(
data_path
)
datapath
=
abspath
(
data_path
)
destination
=
if
isfile
(
datapath
)
destination
=
if
isfile
(
datapath
)
...
@@ -216,8 +219,13 @@ function main(args=ARGS; exit_on_error=true)
...
@@ -216,8 +219,13 @@ function main(args=ARGS; exit_on_error=true)
end
end
resetdata
(
tagger
)
resetdata
(
tagger
)
Taggers
.
push
(
tagger
,
datapath
)
Taggers
.
push
(
tagger
,
datapath
)
predict
(
tagger
;
skip_make_dataset
=
parsed_args
[
"--skip-make-dataset"
],
if
embeddings
make_dataset
=
parsed_args
[
"--make-dataset"
],
debug
=
parsed_args
[
"--debug"
])
embed
(
tagger
;
skip_make_dataset
=
parsed_args
[
"--skip-make-dataset"
],
make_dataset
=
parsed_args
[
"--make-dataset"
],
debug
=
parsed_args
[
"--debug"
])
else
predict
(
tagger
;
skip_make_dataset
=
parsed_args
[
"--skip-make-dataset"
],
make_dataset
=
parsed_args
[
"--make-dataset"
],
debug
=
parsed_args
[
"--debug"
])
end
Taggers
.
pull
(
tagger
,
destination
)
Taggers
.
pull
(
tagger
,
destination
)
end
end
end
end
...
...
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