Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bonsai guide page to the SLEAP website #1785

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

shrivaths16
Copy link
Contributor

@shrivaths16 shrivaths16 commented May 29, 2024

Description

Currently we do not have a page that helps in understanding on how to use Bonsai and SLEAP together for analysis. So, adding a Bonsai guide page to the website for a guidance on using SLEAP models in Bonsai.

Types of changes

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (explain)

Does this address any currently open issues?

Outside contributors checklist

  • Review the guidelines for contributing to this repository
  • Read and sign the CLA and add yourself to the authors list
  • Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • Add tests that prove your fix is effective or that your feature works
  • Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

❤️

Summary by CodeRabbit

  • New Features

    • Introduced a new guide on using Bonsai with SLEAP, covering exporting trained models, installation, and usage for prediction and analysis.
  • Documentation

    • Added a section in the guides index for "SLEAP with Bonsai" to provide information on visual analysis using Bonsai.

Copy link

coderabbitai bot commented May 29, 2024

Walkthrough

The recent changes introduce a new branch trigger for the GitHub workflow and add comprehensive documentation for using Bonsai with SLEAP. The updates include a new guide on exporting SLEAP models, installing Bonsai, and employing Bonsai SLEAP modules for prediction and analysis, along with a new section in the documentation index.

Changes

File Change Summary
.github/workflows/website.yml Added a branch trigger shrivaths/bonsai-guide for paths docs/** and README.rst.
docs/guides/bonsai.md Introduced a guide on using Bonsai with SLEAP, covering model export, installation, and usage.
docs/guides/index.md Added a section titled "SLEAP with Bonsai" for visual analysis of trained SLEAP models.

Poem

In the code where branches grow,
A new trigger starts to show. 🌿
Bonsai and SLEAP now intertwine,
Predictions bloom, results align.
Docs updated, clear and bright,
Guiding coders day and night.
🌟 A garden of knowledge takes flight! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@shrivaths16 shrivaths16 requested a review from talmo June 5, 2024 02:39
@shrivaths16 shrivaths16 marked this pull request as ready for review June 5, 2024 15:49
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 834c68a and 4b798ce.

Files ignored due to path filters (1)
  • docs/_static/bonsai-workflow.jpg is excluded by !**/*.jpg
