Skip to content
Snippets Groups Projects
Commit fa5f9b94 authored by François  LAURENT's avatar François LAURENT
Browse files

extra doc and bug fix for extra input arguments

parent 6c470284
No related branches found
No related tags found
No related merge requests found
Pipeline #100327 passed
......@@ -4,24 +4,24 @@ Docker images can be used with the `docker` command.
To make their usage easier, standalone scripts are available in the *scripts* directory.
They can be used with no installation step other than setting up Docker.
Windows users should use the [larvatagger.ps1 script](#the-larvataggerps1-script), while macOS and Linux users should use the [larvatagger.sh script](#the-larvataggersh-script) instead.
Windows users should use the [larvatagger.bat script](#the-larvataggerbat-script), while macOS and Linux users should use the [larvatagger.sh script](#the-larvataggersh-script) instead.
The first two sections describe how to use these scripts.
The last section is dedicated to Singularity/Apptainer.
## The *larvatagger.ps1* script
## The *larvatagger.bat* script
### Getting the script
The *larvatagger.ps1* script is available in the *scripts* directory of the project.
The *larvatagger.bat* script is available in the *scripts* directory of the project.
If you do not have a copy of the project, you can simply [download the script](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/main/scripts/larvatagger.ps1?inline=false).
If you do not have a copy of the project, you can simply [download the script](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/main/scripts/larvatagger.bat?inline=false) and save it in your `C:\Users\<user>` directory.
Note that Docker still has to be installed.
In PowerShell, to check the script works properly, change directory to where the *larvatagger.ps1* script is located and try:
In the command prompt (`cmd`), to check the script works properly, try:
```
PowerShell.exe -ExecutionPolicy ByPass -File larvatagger.ps1 --version
larvatagger.bat --version
```
The first time the script runs, Docker downloads the latest image.
......@@ -30,19 +30,41 @@ The first time the script runs, Docker downloads the latest image.
To open a track data file, try:
```
PowerShell.exe -ExecutionPolicy ByPass -File larvatagger.ps1 open Z:\path\to\datafile
larvatagger.bat open Z:\path\to\datafile
```
This turns the commandline into a Julia interpreter to serve the app as a webserver.
As instructed, open `localhost:9284` in your webbrowser to access the app.
Unlike instructed, you can stop the server in the commandline pressing Ctrl+C instead of Ctrl+D.
You can stop the server in the commandline pressing Ctrl+C.
The server can also be exited typing `exit()` and pressing Enter.
The `--browser` argument mentioned elsewhere does not work with the *larvatagger.bat* script yet.
A default tagger will be available in the app.
### Automatic tagging
To apply a tagger (e.g. `20230311`) to a track data file, type:
```
larvatagger.bat predict Z:\path\to\datafile 20230311
```
This will create a *predicted.label* in the same directory as the data file. If the file already exists, it is overwritten.
To apply a custom tagger, named e.g. *mytagger* and stored in the `C:\Users\<user>\models\mytagger` directory, type instead:
```
larvatagger.bat predict Z:\path\to\datafile models\mytagger
```
Here, `models\mytagger` is the relative path of the directory of the tagger.
This path has to include at least one `\` character so that it is identified as an external tagger.
Otherwise, LarvaTagger.jl would look up for the tagger inside the Docker container, and fail to find it.
### More to come...
The `train`, `merge` and `import` commands work similarly to the *larvatagger.sh* script. See the below section to know more about these commands.
Not all arguments and options are available, though. See also `larvatagger.bat --help`.
## The *larvatagger.sh* script
......
PowerShell.exe -ExecutionPolicy ByPass -File larvatagger.ps1 $*
......@@ -36,7 +36,9 @@ function Call1 {
$args = $args -split ' '
$cmd = $args[0]
$path = Convert-Path $args[1]
$extraargs = $args[2..($args.count - 1)]
if ($args.count -gt 2) {
$extraargs = $args[2..($args.count - 1)]
}
if ($cmd -eq 'open') {
$runargs = '-p', '9284:9284', '-i'
}
......@@ -99,7 +101,9 @@ Switch ($args[0])
New-Item -Path $modelsdir -ItemType 'directory'
}
$taggername = Split-Path -Leaf $taggerpath
$extraargs = $args[3..($args.count - 1)]
if ($args.count -gt 3) {
$extraargs = $args[3..($args.count - 1)]
}
Write-Host "docker run --mount `"type=bind,src=$modelsdir,dst=/app/$TAGGING_BACKEND/models`" -v ${parentdir}:/data $LARVATAGGER_IMAGE train /app/$TAGGING_BACKEND /data/$dirname $taggername $extraargs"
docker run --mount "type=bind,src=$modelsdir,dst=/app/$TAGGING_BACKEND/models" -v ${parentdir}:/data $LARVATAGGER_IMAGE train /app/$TAGGING_BACKEND /data/$dirname $taggername $extraargs
}
......@@ -116,7 +120,9 @@ Switch ($args[0])
}
$parentdir = Split-Path -Parent $path
$filename = Split-Path -Leaf $path
$extraargs = $args[3..($args.count - 1)]
if ($args.count -gt 3) {
$extraargs = $args[3..($args.count - 1)]
}
Write-Host "docker run $runargs -v ${parentdir}:/data $LARVATAGGER_IMAGE predict /app/$TAGGING_BACKEND $taggername /data/$filename $extraargs"
docker run $runargs -v ${parentdir}:/data $LARVATAGGER_IMAGE predict /app/$TAGGING_BACKEND $taggername /data/$filename $extraargs
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment