From 90e098a7a9fa75ba3f4ffe7794c8fd5a5a187492 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Tue, 15 Nov 2022 18:12:36 +0100
Subject: [PATCH] version increment for TaggingBackends hotfix

---
 Project.toml                |  2 +-
 README.md                   |  7 +++++++
 recipes/README.md           | 21 +++++++++++++++-----
 test/predict_and_retrain.sh | 38 +++++++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+), 6 deletions(-)
 create mode 100755 test/predict_and_retrain.sh

diff --git a/Project.toml b/Project.toml
index 58aa94c..b8113f0 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
 name = "LarvaTagger"
 uuid = "8b3b36f1-dfed-446e-8561-ea19fe966a4d"
 authors = ["François Laurent", "Institut Pasteur"]
-version = "0.6.1"
+version = "0.6.2"
 
 [deps]
 Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
diff --git a/README.md b/README.md
index 2e0cd25..75697ad 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,8 @@ The first time the editor is loaded, it may take a while for a window in your we
 
 To exit the interpreter, type `exit()` or press Ctrl+D.
 
+Note that `LarvaTagger.jl` GUI does not perform equally well on all web browsers. It is very slow on Chrome and Chromium-based browsers. We recommend using Firefox as a web browser.
+
 ### Using the `larvatagger.jl` script
 
 As an alternative to explicitly launching a Julia interpreter and typing some Julia code, if you cloned the repository, you can run the `larvatagger.jl` script instead:
@@ -93,3 +95,8 @@ The `train` and `predict` commands admit more arguments. Check them out with:
 ```
 scripts/larvatagger.jl --help
 ```
+
+The trained taggers are stored in the `models` directory in the backend.
+MaggotUBA-based taggers are stored in the shape of pt and json files.
+After training a tagger, post-processing rules can be manually added into the `clf_config.json` file.
+See the following [comment](https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/issues/62#note_51819).
diff --git a/recipes/README.md b/recipes/README.md
index 79f8777..5dc79de 100644
--- a/recipes/README.md
+++ b/recipes/README.md
@@ -9,18 +9,29 @@ They ship with `LarvaTagger.jl` and, optionally, with a MaggotUBA-based toy back
 Try:
 ```
 docker pull flaur/larvatagger:latest
-docker tag flaur/larvatagger larvatagger
 ```
 
 Beware that images that ship with backends are relatively large files (>6GB on disk).
 If you are not interested in automatic tagging, use the `flaur/larvatagger:0.6-standalone` image instead.
 
+## Ensuring reproducibility
+
+The `flaur/larvatagger:latest` Docker image will be updated on every new release.
+It should be safe to upgrade but, for example, taggers may be replaced on major releases by a new tagger.
+
+To prevent upgrades, you may just tag a local image:
+```
+docker tag flaur/larvatagger larvatagger
+```
+
+The `larvatagger.sh` script mentioned further below will pick the local image if it can find it, otherwise the remote image will be used instead.
+
 ## Running an image
 
 A number of options must be passed to the `docker` command for the container to open a data file:
 
 ```
-docker -iv $(pwd):/data -p 9284:9284 larvatagger open /data/path/to/your/file --browser
+docker -iv $(pwd):/data -p 9284:9284 flaur/larvatagger open /data/path/to/your/file --browser
 ```
 with `path/to/your/file` a relative path to your file.
 
@@ -62,7 +73,7 @@ The `build` command requires a local copy of the LarvaTagger.jl project. In addi
 
 The larvatagger.sh script is recommended for the `train` and `predict` commands.
 
-Type `scripts/larvatagger.sh` alone to check out about command usage.
+Type `./larvatagger.sh` alone to check out about command usage.
 
 For the trained models to be persistant, the `train` command must store them outside the container.
 Per default, `larvatagger.sh train` creates a *models* directory in the current directory and stores the model instances in there.
@@ -74,8 +85,8 @@ To distinguish between paths and names, `larvatagger.sh` checks whether the corr
 
 For example:
 ```
-./larvatagger.sh train /path/to/data/repo my-tagger --backend MaggotUBA
-./larvatagger.sh predict /path/to/data/file --backend MaggotUBA --model-instance models/my-tagger --skip-make-dataset
+./larvatagger.sh train /path/to/data/repo my-tagger
+./larvatagger.sh predict /path/to/data/file --model-instance models/my-tagger --skip-make-dataset
 ```
 
 ## Windows PowerShell example
diff --git a/test/predict_and_retrain.sh b/test/predict_and_retrain.sh
new file mode 100755
index 0000000..89f80e6
--- /dev/null
+++ b/test/predict_and_retrain.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+trap 'rm -rf "$TMPDIR"' EXIT
+
+TMPDIR=$(mktemp -d) || exit 1
+pushd "$TMPDIR"
+
+# get wrapper script
+wget -O larvatagger.sh https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/raw/dev/scripts/larvatagger.sh?inline=false
+chmod u+x larvatagger.sh
+
+# get sample data
+DATADIR1="data/FCF_attP2_1500062@UAS_Chrimson_Venus_X_0070/r_LED50_30s2x15s30s#n#n#n@100/20150701_105504"
+mkdir -p "$DATADIR1"
+wget -O chore_sample_output.tar.gz https://gitlab.pasteur.fr/nyx/artefacts/-/raw/master/PlanarLarvae/chore_sample_output.tar.gz?inline=false
+tar zxf "$TMPDIR/chore_sample_output.tar.gz"
+mv chore_sample_output/* "${DATADIR1}/"
+rmdir chore_sample_output
+DATADIR2="data/GMR_SS02113@UAS_Chrimson_Venus_X_0070/r_LED100_30s2x15s30s#n#n#n@100/20140918_170215"
+mkdir -p "$DATADIR2"
+wget -O trx_small.tgz https://gitlab.pasteur.fr/nyx/artefacts/-/raw/master/PlanarLarvae/trx_small.tgz?inline=false
+cd "$DATADIR2"
+tar zxf "$TMPDIR/trx_small.tgz"
+cd "$TMPDIR"
+rm -f *gz
+
+# use default tagger on Choreography data
+./larvatagger.sh predict "$(\ls -1 ${DATADIR1}/*.spine)"
+
+head -n30 "${DATADIR1}/predicted.label"
+echo '...'
+
+# train a new tagger with the 2-data-file repository
+./larvatagger.sh train "data" newtagger
+
+cat models/newtagger/clf_config.json
+
+popd
-- 
GitLab