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 Keep visualizations checkbox to training GUI #1824

Merged
merged 15 commits into from
Jul 10, 2024

Conversation

hajin-park
Copy link
Contributor

@hajin-park hajin-park commented Jun 23, 2024

Description

This PR clarifies the use of the Visualize Predictions During Training checkbox by adding a new Keep Prediction Visualization Images After Training checkbox to the training config GUI. If training visualization images are enabled, the images are deleted after training by default unless the new checkbox is enabled (checked).

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 --keep_viz argument to retain prediction visualization images after training.
    • Renamed --save_viz argument to --view_viz.
    • Added --delete_viz argument for deleting visualization images after training.
  • Tests

    • Added test test_keep_viz_cli to check the functionality of the --keep_viz option.
    • Updated tests to check visualization paths and save directories.

Copy link

codecov bot commented Jun 23, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 74.13%. Comparing base (7ed1229) to head (33c9d62).
Report is 20 commits behind head on develop.

Files Patch % Lines
sleap/gui/learning/runners.py 0.00% 3 Missing ⚠️
sleap/nn/training.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1824      +/-   ##
===========================================
+ Coverage    73.30%   74.13%   +0.82%     
===========================================
  Files          134      135       +1     
  Lines        24087    24577     +490     
===========================================
+ Hits         17658    18221     +563     
+ Misses        6429     6356      -73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…sed del_viz_predictions config option to the user
…sed del_viz_predictions config option to the user
@talmolab talmolab deleted a comment from coderabbitai bot Jun 23, 2024
@hajin-park hajin-park changed the title Resolve save_visualizations naming clarity issues Add Delete Visualizations checkbox and resolve save_visualizations naming clarity Jun 23, 2024
@hajin-park hajin-park changed the title Add Delete Visualizations checkbox and resolve save_visualizations naming clarity Add Delete Visualizations checkbox and resolve save_visualizations naming clarity Jun 23, 2024
coderabbitai[bot]

This comment was marked as off-topic.

This comment was marked as outdated.

@gitttt-1234
Copy link
Contributor

From subgroup:

  • Keep it named save_visualizations
  • Add checkbox to GUI labeled "Keep visualization images after training" with a default value of off (unchecked)

@hajin-park hajin-park changed the title Add Delete Visualizations checkbox and resolve save_visualizations naming clarity Add Keep visualizations checkbox Jun 30, 2024
@hajin-park hajin-park changed the title Add Keep visualizations checkbox Add Keep visualizations checkbox to training GUI Jul 1, 2024
@talmolab talmolab deleted a comment from coderabbitai bot Jul 1, 2024
@hajin-park
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Jul 1, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 5

Outside diff range and nitpick comments (17)
sleap/config/pipeline_form.yaml (3)

Line range hint 55-55: Remove trailing spaces.

Trailing spaces detected. Remove the trailing spaces to adhere to YAML formatting standards.

-  default: "multi-animal bottom-up "
+  default: "multi-animal bottom-up"
-  default: 9000 
+  default: 9000
-  default: 0.95 
+  default: 0.95

Also applies to: 220-220, 391-391


Line range hint 422-422: Fix wrong indentation.

Incorrect indentation detected. Adjust the indentation to match the expected level.

-    default: false
+  default: false
-    default: 10
+  default: 10

Also applies to: 506-506


Line range hint 569-569: Reduce blank lines.

Too many blank lines detected. Reduce the number of blank lines to adhere to YAML formatting standards.

-

docs/guides/cli.md (2)

Line range hint 253-253: Correct the verb form.

The verb "merged" should be in its base form "merge".

- `labels_with_predictions.slp` can then merged into the base labels project from the SLEAP GUI via **File** --> **Merge into project...**.
+ `labels_with_predictions.slp` can then merge into the base labels project from the SLEAP GUI via **File** --> **Merge into project...**.

Line range hint 333-333: Correct article usage.

The plural noun "predictions" should not be used with the article "a".

- For example, to convert a predictions SLP file to an analysis HDF5 file:
+ For example, to convert predictions SLP file to an analysis HDF5 file:
sleap/gui/learning/runners.py (9)

Line range hint 50-50: Replace deprecated type Text with str.

The type Text is deprecated and should be replaced with str.

- def path(self) -> Text:
+ def path(self) -> str:

Line range hint 55-55: Replace deprecated type Text with str.

The type Text is deprecated and should be replaced with str.

- def cli_args(self) -> List[Text]:
+ def cli_args(self) -> List[str]:

Line range hint 200-200: Replace deprecated type Text with str.

The type Text is deprecated and should be replaced with str.

- def path(self) -> Text:
+ def path(self) -> str:

Line range hint 254-255: Simplify nested if statements.

Use a single if statement instead of nested if statements.

- if self.frame_filter == "user":
-     args_list.append("--only-labeled-frames")
- elif self.frame_filter == "suggested":
-     args_list.append("--only-suggested-frames")
+ if self.frame_filter in ["user", "suggested"]:
+     args_list.append(f"--only-{self.frame_filter}-frames")

Line range hint 288-288: Replace deprecated type Text with str.

The type Text is deprecated and should be replaced with str.

- def make_predict_cli_call(
+ def make_predict_cli_call(
- ) -> List[Text]:
+ ) -> List[str]:

Line range hint 312-312: Avoid bare except statements.

Specify the exception type to avoid catching unintended exceptions.

- except:
+ except Exception:

Line range hint 669-669: Remove extraneous f prefix from string.

The f prefix is used for strings that need formatting. Remove it where not necessary.

- win.set_message(f"Preparing to run training...")
+ win.set_message("Preparing to run training...")

Line range hint 799-799: Function definition does not bind loop variable i.

Ensure that the loop variable i is bound within the function definition.

- for i, item_for_inference in enumerate(items_for_inference.items):
+ for i, item_for_inference in enumerate(items_for_inference.items):
+     def waiting_item(**kwargs):
+         kwargs["current_item"] = i
+         kwargs["total_items"] = len(items_for_inference.items)
+         return waiting(**kwargs)

Line range hint 841-841: Remove assignment to unused variable success.

The assignment to the variable success is not used and should be removed.

- success = False
sleap/nn/training.py (3)

Line range hint 16-16: Remove unused import.

The import cattr is not used in the code.

- import cattr

Line range hint 79-79: Remove unused import.

The import plot_pafs from sleap.nn.viz is not used in the code.

- from sleap.nn.viz import plot_confmaps, plot_img, plot_pafs, plot_peaks
+ from sleap.nn.viz import plot_confmaps, plot_img, plot_peaks

Line range hint 106-109: Replace deprecated Text annotation with str.

The Text annotation from typing is deprecated. Replace it with str.

- from typing import Callable, List, Optional, Text, TypeVar, Union
+ from typing import Callable, List, Optional, TypeVar, Union

- def get_timestamp() -> Text:
+ def get_timestamp() -> str:

- def setup_new_run_folder(config: OutputsConfig, base_run_name: Optional[Text] = None) -> Text:
+ def setup_new_run_folder(config: OutputsConfig, base_run_name: Optional[str] = None) -> str:

- def setup_checkpointing(config: CheckpointingConfig, run_path: Text) -> List[tf.keras.callbacks.Callback]:
+ def setup_checkpointing(config: CheckpointingConfig, run_path: str) -> List[tf.keras.callbacks.Callback]:

- def setup_tensorboard(config: TensorBoardConfig, run_path: Text) -> List[tf.keras.callbacks.Callback]:
+ def setup_tensorboard(config: TensorBoardConfig, run_path: str) -> List[tf.keras.callbacks.Callback]:

- def setup_output_callbacks(config: OutputsConfig, run_path: Optional[Text] = None) -> List[tf.keras.callbacks.Callback]:
+ def setup_output_callbacks(config: OutputsConfig, run_path: Optional[str] = None) -> List[tf.keras.callbacks.Callback]:

- def setup_visualization(config: OutputsConfig, run_path: Text, viz_fn: Callable[[], matplotlib.figure.Figure], name: Text) -> List[tf.keras.callbacks.Callback]:
+ def setup_visualization(config: OutputsConfig, run_path: str, viz_fn: Callable[[], matplotlib.figure.Figure], name: str) -> List[tf.keras.callbacks.Callback]:

- def sanitize_scope_name(name: Text) -> Text:
+ def sanitize_scope_name(name: str) -> str:

- run_path: Optional[Text] = attr.ib(default=None, init=False)
+ run_path: Optional[str] = attr.ib(default=None, init=False)

- def cleanup(self):
+ def cleanup(self) -> None:

- def package(self):
+ def package(self) -> None:

- def visualize_example(example):
+ def visualize_example(example) -> matplotlib.figure.Figure:

- def visualize_confmaps_example(example):
+ def visualize_confmaps_example(example) -> matplotlib.figure.Figure:

- def visualize_pafs_example(example):
+ def visualize_pafs_example(example) -> matplotlib.figure.Figure:

- def visualize_class_maps_example(example):
+ def visualize_class_maps_example(example) -> matplotlib.figure.Figure:

- def main(args: Optional[List] = None):
+ def main(args: Optional[List] = None) -> None:

Also applies to: 132-132, 134-134, 138-138, 156-159, 308-308, 358-358, 364-365, 416-416, 464-464, 485-485, 503-503, 505-505, 539-539, 613-613, 619-622, 904-904, 907-907, 909-909, 911-911, 913-913, 915-915, 917-917, 926-926, 932-932, 1056-1056, 1061-1061, 1112-1112, 1120-1120, 1169-1169, 1174-1174, 1216-1216, 1224-1224, 1289-1289, 1294-1294, 1405-1405, 1410-1410, 1470-1470, 1478-1478, 1488-1488, 1496-1496, 1546-1546, 1551-1551, 1608-1608, 1616-1616, 1625-1625, 1635-1635, 1699-1699, 1704-1704

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 22733f1 and c75a0ef.

Files selected for processing (29)
  • docs/guides/cli.md (2 hunks)
  • docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb (2 hunks)
  • sleap/config/pipeline_form.yaml (1 hunks)
  • sleap/gui/learning/runners.py (9 hunks)
  • sleap/nn/config/outputs.py (2 hunks)
  • sleap/nn/training.py (4 hunks)
  • sleap/training_profiles/baseline.centroid.json (1 hunks)
  • sleap/training_profiles/baseline_large_rf.bottomup.json (1 hunks)
  • sleap/training_profiles/baseline_large_rf.single.json (1 hunks)
  • sleap/training_profiles/baseline_large_rf.topdown.json (1 hunks)
  • sleap/training_profiles/baseline_medium_rf.bottomup.json (1 hunks)
  • sleap/training_profiles/baseline_medium_rf.single.json (1 hunks)
  • sleap/training_profiles/baseline_medium_rf.topdown.json (1 hunks)
  • sleap/training_profiles/pretrained.bottomup.json (1 hunks)
  • sleap/training_profiles/pretrained.centroid.json (1 hunks)
  • sleap/training_profiles/pretrained.single.json (1 hunks)
  • sleap/training_profiles/pretrained.topdown.json (1 hunks)
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/initial_config.json (1 hunks)
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/training_config.json (1 hunks)
  • tests/data/models/min_tracks_2node.UNet.topdown_multiclass/initial_config.json (1 hunks)
  • tests/data/models/min_tracks_2node.UNet.topdown_multiclass/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.bottomup/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.bottomup/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centered_instance/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centered_instance/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centroid/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centroid/training_config.json (1 hunks)
  • tests/data/models/minimal_robot.UNet.single_instance/initial_config.json (1 hunks)
  • tests/data/models/minimal_robot.UNet.single_instance/training_config.json (1 hunks)
Files skipped from review due to trivial changes (9)
  • sleap/training_profiles/baseline_large_rf.bottomup.json
  • sleap/training_profiles/baseline_large_rf.topdown.json
  • sleap/training_profiles/baseline_medium_rf.bottomup.json
  • sleap/training_profiles/pretrained.topdown.json
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/initial_config.json
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/training_config.json
  • tests/data/models/min_tracks_2node.UNet.topdown_multiclass/initial_config.json
  • tests/data/models/minimal_instance.UNet.centroid/initial_config.json
  • tests/data/models/minimal_robot.UNet.single_instance/training_config.json
Additional context used
Ruff
sleap/nn/config/outputs.py

66-66: typing.Text is deprecated, use str

Replace with str

(UP019)


106-106: typing.Text is deprecated, use str

Replace with str

(UP019)


109-109: typing.Text is deprecated, use str

Replace with str

(UP019)


167-167: typing.Text is deprecated, use str

Replace with str

(UP019)


168-168: typing.Text is deprecated, use str

Replace with str

(UP019)


169-169: typing.Text is deprecated, use str

Replace with str

(UP019)


170-170: typing.Text is deprecated, use str

Replace with str

(UP019)


171-171: typing.Text is deprecated, use str

Replace with str

(UP019)


181-181: typing.Text is deprecated, use str

Replace with str

(UP019)

sleap/gui/learning/runners.py

22-22: sleap.io.video.SingleImageVideo imported but unused

Remove unused import: sleap.io.video.SingleImageVideo

(F401)


50-50: typing.Text is deprecated, use str

Replace with str

(UP019)


55-55: typing.Text is deprecated, use str

Replace with str

(UP019)


200-200: typing.Text is deprecated, use str

Replace with str

(UP019)


254-255: Use a single if statement instead of nested if statements

(SIM102)


288-288: typing.Text is deprecated, use str

Replace with str

(UP019)


312-312: Do not use bare except

(E722)


594-594: typing.Text is deprecated, use str

Replace with str

(UP019)


594-594: typing.Text is deprecated, use str

Replace with str

(UP019)


669-669: f-string without any placeholders

Remove extraneous f prefix

(F541)


799-799: Function definition does not bind loop variable i

(B023)


833-833: typing.Text is deprecated, use str

Replace with str

(UP019)


841-841: Local variable success is assigned to but never used

Remove assignment to unused variable success

(F841)


888-891: Use ternary operator ret = "success" if proc.returncode == 0 else proc.returncode instead of if-else-block

Replace if-else-block with ret = "success" if proc.returncode == 0 else proc.returncode

(SIM108)

sleap/nn/training.py

16-16: cattr imported but unused

Remove unused import: cattr

(F401)


79-79: sleap.nn.viz.plot_pafs imported but unused

Remove unused import: sleap.nn.viz.plot_pafs

(F401)


106-106: typing.Text is deprecated, use str

Replace with str

(UP019)


107-107: typing.Text is deprecated, use str

Replace with str

(UP019)


108-108: typing.Text is deprecated, use str

Replace with str

(UP019)


109-109: typing.Text is deprecated, use str

Replace with str

(UP019)


132-132: typing.Text is deprecated, use str

Replace with str

(UP019)


134-134: typing.Text is deprecated, use str

Replace with str

(UP019)


138-138: typing.Text is deprecated, use str

Replace with str

(UP019)


156-156: typing.Text is deprecated, use str

Replace with str

(UP019)


157-157: typing.Text is deprecated, use str

Replace with str

(UP019)


158-158: typing.Text is deprecated, use str

Replace with str

(UP019)


159-159: typing.Text is deprecated, use str

Replace with str

(UP019)


308-308: typing.Text is deprecated, use str

Replace with str

(UP019)


358-358: typing.Text is deprecated, use str

Replace with str

(UP019)


364-364: typing.Text is deprecated, use str

Replace with str

(UP019)


365-365: typing.Text is deprecated, use str

Replace with str

(UP019)


416-416: typing.Text is deprecated, use str

Replace with str

(UP019)


464-464: typing.Text is deprecated, use str

Replace with str

(UP019)


485-485: typing.Text is deprecated, use str

Replace with str

(UP019)


503-503: typing.Text is deprecated, use str

Replace with str

(UP019)


505-505: typing.Text is deprecated, use str

Replace with str

(UP019)


539-539: typing.Text is deprecated, use str

Replace with str

(UP019)


539-539: typing.Text is deprecated, use str

Replace with str

(UP019)


613-613: typing.Text is deprecated, use str

Replace with str

(UP019)


619-619: typing.Text is deprecated, use str

Replace with str

(UP019)


620-620: typing.Text is deprecated, use str

Replace with str

(UP019)