Files selected for processing (3)
  • .github/workflows/website.yml (1 hunks)
  • docs/guides/bonsai.md (1 hunks)
  • docs/guides/index.md (2 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/website.yml
Additional context used
LanguageTool
docs/guides/index.md

[uncategorized] ~19-~19: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...e project as your original training data and you want to correct some of the predict...


[uncategorized] ~21-~21: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...ough with the frame-by-frame predictions but you need to correct the identities trac...


[uncategorized] ~25-~25: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...ave a project with labeled training data and you'd like to run training or inference...


[uncategorized] ~27-~27: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...en you have a project with training data and you want to train on a different machin...


[uncategorized] ~31-~31: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...emote-inference` when you trained models and you want to run inference on a differen...


[style] ~31-~31: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing. (REP_WANT_TO_VB)
Context: ...erence` when you trained models and you want to run inference on a different machine us...


[style] ~35-~35: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing. (REP_WANT_TO_VB)
Context: ...EAP with Bonsai {ref}bonsai when you want to analyze the trained SLEAP model to visu...

docs/guides/bonsai.md

[style] ~12-~12: Consider a shorter alternative to avoid wordiness. (IN_ORDER_TO_PREMIUM)
Context: ...down and top-down-id SLEAP models. ::: In order to import the trained model into Bonsai, w...


[typographical] ~19-~19: Consider adding a comma here. (PLEASE_COMMA)
Context: ...exported_model ``` (for further details please refer {ref}sleap-export docs for more...


[uncategorized] ~27-~27: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...stallation.html). - Add the necessary packages including the Bonsai.SLEAP and `Bonsa...


[misspelling] ~33-~33: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’. (EN_A_VS_AN)
Context: ...application. - The workflow must have an source module FileCapture which can b...

Markdownlint
docs/guides/bonsai.md

36-36: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


37-37: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


25-25: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


31-31: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


15-15: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


49-49: null (MD047, single-trailing-newline)
Files should end with a single newline character

Additional comments not posted (2)
docs/guides/index.md (1)

33-36: The addition of the "SLEAP with Bonsai" section is clear and well-integrated into the existing structure.

Tools
LanguageTool

[style] ~35-~35: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing. (REP_WANT_TO_VB)
Context: ...EAP with Bonsai {ref}bonsai when you want to analyze the trained SLEAP model to visu...

docs/guides/bonsai.md (1)

43-47: The description and visualization of the Bonsai workflow are effectively presented.

Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::

In order to import the trained model into Bonsai, we need to export the model using the {code}`sleap-export` cli command to convert the trained model to a Protocol buffer(.pb) format. For example, for the top-down-id model, the command is as follows:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a more concise phrase to improve readability.

- In order to import the trained model into Bonsai, we need to export the model using the {code}`sleap-export` cli command to convert the trained model to a Protocol buffer(.pb) format.
+ To import the trained model into Bonsai, export it using the {code}`sleap-export` cli command to convert it to a Protocol buffer (.pb) format.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
In order to import the trained model into Bonsai, we need to export the model using the {code}`sleap-export` cli command to convert the trained model to a Protocol buffer(.pb) format. For example, for the top-down-id model, the command is as follows:
To import the trained model into Bonsai, export it using the {code}`sleap-export` cli command to convert it to a Protocol buffer (.pb) format. For example, for the top-down-id model, the command is as follows:

Comment on lines 25 to 27
- Install bonsai by following the instructions provided in their [installation page](https://bonsai-rx.org/docs/articles/installation.html).

- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct typographical issues for better readability.

- Install bonsai by following the instructions provided in their [installation page](https://bonsai-rx.org/docs/articles/installation.html). 
+ Install bonsai by following the instructions provided on their [installation page](https://bonsai-rx.org/docs/articles/installation.html).
- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules.
+ Add the necessary packages, including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages, for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- Install bonsai by following the instructions provided in their [installation page](https://bonsai-rx.org/docs/articles/installation.html).
- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).
- Install bonsai by following the instructions provided on their [installation page](https://bonsai-rx.org/docs/articles/installation.html).
- Add the necessary packages, including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages, for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).
Tools
LanguageTool

[uncategorized] ~27-~27: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...stallation.html). - Add the necessary packages including the Bonsai.SLEAP and `Bonsa...

Markdownlint

25-25: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces

Comment on lines 33 to 39
- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.

- For the top-down model,
- To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- To predict the instances, add the `PredictPoses` module and provide the path to the training config JSON file for the centered instance model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.

- For the top-down-id model, to predict the instances with identities, add `PredictPoseIdentities` module and provide the path to the training config JSON file for the top-down-id model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct markdown formatting issues to adhere to standards.

- - The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor.
+ - The workflow must have a source module `FileCapture` which can be found in the toolbox search in the workflow editor.
-     - To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
+   - To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
- For the top-down model,
- To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- To predict the instances, add the `PredictPoses` module and provide the path to the training config JSON file for the centered instance model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- For the top-down-id model, to predict the instances with identities, add `PredictPoseIdentities` module and provide the path to the training config JSON file for the top-down-id model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- The workflow must have a source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
- For the top-down model,
- To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- To predict the instances, add the `PredictPoses` module and provide the path to the training config JSON file for the centered instance model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- For the top-down-id model, to predict the instances with identities, add `PredictPoseIdentities` module and provide the path to the training config JSON file for the top-down-id model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
Tools
LanguageTool

[misspelling] ~33-~33: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’. (EN_A_VS_AN)
Context: ...application. - The workflow must have an source module FileCapture which can b...

Markdownlint

36-36: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


37-37: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation

Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::

In order to import the trained model into Bonsai, we need to export the model using the {code}`sleap-export` cli command to convert the trained model to a Protocol buffer(.pb) format. For example, for the top-down-id model, the command is as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to import the trained model into Bonsai, we need to export the model using the {code}`sleap-export` cli command to convert the trained model to a Protocol buffer(.pb) format. For example, for the top-down-id model, the command is as follows:
Before we can import a trained model into Bonsai, we need to use the {code}`sleap-export` command to convert the model to a format supported by Bonsai. For example, for the top-down-id model, the command is as follows:

Comment on lines 7 to 11
**Exporting a SLEAP trained model:**

:::{note}
Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flip flop

Suggested change
**Exporting a SLEAP trained model:**
:::{note}
Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::
:::{note}
Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::
**Exporting a SLEAP trained model:**

sleap-export -m centroid_model_folder_path -m top_down_id_model_folder_path exported_model
```

(for further details please refer {ref}`sleap-export` docs for more details.)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(for further details please refer {ref}`sleap-export` docs for more details.)
. Please refer to the {ref}`sleap-export` docs for more details on using the command.


(for further details please refer {ref}`sleap-export` docs for more details.)

This will generate the necessary `.pb` file and other information files to be used in Bonsai in the `exported_model` folder.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This will generate the necessary `.pb` file and other information files to be used in Bonsai in the `exported_model` folder.
This will generate the necessary `.pb` file and other information files required by Bonsai. In this example, these files were saved to the specified `exported_model` folder.

Comment on lines 25 to 27
- Install bonsai by following the instructions provided in their [installation page](https://bonsai-rx.org/docs/articles/installation.html).

- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Install bonsai by following the instructions provided in their [installation page](https://bonsai-rx.org/docs/articles/installation.html).
- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).
1. Install Bonsai. See the [Bonsai installation instructions](https://bonsai-rx.org/docs/articles/installation.html).
2. Download the necessary packages for Bonsai to run with SLEAP. See the official [Bonsai SLEAP documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap) for more information.


Bonsai is a visual language for reactive programming and currently supports SLEAP models.

**Exporting a SLEAP trained model:**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Exporting a SLEAP trained model:**
### Exporting a SLEAP trained model


This will generate the necessary `.pb` file and other information files to be used in Bonsai in the `exported_model` folder.

**Installing Bonsai and necessary packages:**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Installing Bonsai and necessary packages:**
### Installing Bonsai and necessary packages


- Add the necessary packages including the `Bonsai.SLEAP` and `Bonsai.SLEAP.Design` packages for SLEAP to run with Bonsai and to access the SLEAP-Bonsai modules. For more information on other dependency installations, please refer to the official [bonsai sleap documentation](https://github.com/bonsai-rx/sleap?tab=readme-ov-file#bonsai---sleap).

**Using Bonsai SLEAP modules:**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Using Bonsai SLEAP modules:**
### Using Bonsai SLEAP modules


**Using Bonsai SLEAP modules:**

Once you have Bonsai installed with the required packages, you should be able to open the bonsai application.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once you have Bonsai installed with the required packages, you should be able to open the bonsai application.
Once you have Bonsai installed with the required packages, you should be able to open the Bonsai application.

Comment on lines 35 to 37
- For the top-down model,
- To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- To predict the instances, add the `PredictPoses` module and provide the path to the training config JSON file for the centered instance model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of bullets, lets make each of these sections. Also maybe we can split up the long bullets into multiple sentences.

Suggested change
- For the top-down model,
- To predict the centroids, add the `PredictCentroid` module and provide the path to the training config JSON file for the centroid model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
- To predict the instances, add the `PredictPoses` module and provide the path to the training config JSON file for the centered instance model in the `ModelFileName` field and the path to the `exported_model` folder containing the `.pb` file in the `TrainingConfig` field of the module.
#### Top-down model
The top-down model requires both the `PredictCentroid` and the `PredictPoses` modules.
The `PredictCentroid` module will predict the centroids of detections. There are two fields inside the `PredictCentroid` module: the `ModelFileName` field and the `TrainingConfig` field. The `ModelFileName` field expects the path to the training config JSON file for the centroid model. The `TrainingConfig` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).
The `PredictPoses` module will predict the instances of detections. Similar to the `PredictCentroid` module, there are two fields inside the `PredictPoses` module: the `ModelFileName` field and the `TrainingConfig` field. The `ModelFileName` field expects the path to the training config JSON file for the centered instance model. The `TrainingConfig` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b798ce and 5d8de25.

Files selected for processing (1)
  • docs/guides/bonsai.md (1 hunks)
Additional context used
LanguageTool
docs/guides/bonsai.md

[misspelling] ~33-~33: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’. (EN_A_VS_AN)
Context: ...pplication. - The workflow must have an source module FileCapture which can b...

Markdownlint
docs/guides/bonsai.md

11-11: Expected: h2; Actual: h3 (MD001, heading-increment)
Heading levels should only increment by one level at a time


25-25: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


48-48: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


35-35: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


42-42: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


45-45: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


15-15: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


55-55: null (MD047, single-trailing-newline)
Files should end with a single newline character


Before we can import a trained model into Bonsai, we need to use the {code}`sleap-export` command to convert the model to a format supported by Bonsai. For example, for the top-down-id model, the command is as follows:

```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify the language for fenced code blocks.

- ```
+ ```bash
Tools
Markdownlint

15-15: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified

#### Single instance model:
The `PredictSinglePose` module will predict the poses for single instance models. This module also has two fields: the `ModelFileName` field and the `TrainingConfig` field. The `TrainingConfig` field expects the path to the training config JSON file for the single instance model. The `ModelFileName` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid multiple consecutive blank lines.

-

Committable suggestion was skipped due to low confidence.

Tools
Markdownlint

48-48: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines

Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::

### Exporting a SLEAP trained model:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure heading levels increment by one level at a time.

- ### Exporting a SLEAP trained model:
+ ## Exporting a SLEAP trained model:
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Exporting a SLEAP trained model:
## Exporting a SLEAP trained model:
Tools
Markdownlint

11-11: Expected: h2; Actual: h3 (MD001, heading-increment)
Heading levels should only increment by one level at a time


- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.

#### Top-down model:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure headings are surrounded by blank lines.

- The top-down model requires both the `PredictCentroid` and the `PredictPoses` modules.
+ 
+ The top-down model requires both the `PredictCentroid` and the `PredictPoses` modules.
+ 
- The `PredictPoseIdentities` module will predict the instances with identities.
+ 
+ The `PredictPoseIdentities` module will predict the instances with identities.
+ 
- The `PredictSinglePose` module will predict the poses for single instance models.
+ 
+ The `PredictSinglePose` module will predict the poses for single instance models.
+ 

Also applies to: 42-42, 45-45

Committable suggestion was skipped due to low confidence.

Tools
Markdownlint

35-35: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


Once you have Bonsai installed with the required packages, you should be able to open the Bonsai application.

- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct grammatical error in the article usage.

- The workflow must have an source module `FileCapture`
+ The workflow must have a source module `FileCapture`
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
- The workflow must have a source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
Tools
LanguageTool

[misspelling] ~33-~33: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’. (EN_A_VS_AN)
Context: ...pplication. - The workflow must have an source module FileCapture which can b...

@shrivaths16 shrivaths16 requested a review from roomrys June 7, 2024 03:04
Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::

### Exporting a SLEAP trained model:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the ":"

Suggested change
### Exporting a SLEAP trained model:
### Exporting a SLEAP trained model


### Exporting a SLEAP trained model:

Before we can import a trained model into Bonsai, we need to use the {code}`sleap-export` command to convert the model to a format supported by Bonsai. For example, for the top-down-id model, the command is as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For example, for the top-down-id model" is a bit weird sounding


Before we can import a trained model into Bonsai, we need to use the {code}`sleap-export` command to convert the model to a format supported by Bonsai. For example, for the top-down-id model, the command is as follows:

```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```bash

Before we can import a trained model into Bonsai, we need to use the {code}`sleap-export` command to convert the model to a format supported by Bonsai. For example, for the top-down-id model, the command is as follows:

```
sleap-export -m centroid_model_folder_path -m top_down_id_model_folder_path exported_model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emulate the path for paths:

Suggested change
sleap-export -m centroid_model_folder_path -m top_down_id_model_folder_path exported_model
sleap-export -m centroid/model/folder/path -m top_down_id/model/folder/path exported_model


Once you have Bonsai installed with the required packages, you should be able to open the Bonsai application.

- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make into paragraph


Once you have Bonsai installed with the required packages, you should be able to open the Bonsai application.

- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add screenshots of what FileCapture is and how to add it

#### Top-down model:
The top-down model requires both the `PredictCentroid` and the `PredictPoses` modules.

The `PredictCentroid` module will predict the centroids of detections. There are two fields inside the `PredictCentroid` module: the `ModelFileName` field and the `TrainingConfig` field. The `TrainingConfig` field expects the path to the training config JSON file for the centroid model. The `ModelFileName` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add screenshots of what PredictCentroid is and how to add it


The `PredictCentroid` module will predict the centroids of detections. There are two fields inside the `PredictCentroid` module: the `ModelFileName` field and the `TrainingConfig` field. The `TrainingConfig` field expects the path to the training config JSON file for the centroid model. The `ModelFileName` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).

The `PredictPoses` module will predict the instances of detections. Similar to the `PredictCentroid` module, there are two fields inside the `PredictPoses` module: the `ModelFileName` field and the `TrainingConfig` field. The `TrainingConfig` field expects the path to the training config JSON file for the centered instance model. The `ModelFileName` field expects the path to the `exported_model` folder (which contains the exported `.pb` file).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add screenshots of what PredictPoses is and how to add it


![Bonsai.SLEAP workflow](../_static/bonsai-workflow.jpg)

- Once you have the basic workflow for Bonsai.SLEAP created and running successfully, you can add more modules to analyze and visualize the results in Bonsai.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove bullet


- The workflow must have an source module `FileCapture` which can be found in the toolbox search in the workflow editor. Provide the path to the video that was used to train the SLEAP model in the `FileName` field of the module.

#### Top-down model:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the ":"

Suggested change
#### Top-down model:
#### Top-down model

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5d8de25 and f332499.

Files ignored due to path filters (5)
  • docs/_static/bonsai-connection.jpg is excluded by !**/*.jpg
  • docs/_static/bonsai-filecapture.jpg is excluded by !**/*.jpg
  • docs/_static/bonsai-predictcentroids.jpg is excluded by !**/*.jpg
  • docs/_static/bonsai-predictposeidentities.jpg is excluded by !**/*.jpg
  • docs/_static/bonsai-predictposes.jpg is excluded by !**/*.jpg
Files selected for processing (1)
  • docs/guides/bonsai.md (1 hunks)
Additional context used
LanguageTool
docs/guides/bonsai.md

[grammar] ~66-~66: The verb “Right-click” is spelled with a hyphen. (CLICK_HYPHEN)
Context: ...thfolder. ### Connecting the modules Right click on theFileCapture` module and select ...


[uncategorized] ~75-~75: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...e green start button to run the workflow and you can add more modules to analyze and...

Markdownlint
docs/guides/bonsai.md

11-11: Expected: h2; Actual: h3 (MD001, heading-increment)
Heading levels should only increment by one level at a time


35-35: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


67-67: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


47-47: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


58-58: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


63-63: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


66-66: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


25-25: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


77-77: null (MD047, single-trailing-newline)
Files should end with a single newline character


The `exported/model/path` folder will have a structure like the following:

```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify the language for fenced code blocks.

- ```
+ ```plaintext
Tools
Markdownlint

25-25: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified

Currently Bonsai supports only single instance, top-down and top-down-id SLEAP models.
:::

### Exporting a SLEAP trained model
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure heading levels increment by one level at a time.

- ### Exporting a SLEAP trained model
+ ## Exporting a SLEAP trained model
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Exporting a SLEAP trained model
## Exporting a SLEAP trained model
Tools
Markdownlint

11-11: Expected: h2; Actual: h3 (MD001, heading-increment)
Heading levels should only increment by one level at a time


![Bonsai FileCapture module](../_static/bonsai-filecapture.jpg)

#### Top-down model
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure headings are surrounded by blank lines.

- The top-down model requires both the `PredictCentroids` and the `PredictPoses` modules.
+ 
+ The top-down model requires both the `PredictCentroids` and the `PredictPoses` modules.
+ 
- The `PredictPoseIdentities` module will predict the instances with identities.
+ 
+ The `PredictPoseIdentities` module will predict the instances with identities.
+ 
- The `PredictSinglePose` module will predict the poses for single instance models.
+ 
+ The `PredictSinglePose` module will predict the poses for single instance models.
+ 
- Right click on the `FileCapture` module and select **Create Connection**. Now click on the required SLEAP module to complete the connection.
+ 
+ Right click on the `FileCapture` module and select **Create Connection**. Now click on the required SLEAP module to complete the connection.
+ 

Also applies to: 58-58, 63-63, 66-66

Committable suggestion was skipped due to low confidence.

Tools
Markdownlint

47-47: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


![Bonsai.SLEAP workflow](../_static/bonsai-workflow.jpg)

Now you can click the green start button to run the workflow and you can add more modules to analyze and visualize the results in Bonsai.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a comma before 'and' in a compound sentence.

- Now you can click the green start button to run the workflow and you can add more modules to analyze and visualize the results in Bonsai.
+ Now you can click the green start button to run the workflow, and you can add more modules to analyze and visualize the results in Bonsai.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
Now you can click the green start button to run the workflow and you can add more modules to analyze and visualize the results in Bonsai.
Now you can click the green start button to run the workflow, and you can add more modules to analyze and visualize the results in Bonsai.
Tools
LanguageTool

[uncategorized] ~75-~75: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE)
Context: ...e green start button to run the workflow and you can add more modules to analyze and...

#### Single instance model
The `PredictSinglePose` module will predict the poses for single instance models. This module also has two fields: the `ModelFileName` field and the `TrainingConfig` field. The `TrainingConfig` field expects the path to the training config JSON file for the single instance model. The `ModelFileName` field expects the path to the `frozen_graph.pb` file in the `exported/model/path` folder.

### Connecting the modules
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the spelling of "Right-click".

- Right click on the `FileCapture` module and select **Create Connection**.
+ Right-click on the `FileCapture` module and select **Create Connection**.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Connecting the modules
### Connecting the modules
Right-click on the `FileCapture` module and select **Create Connection**.
Tools
LanguageTool

[grammar] ~66-~66: The verb “Right-click” is spelled with a hyphen. (CLICK_HYPHEN)
Context: ...thfolder. ### Connecting the modules Right click on theFileCapture` module and select ...

Markdownlint

66-66: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines


Now you can click the green start button to run the workflow and you can add more modules to analyze and visualize the results in Bonsai.

For more documentation on various modules and workflows, please refer to the [official Bonsai docs](https://bonsai-rx.org/docs/articles/editor.html).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the file ends with a single newline character.

+ 
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
For more documentation on various modules and workflows, please refer to the [official Bonsai docs](https://bonsai-rx.org/docs/articles/editor.html).
For more documentation on various modules and workflows, please refer to the [official Bonsai docs](https://bonsai-rx.org/docs/articles/editor.html).
Tools
Markdownlint

77-77: null (MD047, single-trailing-newline)
Files should end with a single newline character


### Installing Bonsai and necessary packages

1. Install Bonsai. See the [Bonsai installation instructions](https://bonsai-rx.org/docs/articles/installation.html).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

- 1. Install Bonsai. See the [Bonsai installation instructions](https://bonsai-rx.org/docs/articles/installation.html). 
+ 1. Install Bonsai. See the [Bonsai installation instructions](https://bonsai-rx.org/docs/articles/installation.html).

- Right click on the `FileCapture` module and select **Create Connection**. Now click on the required SLEAP module to complete the connection. 
+ Right click on the `FileCapture` module and select **Create Connection**. Now click on the required SLEAP module to complete the connection.

Also applies to: 67-67

Committable suggestion was skipped due to low confidence.

Tools
Markdownlint

35-35: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces

Copy link
Collaborator

@roomrys roomrys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just remove branch name from the website workflow

@@ -9,6 +9,7 @@ on:
- main
- develop
- fakebranch
- shrivaths/bonsai-guide
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- shrivaths/bonsai-guide

@roomrys roomrys mentioned this pull request Jun 13, 2024
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants