diff --git a/.bonsai/Bonsai.config b/.bonsai/Bonsai.config new file mode 100644 index 0000000..aec54df --- /dev/null +++ b/.bonsai/Bonsai.config @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.bonsai/NuGet.config b/.bonsai/NuGet.config new file mode 100644 index 0000000..97e8b73 --- /dev/null +++ b/.bonsai/NuGet.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.bonsai/Setup.ps1 b/.bonsai/Setup.ps1 new file mode 100644 index 0000000..01cfba6 --- /dev/null +++ b/.bonsai/Setup.ps1 @@ -0,0 +1,21 @@ +Push-Location $PSScriptRoot +if (!(Test-Path "./Bonsai.exe")) { + $release = "https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip" + $configPath = "./Bonsai.config" + if (Test-Path $configPath) { + [xml]$config = Get-Content $configPath + $bootstrapper = $config.PackageConfiguration.Packages.Package.where{$_.id -eq 'Bonsai'} + if ($bootstrapper) { + $version = $bootstrapper.version + $release = "https://github.com/bonsai-rx/bonsai/releases/download/$version/Bonsai.zip" + } + } + Invoke-WebRequest $release -OutFile "temp.zip" + Move-Item -Path "NuGet.config" "temp.config" -ErrorAction SilentlyContinue + Expand-Archive "temp.zip" -DestinationPath "." -Force + Move-Item -Path "temp.config" "NuGet.config" -Force -ErrorAction SilentlyContinue + Remove-Item -Path "temp.zip" + Remove-Item -Path "Bonsai32.exe" +} +& .\Bonsai.exe --no-editor +Pop-Location \ No newline at end of file diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..278b6c7 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "docfx": { + "version": "2.75.3", + "commands": [ + "docfx" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c743a8a..a805ea9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,30 +8,40 @@ jobs: build: runs-on: windows-latest steps: - - uses: actions/checkout@v2 - + - name: Checkout + uses: actions/checkout@v4.1.1 + with: + submodules: true + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v4.0.0 + with: + dotnet-version: 7.x + - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - + uses: microsoft/setup-msbuild@v2 + - name: Restore NuGet Packages - run: msbuild -t:restore src\Bonsai.Sleap.sln + run: msbuild -t:restore src/Bonsai.Sleap.sln + - name: Build Solution + run: msbuild src/Bonsai.Sleap.sln /p:Configuration=Release + - name: Setup DocFX - uses: crazy-max/ghaction-chocolatey@v1 - with: - args: install docfx + run: dotnet tool restore + - name: Setup Bonsai + working-directory: .bonsai + run: ./Setup.ps1 + - name: Build Documentation - run: docfx docs/docfx.json - - - name: Checkout gh-pages - uses: actions/checkout@v2 - with: - ref: gh-pages - path: gh-pages + working-directory: docs + run: ./build.ps1 + - name: Publish to github pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v3.9.3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_site + publish_branch: gh-pages force_orphan: true diff --git a/.gitignore b/.gitignore index 008655f..3364c2b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,10 @@ obj *.layout movies models + +# bonsai environment +Packages +*.dll +*.exe +*.exe.old +*.exe.settings \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..05f0afb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "docs/bonsai"] + path = docs/bonsai + url = https://github.com/bonsai-rx/docfx-tools +[submodule "docs/assets"] + path = docs/assets + url = https://github.com/bonsai-rx/docfx-assets diff --git a/LICENSE b/LICENSE index 638bbc1..1867a86 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Bonsai Foundation CIC +Copyright (c) 2024 Bonsai Foundation CIC and Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/docs/articles/intro.md b/docs/articles/intro.md deleted file mode 100644 index 9d5afed..0000000 --- a/docs/articles/intro.md +++ /dev/null @@ -1,28 +0,0 @@ -Getting Started with Bonsai - SLEAP -=================================== - -![logo](~/images/sleap-Bonsai-icon.svg) - -## What is Bonsai - SLEAP - -Bonsai.SLEAP is a [Bonsai](https://bonsai-rx.org/) interface for [SLEAP](https://sleap.ai/) allowing multi-animal, real-time, pose and identity estimation using pretrained network models stored in a [Protocol buffer (.pb) format](https://developers.google.com/protocol-buffers/). - -Bonsai.SLEAP loads these .pb files using [TensorFlowSharp](https://github.com/migueldeicaza/TensorFlowSharp), a set of .NET bindings for TensorFlow allowing native inference using either the CPU or GPU. By using the .pb file and the corresponding configuration file (`training_config.json`), the `PredictFullModelPose` operator from Bonsai.SLEAP will push the live image data through the inference network and output a set of identified poses from which you can extract an object id and specific object part position. `Bonsai` can then leverage this data to drive online effectors or simply save it to an output file. - -The Bonsai.SLEAP package came about following a fruitful discussion with the SLEAP team during the [Quantitative Approaches to Behaviour](http://cajal-training.org/on-site/qab2022). - -## How to install - -Bonsai.SLEAP can be downloaded through the Bonsai package manager. In order to get visualizer support, you should download both the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages. However, in order to use it for either CPU or GPU inference, you need to pair it with a compiled native TensorFlow binary. You can find precompiled binaries for Windows 64-bit at https://www.tensorflow.org/install/lang_c. - -To use GPU TensorFlow (highly recommended for live inference), you also need to install the `CUDA Toolkit` and the `cuDNN libraries`. The current SLEAP package was developed and tested with [CUDA v11.3](https://developer.nvidia.com/cuda-11.3.0-download-archive) and [cuDNN 8.2](https://developer.nvidia.com/cudnn). Additionally, make sure you have a CUDA [compatible GPU](https://docs.nvidia.com/deploy/cuda-compatibility/index.html#support-hardware) with the latest NVIDIA drivers. - -After downloading the native TensorFlow binary and cuDNN, you can follow these steps to get the required native files into the `Extensions` folder of your local Bonsai install: - -1. The easiest way to find your Bonsai install folder is to right-click on the Bonsai shortcut > Properties. The path to the folder will be shown in the "Start in" textbox; -2. Copy `tensorflow.dll` file from either the CPU or GPU [tensorflow release](https://www.tensorflow.org/install/lang_c#download_and_extract) to the `Extensions` folder; -3. If you are using TensorFlow GPU, make sure to add the `cuda/bin` folder of your cuDNN download to the `PATH` environment variable, or copy all DLL files to the `Extensions` folder. - -## SLEAP installation - -For all questions regarding installation of SLEAP, please check the official [docs](https://sleap.ai/). \ No newline at end of file diff --git a/docs/articles/manual.md b/docs/articles/manual.md index 85b6eb5..4f1afab 100644 --- a/docs/articles/manual.md +++ b/docs/articles/manual.md @@ -1,23 +1,42 @@ How to use ========== -`Bonsai.SLEAP` currently implements real-time inference on four distinct SLEAP networks through their corresponding Bonsai `Predict` operators. +`Bonsai.Sleap` currently implements real-time inference on four distinct SLEAP networks through their corresponding Bonsai `Predict` operators. -![SleapOperators](~/images/SleapSchematic.svg) +```mermaid +flowchart TD -In order to use the `Predict` operators, you will need to provide the `ModelFileName` to the exported .pb file folder containing your pre-trained SLEAP model, along with the corresponding `PoseConfigFileName` to the `training_config.json` file. +id1("`**IplImage**`") --> id7(Multiple Instances) + +id1 --> id8(Single Instance) + +id7 -- centroid --> id3("`**PredictCentroids** + +Returns multiple: +*Centroid*`") + +id7 -- top-down-model --> id4("`**PredictPoses** -The simplest Bonsai workflow for running the complete model will thus be: +Returns multiple: +*Centroid*, *Pose*`") -:::workflow -![PredictPoseIdentities](~/workflows/PredictPoseIdentities.bonsai) -::: -If everything works out, you should see some indication in the Bonsai command line window that the GPU was successfully detected and enabled. The first frame will cold start the inference graph and this may take a bit of time, but after that, your poses should start streaming through! +id7 -- top-down-id-model --> id5("`**PredictPoseIdentities** + +Returns multiple: +*Centroid*, *Pose*, *Identity*`") + +id8 -- single_instance --> id2("`**PredictSinglePose** + +Returns single: +*Pose*`") +``` + +In order to use the `Predict` operators, you will need to provide the `ModelFileName` to the exported .pb file folder containing your pre-trained SLEAP model, along with the corresponding `PoseConfigFileName` to the `training_config.json` file. -![Bonsai_Pipeline_expanded](~/images/demo.gif) +[!include[Introduction](~/articles/sleap-intro.md)] -Working examples for each of these operators can be found in the extended description for each operator, which we cover below. +Working examples for each of these operators can be found in the extended descriptions, which we cover below. ## PredictCentroids [!include[PredictCentroids](~/articles/sleap-predictcentroids.md)] diff --git a/docs/articles/sleap-intro.md b/docs/articles/sleap-intro.md new file mode 100644 index 0000000..fd396eb --- /dev/null +++ b/docs/articles/sleap-intro.md @@ -0,0 +1,13 @@ +--- +uid: sleap-intro +--- + +The simplest Bonsai workflow for running the complete SLEAP `top-down-id-model` is: + +:::workflow +![PredictPoseIdentities](~/workflows/PredictPoseIdentities.bonsai) +::: + +If everything works out, you should see some indication in the Bonsai command line window that the GPU was successfully detected and enabled. The first frame will cold start the inference graph and this may take a bit of time, but after that, your poses should start streaming through! + +![Bonsai_Pipeline_expanded](~/images/demo.gif) diff --git a/docs/articles/sleap-predictcentroids.md b/docs/articles/sleap-predictcentroids.md index 42a4a1a..d16df1c 100644 --- a/docs/articles/sleap-predictcentroids.md +++ b/docs/articles/sleap-predictcentroids.md @@ -3,7 +3,7 @@ uid: sleap-predictcentroids title: PredictCentroids --- -[`PredictCentroids`](xref:Bonsai.Sleap.PredictCentroids) implements the [*centroid* network](https://sleap.ai/develop/api/sleap.nn.config.model.html?highlight=centroid#sleap.nn.config.model.CentroidsHeadConfig). This operator is most commonly used to find a set of candidate centroids from a full-resolution image. For each frame, it will return a [`CentroidCollection`](xref:Bonsai.Sleap.CentroidCollection) that can be further indexed to access the individual instances. +[`PredictCentroids`](xref:Bonsai.Sleap.PredictCentroids) implements the [*centroid* network](https://sleap.ai/develop/api/sleap.nn.config.model.html?highlight=centroid#sleap.nn.config.model.CentroidsHeadConfig). This model is most commonly used to find a set of candidate centroids from a full-resolution image. For each frame, it will return a [`CentroidCollection`](xref:Bonsai.Sleap.CentroidCollection) which can be further indexed to access the individual instances. As an example application, the output of this operator is also fully compatible with the [`CropCenter`](xref:Bonsai.Vision.CropCenter) transform node, which can be used to easily generate smaller crops centered on the detected centroid instance (i.e. [`Centroid`](xref:Bonsai.Sleap.Centroid)) diff --git a/docs/articles/sleap-predictposeidentities.md b/docs/articles/sleap-predictposeidentities.md index 6b7086c..7cd7b80 100644 --- a/docs/articles/sleap-predictposeidentities.md +++ b/docs/articles/sleap-predictposeidentities.md @@ -3,8 +3,9 @@ uid: sleap-predictposeidentities title: PredictPoseIdentities --- -[`PredictPoseIdentities`](xref:Bonsai.Sleap.PredictPoseIdentities) evaluates the full SLEAP model network. In addition to extracting pose information for each detected instance in the image, it also returns the inferred identity of the object (i.e. it implements a [*top-down-id-model* network](https://sleap.ai/develop/api/sleap.nn.config.model.html#sleap.nn.config.model.MultiClassTopDownConfig). -In addition to the properties of the [`Pose`](xref:Bonsai.Sleap.Pose) object, the extended [`PoseIdentity`](xref:Bonsai.Sleap.PoseIdentity) class adds the [`Identity`](xref:Bonsai.Sleap.PoseIdentity.Identity) property that corresponds to the highest confidence identity. This will match one of the class labels found in `training_config.json`. +[`PredictPoseIdentities`](xref:Bonsai.Sleap.PredictPoseIdentities) evaluates the full SLEAP model network. In addition to extracting pose information for each detected instance in the image, it also returns the inferred identity of the object, i.e. it performs inference on the [*top-down-id-model* network](https://sleap.ai/develop/api/sleap.nn.config.model.html#sleap.nn.config.model.MultiClassTopDownConfig). + +In addition to the properties of the [`Pose`](xref:Bonsai.Sleap.Pose) object, the extended [`PoseIdentity`](xref:Bonsai.Sleap.PoseIdentity) class adds [`Identity`](xref:Bonsai.Sleap.PoseIdentity.Identity) property that indicates the highest confidence identity. This will match one of the class labels found in `training_config.json`. The [`IdentityScores`](xref:Bonsai.Sleap.PoseIdentity.IdentityScores) property indicates the confidence values for all class labels. Since we are very often only interested in the instance with the highest identification confidence we have added the operator [`GetMaximumConfidencePoseIdentity`](xref:Bonsai.Sleap.GetMaximumConfidencePoseIdentity) which returns the [`PoseIdentity`](xref:Bonsai.Sleap.PoseIdentity) with the highest confidence from the input [`PoseIdentityCollection`](xref:Bonsai.Sleap.PoseIdentityCollection). Moreover, by specifying a value in the optional [`Identity`](xref:Bonsai.Sleap.GetMaximumConfidencePoseIdentity.Identity) property, the operator will return the instance will the highest confidence for that particular class. diff --git a/docs/articles/sleap-predictsinglepose.md b/docs/articles/sleap-predictsinglepose.md index 6d85b76..2df9437 100644 --- a/docs/articles/sleap-predictsinglepose.md +++ b/docs/articles/sleap-predictsinglepose.md @@ -11,4 +11,4 @@ The following example workflow highlights how combining [basic computer-vision a ![SingleInstanceModel](~/workflows/SingleInstanceModel.bonsai) ::: -Finally, it is worth noting that [`PredictSinglePose`](xref:Bonsai.Sleap.PredictSinglePose) affords two input overloads. When receiving a single image it will output a corresponding [`Pose`](xref:Bonsai.Sleap.Pose). Since the operator skips the centroid-detection stage, it won't embed a [`Centroid`](xref:Bonsai.Sleap.Centroid) field in[`Pose`](xref:Bonsai.Sleap.Pose). Alternatively, a *batch* mode can be accessed by providing an array of images to the operator, instead returning [`PoseCollection`](xref:Bonsai.Sleap.PoseCollection). This latter overload results in dramatic performance gains relative to single images. +Finally, it is worth noting that [`PredictSinglePose`](xref:Bonsai.Sleap.PredictSinglePose) affords two input overloads. When receiving a single image it will output a corresponding [`Pose`](xref:Bonsai.Sleap.Pose). Since the operator skips the centroid-detection stage, it won't embed a [`Centroid`](xref:Bonsai.Sleap.Centroid) field in [`Pose`](xref:Bonsai.Sleap.Pose). Alternatively, a *batch* mode can be accessed by providing an array of images to the operator, instead returning [`PoseCollection`](xref:Bonsai.Sleap.PoseCollection). This latter overload results in dramatic performance gains relative to single images. diff --git a/docs/articles/toc.yml b/docs/articles/toc.yml index 65f0e7c..c007a63 100644 --- a/docs/articles/toc.yml +++ b/docs/articles/toc.yml @@ -1,6 +1,2 @@ -- name: Getting Started - items: - - name: Quickstart - href: intro.md - - name: How to use - href: manual.md \ No newline at end of file +- href: ../index.md +- href: manual.md \ No newline at end of file diff --git a/docs/assets b/docs/assets new file mode 160000 index 0000000..64f054a --- /dev/null +++ b/docs/assets @@ -0,0 +1 @@ +Subproject commit 64f054abf1c3ad10a0d171e31cd56d22be42da32 diff --git a/docs/bonsai b/docs/bonsai new file mode 160000 index 0000000..14246dc --- /dev/null +++ b/docs/bonsai @@ -0,0 +1 @@ +Subproject commit 14246dc307b918b68aa03232539a8f57318a4623 diff --git a/docs/build.ps1 b/docs/build.ps1 new file mode 100644 index 0000000..1915073 --- /dev/null +++ b/docs/build.ps1 @@ -0,0 +1,2 @@ +.\bonsai\modules\Export-Image.ps1 "..\src\Bonsai.Sleap.Design\bin\Release\net472" +dotnet docfx @args \ No newline at end of file diff --git a/docs/docfx.json b/docs/docfx.json index 897b2bd..cce946f 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -4,30 +4,26 @@ "src": [ { "files": [ - "Bonsai.Sleap*/*.csproj" + "**/*.csproj" ], "src": "../src" } ], "dest": "api", - "disableGitFeatures": false, - "disableDefaultFilter": false + "filter": "filter.yml" } ], "build": { "content": [ { "files": [ - "api/**.yml", - "api/index.md" - ] - }, - { - "files": [ - "articles/**.md", - "articles/**/toc.yml", - "toc.yml", - "*.md" + "**/*.{md,yml}" + ], + "exclude": [ + "_site/**", + "apidoc/**", + "bonsai/**", + "filter.yml" ] } ], @@ -35,38 +31,39 @@ { "files": [ "logo.svg", - "favicon.ico", + "favicon.ico" + ], + "src": "assets" + }, + { + "files": [ "images/**", "workflows/**" ] } ], + "output": "_site", "overwrite": [ { "files": [ "apidoc/**.md" - ], - "exclude": [ - "obj/**", - "_site/**" ] } ], - "globalMetadata": { - "_enableNewTab": true, - "_gitContribute": { - "branch": "main", - "apiSpecFolder": "docs/apidoc" - } - }, - "dest": "_site", - "globalMetadataFiles": [], - "fileMetadataFiles": [], "template": [ "default", - "templates/html" + "modern", + "bonsai/template", + "template" ], - "postProcessors": [ "ExtractSearchIndex" ], + "globalMetadata": { + "_appName": "Bonsai - SLEAP", + "_appTitle": "Bonsai.SLEAP", + "_enableNewTab": true, + "_enableSearch": true, + "pdf": false, + "_appFooter": "© 2024 Bonsai Foundation CIC and Contributors. Made with docfx" + }, "markdownEngineName": "markdig", "markdownEngineProperties": { "markdigExtensions": [ @@ -74,11 +71,6 @@ "customcontainers" ] }, - "noLangKeyword": false, - "keepFileLink": false, - "cleanupCacheHistory": false, - "disableGitFeatures": false, - "xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ], "xref": [ "https://horizongir.github.io/opencv.net/xrefmap.yml", "https://bonsai-rx.org/docs/xrefmap.yml" diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index 5387c2d..0000000 Binary files a/docs/favicon.ico and /dev/null differ diff --git a/docs/filter.yml b/docs/filter.yml new file mode 100644 index 0000000..3d3d6c9 --- /dev/null +++ b/docs/filter.yml @@ -0,0 +1,4 @@ +apiRules: +- exclude: + hasAttribute: + uid: System.ObsoleteAttribute \ No newline at end of file diff --git a/docs/images/SleapSchematic.svg b/docs/images/SleapSchematic.svg deleted file mode 100644 index ae94240..0000000 --- a/docs/images/SleapSchematic.svg +++ /dev/null @@ -1 +0,0 @@ -IplImageMultiple instances?YesNoPredictSinglePoseReturns single: PoseImplements: single_instancePredictCentroidsPredictPosesPredictPoseIdentitiesReturns multiple: CentroidImplements: centroidReturns multiple: Centroid PoseImplements: top-down-modelReturns multiple: Centroid Pose IdentityImplements: top-down-id-model \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 4c9d780..10c7c1d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,31 @@ ![logo](~/images/sleap-Bonsai-icon.svg) +Getting Started +=============== + Bonsai.SLEAP is a [Bonsai](https://bonsai-rx.org/) interface for [SLEAP](https://sleap.ai/) allowing multi-animal, real-time, pose and identity estimation using pretrained network models stored in a [Protocol buffer (.pb) format](https://developers.google.com/protocol-buffers/). Bonsai.SLEAP loads these .pb files using [TensorFlowSharp](https://github.com/migueldeicaza/TensorFlowSharp), a set of .NET bindings for TensorFlow allowing native inference using either the CPU or GPU. By using the .pb file and the corresponding configuration file (`training_config.json`), the `PredictFullModelPose` operator from Bonsai.SLEAP will push the live image data through the inference network and output a set of identified poses from which you can extract an object id and specific object part position. `Bonsai` can then leverage this data to drive online effectors or simply save it to an output file. -The Bonsai.SLEAP package came about following a fruitful discussion with the SLEAP team during the [Quantitative Approaches to Behaviour](http://cajal-training.org/on-site/qab2022). +## How to install + +Bonsai.SLEAP can be downloaded through the Bonsai package manager. In order to get visualizer support, you should download both the `Bonsai.Sleap` and `Bonsai.Sleap.Design` packages. However, in order to use it for either CPU or GPU inference, you need to pair it with a compiled native TensorFlow binary. You can find precompiled binaries for Windows 64-bit at https://www.tensorflow.org/install/lang_c. + +To use GPU TensorFlow (highly recommended for live inference), you also need to install the `CUDA Toolkit` and the `cuDNN libraries`. This package was developed and tested with [CUDA v11.3](https://developer.nvidia.com/cuda-11.3.0-download-archive) and [cuDNN 8.2](https://developer.nvidia.com/cudnn). Additionally, make sure you have a CUDA [compatible GPU](https://docs.nvidia.com/deploy/cuda-compatibility/index.html#support-hardware) with the latest NVIDIA drivers. + +After downloading the native TensorFlow binary and cuDNN, you can follow these steps to get the required native files into the `Extensions` folder of your local Bonsai install: + +1. The easiest way to find your Bonsai install folder is to right-click on the Bonsai shortcut > Properties. The path to the folder will be shown in the "Start in" textbox; +2. Copy `tensorflow.dll` file from either the CPU or GPU [tensorflow release](https://www.tensorflow.org/install/lang_c#download_and_extract) to the `Extensions` folder; +3. If you are using TensorFlow GPU, make sure to add the `cuda/bin` folder of your cuDNN download to the `PATH` environment variable, or copy all DLL files to the `Extensions` folder. + +> [!Tip] +> For all questions regarding installation and use of SLEAP for training models, please check the official [docs](https://sleap.ai/). + +## Simple example + +[!include[Introduction](~/articles/sleap-intro.md)] + +## Acknowledgments + +The Bonsai.SLEAP package came about following a fruitful discussion with the SLEAP team during the [Quantitative Approaches to Behaviour](http://cajal-training.org/on-site/qab2022). \ No newline at end of file diff --git a/docs/logo.svg b/docs/logo.svg deleted file mode 100644 index aaf57f7..0000000 --- a/docs/logo.svg +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/docs/template/public/main.css b/docs/template/public/main.css new file mode 100644 index 0000000..ee56505 --- /dev/null +++ b/docs/template/public/main.css @@ -0,0 +1 @@ +@import "workflow.css"; \ No newline at end of file diff --git a/docs/template/public/main.js b/docs/template/public/main.js new file mode 100644 index 0000000..3d70f6d --- /dev/null +++ b/docs/template/public/main.js @@ -0,0 +1,13 @@ +import WorkflowContainer from "./workflow.js" + +export default { + defaultTheme: 'auto', + iconLinks: [{ + icon: 'github', + href: 'https://github.com/bonsai-rx/sleap', + title: 'GitHub' + }], + start: () => { + WorkflowContainer.init(); + } +} \ No newline at end of file diff --git a/docs/templates/html/styles/main.css b/docs/templates/html/styles/main.css deleted file mode 100644 index e359389..0000000 --- a/docs/templates/html/styles/main.css +++ /dev/null @@ -1,101 +0,0 @@ -.affix { - height: auto; -} - -.sideaffix { - overflow-x: hidden; - overflow-y: auto; -} - -.affix > ul.level1 { - overflow: inherit; -} - -.affix ul > li.active > ul, -.affix ul > li.active > a:before, -.affix ul > li > a:hover:before { - display: block; - white-space: inherit; -} - -.workflow { - border: 1px solid #e3e3e3; - padding: 1px; -} - -.workflow > p > img { - padding-top: 12px; - padding-left: 12px; - padding-right: 12px; -} - -.codeHeader { - box-sizing: content-box; - background-color: #f2f2f2; - color: #171717; - display: flex; - flex-direction: row; - border: 1px solid #e3e3e3; - border-bottom: 0; - margin-top: 16px; - min-height: 30px; -} - -.codeHeader > .language { - padding: 2px 16px; - flex-grow: 1; - line-height: 26px; -} - -.codeHeader > .action { - position: relative; - padding: 2px 10px; - background-color: transparent; - border: 0 solid #e3e3e3; - border-left-width: 1px; - color: #171717; - cursor: pointer; - display: flex; - align-items: center; - line-height: normal; -} - -.codeHeader .glyphicon { - margin-right: 0.25em; -} - -.codeHeader > .action:hover { - background-color: #fafafa; -} - -.codeHeader + pre { - margin-top: 0; - border: 1px solid #e3e3e3; -} - -.codeHeader > .action .successful-copy-alert { - justify-content: center; - align-items: center; - right: 0; - left: 0; - bottom: 0; - top: 0; - position: absolute; - display: flex; - background-color: #128712; - outline-color: #fff; - color: #fff; -} - -.codeHeader > .action .successful-copy-alert.is-transparent { - opacity: 0; - transition: 500ms opacity ease-in-out; -} - -.diagram { - text-align: center; -} - -summary { - display: list-item; -} \ No newline at end of file diff --git a/docs/templates/html/styles/main.js b/docs/templates/html/styles/main.js deleted file mode 100644 index ecefbfc..0000000 --- a/docs/templates/html/styles/main.js +++ /dev/null @@ -1,61 +0,0 @@ -$(function() { - var createCodeHeader = function(text) { - return $( - '
'+ - ' '+ text +''+ - ' '+ - '
' - ); - } - - var setCopyAlert = function($element) { - var copyAlert = $element.find(".successful-copy-alert"); - copyAlert.removeClass("is-transparent"); - setTimeout(function() { - copyAlert.addClass("is-transparent"); - }, 2000); - } - - $("div.workflow").each(function() { - var workflowPath = undefined; - $(this).find("img").attr("src", (_, val) => { - workflowPath = val; - return workflowPath.replace(/\.[^.]+$/, ".svg"); - }); - var $codeHeader = createCodeHeader("Workflow"); - $(this).first().before($codeHeader); - $codeHeader.find("button").click(function() { - var $button = $(this); - fetch(workflowPath).then(req => req.text()).then(contents => { - navigator.clipboard.writeText(contents); - setCopyAlert($button); - }); - }); - }); - - $("code.hljs").each(function() { - var $this = $(this); - var language = /lang-(.+?)(\s|$)/.exec($this.attr("class"))[1].toUpperCase(); - if (language === 'CS' || language === 'CSHARP') { - language = "C#"; - } - if (language === 'JS') { - language = "JavaScript"; - } - var $codeHeader = createCodeHeader(language); - var $codeElement = $this.closest("pre"); - $codeElement.before($codeHeader); - $codeHeader.find("button").click(function() { - navigator.clipboard.writeText($codeElement.text()); - setCopyAlert($(this)); - }); - }); -}); \ No newline at end of file diff --git a/docs/workflows/.gitignore b/docs/workflows/.gitignore new file mode 100644 index 0000000..af455cb --- /dev/null +++ b/docs/workflows/.gitignore @@ -0,0 +1,2 @@ +*.layout +*.svg \ No newline at end of file diff --git a/docs/workflows/CentroidModel.svg b/docs/workflows/CentroidModel.svg deleted file mode 100644 index 61ae8cb..0000000 --- a/docs/workflows/CentroidModel.svg +++ /dev/null @@ -1,3 +0,0 @@ - -]>CropCenterNamePositionConfidenceImage,PositionIndexPredictCentroidsGrayscaleFileCapture \ No newline at end of file diff --git a/docs/workflows/FullTopDownModel.svg b/docs/workflows/FullTopDownModel.svg deleted file mode 100644 index be4d5aa..0000000 --- a/docs/workflows/FullTopDownModel.svg +++ /dev/null @@ -1,3 +0,0 @@ - -]>PositionLabelCentroidGetBodyPartGetMaximumConfidenceLabelPredictLabeledPosesGrayscaleFileCapture \ No newline at end of file diff --git a/docs/workflows/PredictPoseIdentities.svg b/docs/workflows/PredictPoseIdentities.svg deleted file mode 100644 index 4847604..0000000 --- a/docs/workflows/PredictPoseIdentities.svg +++ /dev/null @@ -1,3 +0,0 @@ - -]>PredictPoseIdentitiesGrayscaleFileCapture \ No newline at end of file diff --git a/docs/workflows/SingleInstanceModel.svg b/docs/workflows/SingleInstanceModel.svg deleted file mode 100644 index fa43872..0000000 --- a/docs/workflows/SingleInstanceModel.svg +++ /dev/null @@ -1,3 +0,0 @@ - -]>PositionCentroidGetBodyPartIndexPredictSinglePoseCropCenterZipBinaryRegionAnalysisFindContoursMorphologicalOperatorThresholdGrayscaleFileCapture \ No newline at end of file diff --git a/docs/workflows/TopDownNoIDModel.svg b/docs/workflows/TopDownNoIDModel.svg deleted file mode 100644 index 35376db..0000000 --- a/docs/workflows/TopDownNoIDModel.svg +++ /dev/null @@ -1,3 +0,0 @@ - -]>PositionCentroidGetBodyPartIndexPredictPosesGrayscaleFileCapture \ No newline at end of file