621-621: typing.Text is deprecated, use str

Replace with str

(UP019)


622-622: typing.Text is deprecated, use str

Replace with str

(UP019)


904-904: f-string without any placeholders

Remove extraneous f prefix

(F541)


907-907: f-string without any placeholders

Remove extraneous f prefix

(F541)


909-909: f-string without any placeholders

Remove extraneous f prefix

(F541)


911-911: f-string without any placeholders

Remove extraneous f prefix

(F541)


913-913: f-string without any placeholders

Remove extraneous f prefix

(F541)


915-915: f-string without any placeholders

Remove extraneous f prefix

(F541)


917-917: f-string without any placeholders

Remove extraneous f prefix

(F541)


926-926: f-string without any placeholders

Remove extraneous f prefix

(F541)


932-932: f-string without any placeholders

Remove extraneous f prefix

(F541)


1056-1056: typing.Text is deprecated, use str

Replace with str

(UP019)


1061-1061: typing.Text is deprecated, use str

Replace with str

(UP019)


1112-1112: f-string without any placeholders

Remove extraneous f prefix

(F541)


1120-1120: f-string without any placeholders

Remove extraneous f prefix

(F541)


1169-1169: typing.Text is deprecated, use str

Replace with str

(UP019)


1174-1174: typing.Text is deprecated, use str

Replace with str

(UP019)


1216-1216: f-string without any placeholders

Remove extraneous f prefix

(F541)


1224-1224: f-string without any placeholders

Remove extraneous f prefix

(F541)


1289-1289: typing.Text is deprecated, use str

Replace with str

(UP019)


1294-1294: typing.Text is deprecated, use str

Replace with str

(UP019)


1405-1405: typing.Text is deprecated, use str

Replace with str

(UP019)


1410-1410: typing.Text is deprecated, use str

Replace with str

(UP019)


1470-1470: f-string without any placeholders

Remove extraneous f prefix

(F541)


1478-1478: f-string without any placeholders

Remove extraneous f prefix

(F541)


1488-1488: f-string without any placeholders

Remove extraneous f prefix

(F541)


1496-1496: f-string without any placeholders

Remove extraneous f prefix

(F541)


1546-1546: typing.Text is deprecated, use str

Replace with str

(UP019)


1551-1551: typing.Text is deprecated, use str

Replace with str

(UP019)


1608-1608: f-string without any placeholders

Remove extraneous f prefix

(F541)


1616-1616: f-string without any placeholders

Remove extraneous f prefix

(F541)


1625-1625: f-string without any placeholders

Remove extraneous f prefix

(F541)


1635-1635: f-string without any placeholders

Remove extraneous f prefix

(F541)


1699-1699: typing.Text is deprecated, use str

Replace with str

(UP019)


1704-1704: typing.Text is deprecated, use str

Replace with str

(UP019)

yamllint
sleap/config/pipeline_form.yaml

[error] 55-55: trailing spaces

(trailing-spaces)


[error] 220-220: trailing spaces

(trailing-spaces)


[error] 391-391: trailing spaces

(trailing-spaces)


[warning] 422-422: wrong indentation: expected 2 but found 4

(indentation)


[warning] 506-506: wrong indentation: expected 2 but found 4

(indentation)


[warning] 569-569: too many blank lines

(4 > 2) (empty-lines)

LanguageTool
docs/guides/cli.md

[typographical] ~120-~120: Consider adding a comma.
Context: ...ook. If you specify how many identities there should be in a frame (i.e., the number ...

(IF_THERE_COMMA)


[misspelling] ~241-~241: This word is normally spelled as one.
Context: ...put_video.mp4" **2. Inference with multi-model pipelines (e.g., top-down):** none ...

(EN_COMPOUNDS_MULTI_MODEL)


[grammar] ~253-~253: The modal verb ‘can’ requires the verb’s base form.
Context: ... labels_with_predictions.slp can then merged into the base labels project from the S...

(MD_BASEFORM)


[style] ~291-~291: The preposition ‘Amongst’ is correct, but some people think that it is old-fashioned or literary. A more frequently used alternative is the preposition “among”.
Context: ...t between various dataset file formats. Amongst other things, it can be used to export ...

(AMONGST)


[grammar] ~333-~333: The plural noun “predictions” cannot be used with the article “a”. Did you mean “a prediction” or “predictions”?
Context: ...nversion). For example, to convert a predictions SLP file to an analysis HDF5 file: ...

(A_NNS)


[style] ~345-~345: Consider using a different verb to strengthen your wording.
Context: ... sleap-inspect {code}sleap-inspect gives you various information about a SLEAP d...

(GIVE_INFORMATION)


[uncategorized] ~345-~345: Possible missing comma found.
Context: ...rious information about a SLEAP dataset file such as a list of videos and a count of...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~406-~406: Possible missing comma found.
Context: ...re's also a script to output diagnostic information which may help us if you need to contac...

(AI_HYDRA_LEO_MISSING_COMMA)

Markdownlint
docs/guides/cli.md

233-233: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


335-335: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Gitleaks
docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb

99-99: Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.

(aws-access-token)


100-100: Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.

(aws-access-token)

Additional comments not posted (42)
sleap/training_profiles/pretrained.single.json (1)

116-116: Addition of keep_viz_images key.

The new key keep_viz_images has been added to the outputs section. Ensure that this key is consistently used across all relevant configuration files and that its default value aligns with the intended behavior.

sleap/training_profiles/pretrained.centroid.json (1)

116-116: Addition of keep_viz_images key.

The new key keep_viz_images has been added to the outputs section. Ensure that this key is consistently used across all relevant configuration files and that its default value aligns with the intended behavior.

sleap/training_profiles/baseline_medium_rf.single.json (1)

119-119: Addition of keep_viz_images key.

The new key keep_viz_images has been added to the outputs section. Ensure that this key is consistently used across all relevant configuration files and that its default value aligns with the intended behavior.

sleap/training_profiles/baseline_large_rf.single.json (1)

119-119: Addition of keep_viz_images key.

The new key keep_viz_images has been added to the outputs section. Ensure that this key is consistently used across all relevant configuration files and that its default value aligns with the intended behavior.

tests/data/models/minimal_robot.UNet.single_instance/initial_config.json (1)

123-123: Addition of keep_viz_images parameter looks good.

The keep_viz_images parameter has been correctly added to the configuration. Ensure consistency across all related configuration files.

sleap/training_profiles/baseline.centroid.json (1)

119-119: Addition of keep_viz_images parameter looks good.

The keep_viz_images parameter has been correctly added to the configuration. Ensure consistency across all related configuration files.

tests/data/models/minimal_instance.UNet.centered_instance/initial_config.json (1)

122-122: Addition of keep_viz_images parameter looks good.

The keep_viz_images parameter has been correctly added to the configuration. Ensure consistency across all related configuration files.

sleap/training_profiles/baseline_medium_rf.topdown.json (1)

120-120: Addition of keep_viz_images parameter looks good.

The keep_viz_images parameter has been correctly added to the configuration. Ensure consistency across all related configuration files.

sleap/training_profiles/pretrained.bottomup.json (1)

125-125: Addition of keep_viz_images parameter.

The parameter keep_viz_images has been added to the "outputs" section with a default value of false. This addition aligns with the PR objective to control the retention of visualization images after training.

tests/data/models/minimal_instance.UNet.bottomup/initial_config.json (1)

130-130: Addition of keep_viz_images parameter.

The parameter keep_viz_images has been added to the "outputs" section with a default value of true. This addition aligns with the PR objective to control the retention of visualization images after training.

tests/data/models/minimal_instance.UNet.centroid/training_config.json (1)

178-178: Addition of keep_viz_images parameter.

The parameter keep_viz_images has been added to the "outputs" section with a default value of true. This addition aligns with the PR objective to control the retention of visualization images after training.

tests/data/models/minimal_instance.UNet.centered_instance/training_config.json (1)

182-182: Addition of keep_viz_images parameter.

The parameter keep_viz_images has been added to the "outputs" section with a default value of true. This addition aligns with the PR objective to control the retention of visualization images after training.

tests/data/models/minimal_instance.UNet.bottomup/training_config.json (1)

195-195: Addition of keep_viz_images parameter.

The new parameter keep_viz_images is correctly added to the outputs section. Ensure the logic to handle this parameter is implemented in the codebase.

tests/data/models/min_tracks_2node.UNet.topdown_multiclass/training_config.json (1)

211-211: Addition of keep_viz_images parameter.

The new parameter keep_viz_images is correctly added to the outputs section. Ensure the logic to handle this parameter is implemented in the codebase.

sleap/nn/config/outputs.py (1)

154-155: Addition of keep_viz_images attribute.

The new attribute keep_viz_images is correctly added to the OutputsConfig class. Ensure the logic to handle this attribute is implemented in the codebase.

sleap/config/pipeline_form.yaml (1)

289-293: Addition of _keep_viz parameter.

The new parameter _keep_viz is correctly added to the output options section. Ensure the logic to handle this parameter is implemented in the codebase.

docs/guides/cli.md (8)

Line range hint 120-120: Add a comma after "book".

A comma is needed to improve readability.

- If you specify how many identities there should be in a frame (i.e., the number of animals) with the {code}`--tracking.clean_instance_count` argument, then we will use a heuristic method to connect "breaks" in the track identities where we lose one identity and spawn another.
+ If you specify how many identities there should be in a frame (i.e., the number of animals), with the {code}`--tracking.clean_instance_count` argument, then we will use a heuristic method to connect "breaks" in the track identities where we lose one identity and spawn another.

Line range hint 241-241: Correct the spelling of "multi-model".

The term "multi-model" should be hyphenated.

- **2. Inference with multi-model pipelines (e.g., top-down):**
+ **2. Inference with multi-model pipelines (e.g., top-down):**

Line range hint 291-291: Replace "Amongst" with "Among".

"Amongst" is old-fashioned; "Among" is more frequently used.

- Amongst other things, it can be used to export data from a SLEAP dataset into an HDF5 file that can be easily used for analysis (e.g., read from MATLAB).
+ Among other things, it can be used to export data from a SLEAP dataset into an HDF5 file that can be easily used for analysis (e.g., read from MATLAB).

Line range hint 345-345: Improve wording.

Use a stronger verb to enhance the sentence.

- `sleap-inspect`  {code}`sleap-inspect` gives you various information about a SLEAP dataset file such as a list of videos and a count of the frames with labels.
+ `sleap-inspect`  {code}`sleap-inspect` provides various information about a SLEAP dataset file such as a list of videos and a count of the frames with labels.

Line range hint 345-345: Add a comma after "file".

A comma is needed to improve readability.

- `sleap-inspect`  {code}`sleap-inspect` gives you various information about a SLEAP dataset file such as a list of videos and a count of the frames with labels.
+ `sleap-inspect`  {code}`sleap-inspect` provides various information about a SLEAP dataset file, such as a list of videos and a count of the frames with labels.

Line range hint 406-406: Add a comma after "information".

A comma is needed to improve readability.

- There's also a script to output diagnostic information which may help us if you need to contact us about problems installing or running SLEAP.
+ There's also a script to output diagnostic information, which may help us if you need to contact us about problems installing or running SLEAP.

Line range hint 233-233: Remove trailing punctuation in heading.

Trailing punctuation in headings should be avoided.

- #### Examples:
+ #### Examples

Line range hint 335-335: Specify language in fenced code block.

Fenced code blocks should have a language specified.

- ```
+ ```none
sleap/nn/training.py (16)

Line range hint 24-103: LGTM!

The DataReaders class is well-structured and correctly implemented.


Line range hint 106-121: LGTM!

The setup_optimizer function is correctly implemented.


Line range hint 124-138: LGTM!

The setup_losses function is correctly implemented.


Line range hint 141-153: LGTM!

The setup_metrics function is correctly implemented.


Line range hint 156-177: LGTM!

The setup_optimization_callbacks function is correctly implemented.


Line range hint 179-181: LGTM!

The get_timestamp function is correctly implemented.


Line range hint 183-204: LGTM!

The setup_new_run_folder function is correctly implemented.


Line range hint 207-226: LGTM!

The setup_zmq_callbacks function is correctly implemented.


Line range hint 308-1039: LGTM!

The Trainer class is well-structured and correctly implemented.


Line range hint 1042-1185: LGTM!

The SingleInstanceModelTrainer class is well-structured and correctly implemented.


Line range hint 1188-1314: LGTM!

The CentroidConfmapsModelTrainer class is well-structured and correctly implemented.


Line range hint 1317-1451: LGTM!

The TopdownConfmapsModelTrainer class is well-structured and correctly implemented.


Line range hint 1454-1593: LGTM!

The BottomUpModelTrainer class is well-structured and correctly implemented.


Line range hint 1596-1730: LGTM!

The BottomUpMultiClassModelTrainer class is well-structured and correctly implemented.


Line range hint 1733-1970: LGTM!

The create_trainer_using_cli function is correctly implemented.


Line range hint 1973-1984: LGTM!

The main function is correctly implemented.

docs/notebooks/Training_and_inference_on_an_example_dataset.ipynb (2)

338-338: Add a new line before the added parameter for readability.

To improve readability, add a new line before the keep_viz_images parameter.

...
        "save_visualizations": true,
+
        "keep_viz_images": true,
        "zip_outputs": false,
...

730-730: Add a new line before the added parameter for readability.

To improve readability, add a new line before the keep_viz_images parameter.

...
        "save_visualizations": true,
+
        "keep_viz_images": true,
        "zip_outputs": false,
...

sleap/nn/config/outputs.py Show resolved Hide resolved
docs/guides/cli.md Show resolved Hide resolved
docs/guides/cli.md Outdated Show resolved Hide resolved
sleap/gui/learning/runners.py Show resolved Hide resolved
sleap/gui/learning/runners.py Show resolved Hide resolved
@hajin-park hajin-park marked this pull request as ready for review July 9, 2024 02:24
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: 1

Outside diff range and nitpick comments (3)
docs/guides/cli.md (2)

39-40: Update the description for --save_viz.

The description for --save_viz should be updated to clarify that it works in conjunction with --keep_viz.

-  --save_viz            Enable saving of prediction visualizations to the run
+  --save_viz            Enable saving of prediction visualizations to the run folder during training.

71-72: Clarify the dependency of --keep_viz on --save_viz.

The description for --keep_viz should explicitly mention that it only has an effect if --save_viz is enabled.

-  --keep_viz            Keep prediction visualization images in the run
-                        folder after training when save_viz is enabled.
+  --keep_viz            Keep prediction visualization images in the run folder after training if --save_viz is enabled.
sleap/nn/training.py (1)

1868-1874: Add a period at the end of the help text.

For consistency with other help texts in the CLI parser, add a period at the end.

-            "--save_viz is enabled."
+            "--save_viz is enabled."
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c75a0ef and 227138d.

Files selected for processing (4)
  • docs/guides/cli.md (2 hunks)
  • sleap/nn/training.py (4 hunks)
  • tests/gui/test_dialogs.py (1 hunks)
  • tests/nn/test_training.py (2 hunks)
Additional context used
Ruff
tests/gui/test_dialogs.py

3-3: os imported but unused

Remove unused import: os

(F401)


4-4: pathlib.Path imported but unused

Remove unused import: pathlib.Path

(F401)

Additional comments not posted (5)
tests/gui/test_dialogs.py (1)

3-3: Remove unused import os.

The os import is unused and can be safely removed.

Tools
Ruff

3-3: os imported but unused

Remove unused import: os

(F401)

tests/nn/test_training.py (3)

126-149: LGTM! Ensure the keep_viz_images parameter is tested correctly.

The changes correctly set and test the keep_viz_images parameter.


152-179: LGTM! Ensure the keep_viz_images parameter is tested correctly.

The changes correctly set and test the keep_viz_images parameter.


392-410: LGTM! The new test for --keep_viz CLI option is well-implemented.

The function correctly tests the --keep_viz CLI option.

sleap/nn/training.py (1)

1960-1960: LGTM!

The new CLI argument --keep_viz is correctly added to the job configuration.

@@ -1,6 +1,5 @@
"""Module to test the dialogs of the GUI (contained in sleap/gui/dialogs)."""


import os
from pathlib import Path
Copy link

Choose a reason for hiding this comment

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

Remove unused import pathlib.Path.

The Path import from pathlib is unused and can be safely removed.

- from pathlib import Path
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from pathlib import Path
Tools
Ruff

4-4: pathlib.Path imported but unused

Remove unused import: pathlib.Path

(F401)

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.

Ready to merge after tests pass (post updating branch)

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 227138d and 33c9d62.

Files selected for processing (9)
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/initial_config.json (1 hunks)
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.bottomup/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.bottomup/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centered_instance/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centered_instance/training_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centroid/initial_config.json (1 hunks)
  • tests/data/models/minimal_instance.UNet.centroid/training_config.json (1 hunks)
  • tests/nn/test_training.py (2 hunks)
Files skipped from review due to trivial changes (8)
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/initial_config.json
  • tests/data/models/min_tracks_2node.UNet.bottomup_multiclass/training_config.json
  • tests/data/models/minimal_instance.UNet.bottomup/initial_config.json
  • tests/data/models/minimal_instance.UNet.bottomup/training_config.json
  • tests/data/models/minimal_instance.UNet.centered_instance/initial_config.json
  • tests/data/models/minimal_instance.UNet.centered_instance/training_config.json
  • tests/data/models/minimal_instance.UNet.centroid/initial_config.json
  • tests/data/models/minimal_instance.UNet.centroid/training_config.json
Additional context used
Ruff
tests/nn/test_training.py

411-411: Remove unnecessary True if ... else False

Remove unnecessary True if ... else False

(SIM210)

Additional comments not posted (2)
tests/nn/test_training.py (2)

126-149: LGTM!

The changes to manage visualization images during training are consistent with the PR objectives and context.


152-179: LGTM!

The changes to manage visualization images during training are consistent with the PR objectives and context.

Comment on lines +392 to +412
@pytest.mark.parametrize("keep_viz_cli", ["", "--keep_viz"])
def test_keep_viz_cli(
keep_viz_cli,
min_single_instance_robot_model_path: str,
tmp_path: str,
):
"""Test training CLI for --keep_viz option."""
cfg_dir = min_single_instance_robot_model_path
cfg = TrainingJobConfig.load_json(str(Path(cfg_dir, "training_config.json")))

# Save training config to tmp folder
cfg_path = str(Path(tmp_path, "training_config.json"))
cfg.save_json(cfg_path)

cli_args = [cfg_path, keep_viz_cli]
trainer = sleap_train(cli_args)

# Check that --keep_viz is set correctly
assert trainer.config.outputs.keep_viz_images == (
True if keep_viz_cli == "--keep_viz" else False
)
Copy link

Choose a reason for hiding this comment

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

Simplify the ternary operator.

The ternary operator can be simplified to a direct comparison.

-  assert trainer.config.outputs.keep_viz_images == (
-      True if keep_viz_cli == "--keep_viz" else False
-  )
+  assert trainer.config.outputs.keep_viz_images == (keep_viz_cli == "--keep_viz")
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@pytest.mark.parametrize("keep_viz_cli", ["", "--keep_viz"])
def test_keep_viz_cli(
keep_viz_cli,
min_single_instance_robot_model_path: str,
tmp_path: str,
):
"""Test training CLI for --keep_viz option."""
cfg_dir = min_single_instance_robot_model_path
cfg = TrainingJobConfig.load_json(str(Path(cfg_dir, "training_config.json")))
# Save training config to tmp folder
cfg_path = str(Path(tmp_path, "training_config.json"))
cfg.save_json(cfg_path)
cli_args = [cfg_path, keep_viz_cli]
trainer = sleap_train(cli_args)
# Check that --keep_viz is set correctly
assert trainer.config.outputs.keep_viz_images == (
True if keep_viz_cli == "--keep_viz" else False
)
assert trainer.config.outputs.keep_viz_images == (keep_viz_cli == "--keep_viz")
Tools
Ruff

411-411: Remove unnecessary True if ... else False

Remove unnecessary True if ... else False

(SIM210)

@roomrys roomrys merged commit 14c21b4 into talmolab:develop Jul 10, 2024
7 of 8 checks passed
@hajin-park hajin-park deleted the hajin/fix-save-visualizations branch July 10, 2024 21:08
@coderabbitai coderabbitai bot mentioned this pull request Sep 26, 2024
11 tasks
roomrys added a commit that referenced this pull request Dec 19, 2024
* Remove no-op code from #1498

* Add options to set background color when exporting video (#1328)

* implement #921

* simplified form / refractor

* Add test function and update cli docs

* Improve test function to check background color

* Improve comments

* Change background options to lowercase

* Use coderabbitai suggested `fill`

---------

Co-authored-by: Shrivaths Shyam <[email protected]>
Co-authored-by: Liezl Maree <[email protected]>

* Increase range on batch size (#1513)

* Increase range on batch size

* Set maximum to a factor of 2

* Set default callable for `match_lists_function` (#1520)

* Set default for `match_lists_function`

* Move test code to official tests

* Check using expected values

* Allow passing in `Labels` to `app.main` (#1524)

* Allow passing in `Labels` to `app.main`

* Load the labels object through command

* Add warning when unable to switch back to CPU mode

* Replace (broken) `--unrag` with `--ragged` (#1539)

* Fix unrag always set to true in sleap-export

* Replace unrag with ragged

* Fix typos

* Add function to create app (#1546)

* Refactor `AddInstance` command (#1561)

* Refactor AddInstance command

* Add staticmethod wrappers

* Return early from set_visible_nodes

* Import DLC with uniquebodyparts, add Tracks (#1562)

* Import DLC with uniquebodyparts, add Tracks

* add tests

* correct tests

* Make the hdf5 videos store as int8 format (#1559)

* make the hdf5 video dataset type as proper int8 by padding with zeros

* add gzip compression

* Scale new instances to new frame size (#1568)

* Fix typehinting in `AddInstance`

* brought over changes from my own branch

* added suggestions

* Ensured google style comments

---------

Co-authored-by: roomrys <[email protected]>
Co-authored-by: sidharth srinath <[email protected]>

* Fix package export (#1619)

Add check for empty videos

* Add resize/scroll to training GUI (#1565)

* Make resizable training GUI and add adaptive scroll bar

* Set a maximum window size

---------

Co-authored-by: Liezl Maree <[email protected]>

* support loading slp files with non-compound types and str in metadata (#1566)

Co-authored-by: Liezl Maree <[email protected]>

* change inference pipeline option to tracking-only (#1666)

change inference pipeline none option to tracking-only

* Add ABL:AOC 2023 Workshop link (#1673)

* Add ABL:AOC 2023 Workshop link

* Trigger website build

* Graceful failing with seeking errors (#1712)

* Don't try to seek to faulty last frame on provider initialization

* Catch seeking errors and pass

* Lint

* Fix IndexError for hdf5 file import for single instance analysis files (#1695)

* Fix hdf5 read for single instance analysis files

* Add test

* Small test files

* removing unneccessary fixtures

* Replace imgaug with albumentations (#1623)

What's the worst that could happen?

* Initial commit

* Fix augmentation

* Update more deps requirements

* Use pip for installing albumentations and avoid reinstalling OpenCV

* Update other conda envs

* Fix out of bounds albumentations issues and update dependencies (#1724)

* Install albumentations using conda-forge in environment file

* Conda install albumentations

* Add ndx-pose to pypi requirements

* Keep out of bounds points

* Black

* Add ndx-pose to conda install in environment file

* Match environment file without cuda

* Ordered dependencies

* Add test

* Delete comments

* Add conda packages to mac environment file

* Order dependencies in pypi requirements

* Add tests with zeroes and NaNs for augmentation

* Back

* Black

* Make comment one line

* Add todo for later

* Black

* Update to new TensorFlow conda package (#1726)

* Build conda package locally

* Try 2.8.4

* Merge develop into branch to fix dependencies

* Change tensorflow version to 2.7.4 in where conda packages are used

* Make tensorflow requirements in pypi looser

* Conda package has TensorFlow 2.7.0 and h5py and numpy installed via conda

* Change tensorflow version in `environment_no_cuda.yml` to test using CI

* Test new sleap/tensorflow package

* Reset build number

* Bump version

* Update mac deps

* Update to Arm64 Mac runners

* pin `importlib-metadata`

* Pin more stuff on mac

* constrain `opencv` version due to new qt dependencies

* Update more mac stuff

* Patches to get to green

* More mac skipping

---------

Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: Talmo Pereira <[email protected]>

* Fix CI on macosx-arm64 (#1734)

* Build conda package locally

* Try 2.8.4

* Merge develop into branch to fix dependencies

* Change tensorflow version to 2.7.4 in where conda packages are used

* Make tensorflow requirements in pypi looser

* Conda package has TensorFlow 2.7.0 and h5py and numpy installed via conda

* Change tensorflow version in `environment_no_cuda.yml` to test using CI

* Test new sleap/tensorflow package

* Reset build number

* Bump version

* Update mac deps

* Update to Arm64 Mac runners

* pin `importlib-metadata`

* Pin more stuff on mac

* constrain `opencv` version due to new qt dependencies

* Update more mac stuff

* Patches to get to green

* More mac skipping

* Re-enable mac tests

* Handle GPU re-init

* Fix mac build CI

* Widen tolerance for movenet correctness test

* Fix build ci

* Try for manual build without upload

* Try to reduce training CI time

* Rework actions

* Fix miniforge usage

* Tweaks

* Fix build ci

* Disable manual build

* Try merging CI coverage

* GPU/CPU usage in tests

* Lint

* Clean up

* Fix test skip condition

* Remove scratch test

---------

Co-authored-by: eberrigan <[email protected]>

* Add option to export to CSV via sleap-convert and API (#1730)

* Add csv as a format option

* Add analysis to format

* Add csv suffix to output path

* Add condition for csv analysis file

* Add export function to Labels class

* delete print statement

* lint

* Add `analysis.csv` as parametrize input for `sleap-convert` tests

* test `export_csv` method added to `Labels` class

* black formatting

* use `Path` to construct filename

* add `analysis.csv` to cli guide for `sleap-convert`

---------

Co-authored-by: Talmo Pereira <[email protected]>

* Only propagate Transpose Tracks when propagate is checked (#1748)

Fix always-propagate transpose tracks issue

* View Hyperparameter nonetype fix (#1766)

Pass config getter argument to fetch hyperparameters

* Adding ragged metadata to `info.json` (#1765)

Add ragged metadata to info.json file

* Add batch size to GUI for inference (#1771)

* Fix conda builds (#1776)

* test conda packages in a test environment as part of CI

* do not test sleap import using conda build

* use github environment variables to define build path for each OS in the matrix and add print statements for testing

* figure out paths one OS at a time

* github environment variables work in subsequent steps not current step

* use local builds first

* print env info

* try simple environment creation

* try conda instead of mamba

* fix windows build path

* fix windows build path

* add comment to reference pull request

* remove test stage from conda build for macs and test instead by creating the environment in a workflow

* test workflow by pushing to current branch

* test conda package on macos runner

* Mac build does not need nvidia channel

* qudida and albumentations are conda installed now

* add comment with original issue

* use python 3.9

* use conda match specifications syntax

* make print statements more readable for troubleshooting python versioning

* clean up build file

* update version for pre-release

* add TODO

* add tests for conda packages before uploading

* update ci comments and branches

* remove macos test of pip wheel since python 3.9 is not supported by setup-python action

* Upgrade build actions for release (#1779)

* update `build.yml` so it matches updates from `build_manual.yml`

* test `build.yml` without uploading

* test again using build_manual.yml

* build pip wheel with Ubuntu and turn off caching so build.yml exactly matches build_manual.yml

* `build.yml` on release only and upload

* testing caching

* `use-only-tar-bz2: true` makes environment unsolvable, change it back

* Update .github/workflows/build_manual.yml

Co-authored-by: Liezl Maree <[email protected]>

* Update .github/workflows/build.yml

Co-authored-by: Liezl Maree <[email protected]>

* bump pre-release version

* fix version for pre-release

* run build and upload on release!

* try setting `CACHE_NUMBER` to 1 with `use-only-tar-bz2` set to true

* increasing the cache number to reset the cache does work when `use-only-tar-bz2` is set to true

* publish and upload on release only

---------

Co-authored-by: Liezl Maree <[email protected]>

* Add ZMQ support via GUI and CLI (#1780)

* Add ZMQ support via GUI and CLI, automatic port handler, separate utils module for the functions

* Change menu name to match deleting predictions beyond max instance (#1790)

Change menu and function names

* Fix website build and remove build cache across workflows (#1786)

* test with build_manual on push

* comment out caching in build manual

* remove cache step from builad manual since environment resolves when this is commented out

* comment out cache in build ci

* remove cache from build on release

* remove cache from website build

* test website build on push

* add name to checkout step

* update checkout to v4

* update checkout to v4 in build ci

* remove cache since build ci works without it

* update upload-artifact to v4 in build ci

* update second chechout to v4 in build ci

* update setup-python to v5 in build ci

* update download-artifact to v4 in build ci

* update checkout to v4 in build ci

* update checkout to v4 in website build

* update setup-miniconda to v3.0.3 in website build

* update actions-gh-pages to v4 in website build

* update actions checkout and setup-python in ci

* update checkout action in ci to v4

* pip install lxml[html_clean] because of error message during action

* add error message to website to explain why pip install lxml[html_clean]

* remove my branch for pull request

* Bump to 1.4.1a1 (#1791)

* bump versions to 1.4.1a1

* we can change the version on the installation page since this will be merged into the develop branch and not main

* Fix windows conda package upload and build ci (#1792)

* windows OS is 2022 not 2019 on runner

* upload windows conda build manually but not pypi build

* remove comment and run build ci

* change build manual back so that it doesn't upload

* remove branch from build manual

* update installation docs for 1.4.1a1

* Fix zmq inference (#1800)

* Ensure that we always pass in the zmq_port dict to LossViewer

* Ensure zmq_ports has correct keys inside LossViewer

* Use specified controller and publish ports for first attempted addresses

* Add test for ports being set in LossViewer

* Add max attempts to find unused port

* Fix find free port loop and add for controller port also

* Improve code readablility and reuse

* Improve error message when unable to find free port

* Set selected instance to None after removal (#1808)

* Add test that selected instance set to None after removal

* Set selected instance to None after removal

* Add `InstancesList` class to handle backref to `LabeledFrame` (#1807)

* Add InstancesList class to handle backref to LabeledFrame

* Register structure/unstructure hooks for InstancesList

* Add tests for the InstanceList class

* Handle case where instance are passed in but labeled_frame is None

* Add tests relevant methods in LabeledFrame

* Delegate setting frame to InstancesList

* Add test for PredictedInstance.frame after complex merge

* Add todo comment to not use Instance.frame

* Add rtest for InstasnceList.remove

* Use normal list for informative `merged_instances`

* Add test for copy and clear

* Add copy and clear methods, use normal lists in merge method

* Bump to v1.4.1a2 (#1835)

bump to 1.4.1a2

* Updated trail length viewing options (#1822)

* updated trail length optptions

* Updated trail length options in the view menu

* Updated `prefs` to include length info from `preferences.yaml`

* Added trail length as method of `MainWindow`

* Updated trail length documentation

* black formatting

---------

Co-authored-by: Keya Loding <[email protected]>

* Handle case when no frame selection for trail overlay (#1832)

* Menu option to open preferences directory and update to util functions to pathlib (#1843)

* Add menu to view preferences directory and update to pathlib

* text formatting

* Add `Keep visualizations` checkbox to training GUI (#1824)

* Renamed save_visualizations to view_visualizations for clarity

* Added Delete Visualizations button to the training pipeline gui, exposed del_viz_predictions config option to the user

* Reverted view_ back to save_ and changed new training checkbox to Keep visualization images after training.

* Fixed keep_viz config option state override bug and updated keep_viz doc description

* Added test case for reading training CLI argument correctly

* Removed unnecessary testing code

* Creating test case to check for viz folder

* Finished tests to check CLI argument reading and viz directory existence

* Use empty string instead of None in cli args test

* Use keep_viz_images false in most all test configs (except test to override config)

---------

Co-authored-by: roomrys <[email protected]>

* Allowing inference on multiple videos via `sleap-track` (#1784)

* implementing proposed code changes from issue #1777

* comments

* configuring output_path to support multiple video inputs

* fixing errors from preexisting test cases

* Test case / code fixes

* extending test cases for mp4 folders

* test case for output directory

* black and code rabbit fixes

* code rabbit fixes

* as_posix errors resolved

* syntax error

* adding test data

* black

* output error resolved

* edited for push to dev branch

* black

* errors fixed, test cases implemented

* invalid output test and invalid input test

* deleting debugging statements

* deleting print statements

* black

* deleting unnecessary test case

* implemented tmpdir

* deleting extraneous file

* fixing broken test case

* fixing test_sleap_track_invalid_output

* removing support for multiple slp files

* implementing talmo's comments

* adding comments

* Add object keypoint similarity method (#1003)

* Add object keypoint similarity method

* fix max_tracking

* correct off-by-one error

* correct off-by-one error

* Generate suggestions using max point displacement threshold (#1862)

* create function max_point_displacement, _max_point_displacement_video. Add to yaml file. Create test for new function . . . will need to edit

* remove unnecessary for loop, calculate proper displacement, adjusted tests accordingly

* Increase range for displacement threshold

* Fix frames not found bug

* Return the latter frame index

* Lint

---------

Co-authored-by: roomrys <[email protected]>

* Added Three Different Cases for Adding a New Instance (#1859)

* implemented paste with offset

* right click and then default will paste the new instance at the location of the cursor

* modified the logics for creating new instance

* refined the logic

* fixed the logic for right click

* refined logics for adding new instance at a specific location

* Remove print statements

* Comment code

* Ensure that we choose a non nan reference node

* Move OOB nodes to closest in-bounds position

---------

Co-authored-by: roomrys <[email protected]>

* Allow csv and text file support on sleap track (#1875)

* initial changes

* csv support and test case

* increased code coverage

* Error fixing, black, deletion of (self-written) unused code

* final edits

* black

* documentation changes

* documentation changes

* Fix GUI crash on scroll (#1883)

* Only pass wheelEvent to children that can handle it

* Add test for wheelEvent

* Fix typo to allow rendering videos with mp4 (Mac) (#1892)

Fix typo to allow rendering videos with mp4

* Do not apply offset when double clicking a `PredictedInstance` (#1888)

* Add offset argument to newInstance and AddInstance

* Apply offset of 10 for Add Instance menu button (Ctrl + I)

* Add offset for docks Add Instance button

* Make the QtVideoPlayer context menu unit-testable

* Add test for creating a new instance

* Add test for "New Instance" button in `InstancesDock`

* Fix typo in docstring

* Add docstrings and typehinting

* Remove unused imports and sort imports

* Refactor video writer to use imageio instead of skvideo (#1900)

* modify `VideoWriter` to use imageio with ffmpeg backend

* check to see if ffmpeg is present

* use the new check for ffmpeg

* import imageio.v2

* add imageio-ffmpeg to environments to test

* using avi format for now

* remove SKvideo videowriter

* test `VideoWriterImageio` minimally

* add more documentation for ffmpeg

* default mp4 for ffmpeg should be mp4

* print using `IMAGEIO` when using ffmpeg

* mp4 for ffmpeg

* use mp4 ending in test

* test `VideoWriterImageio` with avi file extension

* test video with odd size

* remove redundant filter since imageio-ffmpeg resizes automatically

* black

* remove unused import

* use logging instead of print statement

* import cv2 is needed for resize

* remove logging

* Use `Video.from_filename` when structuring videos (#1905)

* Use Video.from_filename when structuring videos

* Modify removal_test_labels to have extension in filename

* Use | instead of + in key commands (#1907)

* Use | instead of + in key commands

* Lint

* Replace QtDesktop widget in preparation for PySide6 (#1908)

* Replace to-be-depreciated QDesktopWidget

* Remove unused imports and sort remaining imports

* Remove unsupported |= operand to prepare for PySide6 (#1910)

Fixes TypeError: unsupported operand type(s) for |=: 'int' and 'Option'

* Use positional argument for exception type (#1912)

traceback.format_exception has changed it's first positional argument's name from etype to exc in python 3.7 to 3.10

* Replace all Video structuring with Video.cattr() (#1911)

* Remove unused AsyncVideo class (#1917)

Remove unused AsyncVideo

* Refactor `LossViewer` to use matplotlib (#1899)

* use updated syntax for QtAgg backend of matplotlib

* start add features to `MplCanvas` to replace QtCharts features in `LossViewer` (untested)

* remove QtCharts imports and replace with MplCanvas

* remove QtCharts imports and replace with MplCanvas

* start using MplCanvas in LossViwer instead of QtCharts (untested)

* use updated syntax

* Uncomment all commented out QtChart

* Add debug code

* Refactor monitor to use LossViewer._init_series method

* Add monitor only debug code

* Add methods for setting up axes and legend

* Add the matplotlib canvas to the widget

* Resize axis with data (no log support yet)

* Try using PathCollection for "batch"

* Get "batch" plotting with ax.scatter (no log support yet)

* Add log support

* Add a _resize_axis method

* Modify init_series to work for ax.plot as well

* Use matplotlib to plot epoch_loss line

* Add method _add_data_to_scatter

* Add _add_data_to_plot method

* Add docstring to _resize_axes

* Add matplotlib plot for val_loss

* Add matplotlib scatter for val_loss_best

* Avoid errors with setting log scale before any positive values

* Add x and y axes labels

* Set title (removing html tags)

* Add legend

* Adjust positioning of plot

* Lint

* Leave MplCanvas unchanged

* Removed unused training_monitor.LossViewer

* Resize fonts

* Move legend outside of plot

* Add debug code for montitor aesthetics

* Use latex formatting to bold parts of title

* Make axes aesthetic

* Add midpoint grid lines

* Set initial limits on x and y axes to be 0+

* Ensure x axis minimum is always resized to 0+

* Adjust plot to account for plateau patience title

* Add debug code for plateau patience title line

* Lint

* Set thicker line width

* Remove unused import

* Set log axis on initialization

* Make tick labels smaller

* Move plot down a smidge

* Move ylabel left a bit

* Lint

* Add class LossPlot

* Refactor LossViewer to use LossPlot

* Remove QtCharts code

* Remove debug codes

* Allocate space for figure items based on item's size

* Refactor LossPlot to use underscores for internal methods

* Ensure y_min, y_max not equal
Otherwise we get an unnecessary teminal message:
UserWarning: Attempting to set identical bottom == top == 3.0 results in singular transformations; automatically expanding.
  self.axes.set_ylim(y_min, y_max)

---------

Co-authored-by: roomrys <[email protected]>
Co-authored-by: roomrys <[email protected]>

* Refactor `LossViewer` to use underscores for internal method names (#1919)

Refactor LossViewer to use underscores for internal method names

* Manually handle `Instance.from_predicted` structuring when not `None` (#1930)

* Use `tf.math.mod` instead of `%` (#1931)

* Option for Max Stride to be 128 (#1941)

Co-authored-by: Max  Weinberg <[email protected]>

* Add discussion comment workflow (#1945)

* Add a bot to autocomment on workflow

* Use github markdown warning syntax

* Add a multiline warning

* Change happy coding to happy SLEAPing

Co-authored-by: Talmo Pereira <[email protected]>

---------

Co-authored-by: roomrys <[email protected]>
Co-authored-by: Talmo Pereira <[email protected]>

* Add comment on issue workflow (#1946)

* Add workflow to test conda packages (#1935)

* Add missing imageio-ffmpeg to meta.ymls (#1943)

* Update installation docs 1.4.1 (#1810)

* [wip] Updated installation docs

* Add tabs for different OS installations

* Move installation methods to tabs

* Use tabs.css

* FIx styling error (line under last tab in terminal hint)

* Add installation instructions before TOC

* Replace mamba with conda

* Lint

* Find good light colors
not switching when change dark/light themes

* Get color scheme switching
with dark/light toggle button

* Upgrade website build dependencies

* Remove seemingly unneeded dependencies from workflow

* Add myst-nb>=0.16.0 lower bound

* Trigger dev website build

* Fix minor typo in css

* Add miniforge and one-liner installs for package managers

---------

Co-authored-by: roomrys <[email protected]>
Co-authored-by: Talmo Pereira <[email protected]>

* Add imageio dependencies for pypi wheel (#1950)

Add imagio dependencies for pypi wheel

Co-authored-by: roomrys <[email protected]>

* Do not always color skeletons table black (#1952)

Co-authored-by: roomrys <[email protected]>

* Remove no module named work error (#1956)

* Do not always color skeletons table black

* Remove offending (possibly unneeded) line
that causes the no module named work error to print in terminal

* Remove offending (possibly unneeded) line
that causes the no module named work error to print in terminal

* Remove accidentally added changes

* Add (failing) test to ensure menu-item updates with state change

* Reconnect callback for menu-item (using lambda)

* Add (failing) test to ensure menu-item updates with state change

Do not assume inital state

* Reconnect callback for menu-item (using lambda)

---------

Co-authored-by: roomrys <[email protected]>

* Add `normalized_instance_similarity` method  (#1939)

* Add normalize function

* Expose normalization function

* Fix tests

* Expose object keypoint sim function

* Fix tests

* Handle skeleton decoding internally (#1961)

* Reorganize (and add) imports

* Add (and reorganize) imports

* Modify decode_preview_image to return bytes if specified

* Implement (minimally tested) replace_jsonpickle_decode

* Add support for using idx_to_node map
i.e. loading from Labels (slp file)

* Ignore None items in reduce_list

* Convert large function to SkeletonDecoder class

* Update SkeletonDecoder.decode docstring

* Move decode_preview_image to SkeletonDecoder

* Use SkeletonDecoder instead of jsonpickle in tests

* Remove unused imports

* Add test for decoding dict vs tuple pystates

* Handle skeleton encoding internally (#1970)

* start class `SkeletonEncoder`

* _encoded_objects need to be a dict to add to

* add notebook for testing

* format

* fix type in docstring

* finish classmethod for encoding Skeleton as a json string

* test encoded Skeleton as json string by decoding it

* add test for decoded encoded skeleton

* update jupyter notebook for easy testing

* constraining attrs in dev environment to make sure decode format is always the same locally

* encode links first then encode source then target then type

* save first enconding statically as an input to _get_or_assign_id so that we do not always get py/id

* save first encoding statically

* first encoding is passed to _get_or_assign_id

* use first_encoding variable to determine if we should assign a py/id

* add print statements for debugging

* update notebook for easy testing

* black

* remove comment

* adding attrs constraint to show this passes for certain attrs version only

* add import

* switch out jsonpickle.encode

* oops remove import

* can attrs be unconstrained?

* forgot comma

* pin attrs for testing

* test Skeleton from json, template, with symmetries, and template

* use SkeletonEncoder.encode

* black

* try removing None values in EdgeType reduced

* Handle case when nodes are replaced by integer indices from caller

* Remove prototyping notebook

* Remove attrs pins

* Remove sort keys (which flips the neccessary ordering of our py/ids)

* Do not add extra indents to encoded file

* Only append links after fully encoded (fat-finger)

* Remove outdated comment

* Lint

---------

Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: roomrys <[email protected]>

* Pin ndx-pose<0.2.0 (#1978)

* Pin ndx-pose<0.2.0

* Typo

* Sort encoded `Skeleton` dictionary for backwards compatibility  (#1975)

* Add failing test to check that encoded Skeleton is sorted

* Sort Skeleton dictionary before encoding

* Remove unused import

* Disable comment bot for now

* Fix COCO Dataset Loading for Invisible Keypoints (#2035)

Update coco.py

# Fix COCO Dataset Loading for Invisible Keypoints

## Issue
When loading COCO datasets, keypoints marked as invisible (flag=0) are currently skipped and later placed randomly within the instance's bounding box. However, in COCO format, these keypoints may still have valid coordinate information that should be preserved (see toy_dataset for expected vs. current behavior).

## Changes
Modified the COCO dataset loading logic to:
- Check if invisible keypoints (flag=0) have non-zero coordinates
- If coordinates are (0,0), skip the point (existing behavior)
- If coordinates are not (0,0), create the point at those coordinates but mark it as not visible
- Maintain existing behavior for visible (flag=2) and labeled

* Lint

* Add tracking score as seekbar header options (#2047)

* Add `tracking_score` as a constructor arg for `PredictedInstance`

* Add `tracking_score` to ID models

* Add fixture with tracking scores

* Add tracking score to seekbar header

* Add bonsai guide for sleap docs (#2050)

* [WIP] Add bonsai guide page

* Add more information to the guide with images

* add branch for website build

* Typos

* fix links

* Include suggestions

* Add more screenshots and refine the doc

* Remove branch from website workflow

* Completed documentation edits from PR made by reviewer + review bot.

---------

Co-authored-by: Shrivaths Shyam <[email protected]>
Co-authored-by: Liezl Maree <[email protected]>

* Don't mark complete on instance scaling (#2049)

* Add check for instances with track assigned before training ID models (#2053)

* Add menu item for deleting instances beyond frame limit (#1797)

* Add menu item for deleting instances beyond frame limit

* Add test function to test the instances returned

* typos

* Update docstring

* Add frame range form

* Extend command to use frame range

---------

Co-authored-by: Talmo Pereira <[email protected]>

* Highlight instance box on hover (#2055)

* Make node marker and label sizes configurable via preferences (#2057)

* Make node marker and label sizes configurable via preferences

* Fix test

* Enable touchpad pinch to zoom (#2058)

* Fix import PySide2 -> qtpy (#2065)

* Fix import PySide2 -> qtpy

* Remove unnecessary print statements.

* Add channels for pip conda env (#2067)

* Add channels for pypi conda env

* Trigger dev website build

* Separate the video name and its filepath columns in `VideoTablesModel` (#2052)

* add option to show video names with filepath

* add doc

* new feature added successfully

* delete unnecessary code

* remove attributes from video object

* Update dataviews.py

* remove all properties

* delete toggle option

* remove video show

* fix the order of the columns

* remove options

* Update sleap/gui/dataviews.py

Co-authored-by: Liezl Maree <[email protected]>

* Update sleap/gui/dataviews.py

Co-authored-by: Liezl Maree <[email protected]>

* use pathlib instead of substrings

* Update dataviews.py

Co-authored-by: Liezl Maree <[email protected]>

* Use Path instead of pathlib.Path
and sort imports and remove unused imports

* Use item.filename instead of getattr

---------

Co-authored-by: Liezl Maree <[email protected]>

* Make status bar dependent on UI mode (#2063)

* remove bug for dark mode

* fix toggle case

---------

Co-authored-by: Liezl Maree <[email protected]>

* Bump version to 1.4.1 (#2062)

* Bump version to 1.4.1

* Trigger conda/pypi builds (no upload)

* Trigger website build

* Add dev channel to installation instructions

---------

Co-authored-by: Talmo Pereira <[email protected]>

* Add -c sleap/label/dev channel for win/linux
- also trigger website build

---------

Co-authored-by: Scott Yang <[email protected]>
Co-authored-by: Shrivaths Shyam <[email protected]>
Co-authored-by: getzze <[email protected]>
Co-authored-by: Lili Karashchuk <[email protected]>
Co-authored-by: Sidharth Srinath <[email protected]>
Co-authored-by: sidharth srinath <[email protected]>
Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: KevinZ0217 <[email protected]>
Co-authored-by: Elizabeth <[email protected]>
Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: eberrigan <[email protected]>
Co-authored-by: vaibhavtrip29 <[email protected]>
Co-authored-by: Keya Loding <[email protected]>
Co-authored-by: Keya Loding <[email protected]>
Co-authored-by: Hajin Park <[email protected]>
Co-authored-by: Elise Davis <[email protected]>
Co-authored-by: gqcpm <[email protected]>
Co-authored-by: Andrew Park <[email protected]>
Co-authored-by: roomrys <[email protected]>
Co-authored-by: MweinbergUmass <[email protected]>
Co-authored-by: Max  Weinberg <[email protected]>
Co-authored-by: DivyaSesh <[email protected]>
Co-authored-by: Felipe Parodi <[email protected]>
Co-authored-by: croblesMed <[email protected]>
@roomrys roomrys mentioned this pull request Dec 19, 2024
11 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.

3 participants