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

import DeepLabCut dataset single-animal #702

Closed
Guillermo-Hidalgo-Gadea opened this issue Apr 7, 2022 · 3 comments
Closed

import DeepLabCut dataset single-animal #702

Guillermo-Hidalgo-Gadea opened this issue Apr 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Guillermo-Hidalgo-Gadea
Copy link

Hi @talmo,

I was wondering if your fix #678 is only for labeled frames in maDLC format?
I have a single-animal project in dlc==2.2.0.6 I am trying to import and get a similar error as in previous issues #428 and #676:

(sleap) C:\Users\hidalggc>sleap-label
Saving config: C:\Users\hidalggc/.sleap/1.2.2/preferences.yaml
Restoring GUI state...

Software versions:
SLEAP: 1.2.2
TensorFlow: 2.6.3
Numpy: 1.19.5
Python: 3.7.12
OS: Windows-10-10.0.19041-SP0

Happy SLEAPing! :)
Traceback (most recent call last):
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 270, in importDLC
    self.execute(ImportDeepLabCut)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 236, in execute
    command().execute(context=self, params=kwargs)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 133, in execute
    self.do_with_signal(context, params)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 157, in do_with_signal
    cls.do_action(context, params)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\gui\commands.py", line 728, in do_action
    labels = Labels.load_deeplabcut(filename=params["filename"])
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\io\dataset.py", line 1985, in load_deeplabcut
    return read(filename, for_object="labels", as_format="deeplabcut")
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\io\format\main.py", line 99, in read
    return disp.read(filename, *args, **kwargs)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\io\format\dispatch.py", line 56, in read
    return adaptor.read(file, *args, **kwargs)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\io\format\deeplabcut.py", line 78, in read
    file=file, full_video=full_video, *args, **kwargs
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\sleap\io\format\deeplabcut.py", line 201, in read_frames
    x, y = data[(node, "x")][i], data[(node, "y")][i]
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\pandas\core\frame.py", line 3457, in __getitem__
    return self._getitem_multilevel(key)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\pandas\core\frame.py", line 3508, in _getitem_multilevel
    loc = self.columns.get_loc(key)
  File "C:\Users\hidalggc\Anaconda3\envs\sleap\lib\site-packages\pandas\core\indexes\multi.py", line 2932, in get_loc
    return self._engine.get_loc(key)
  File "pandas\_libs\index.pyx", line 725, in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc
  File "pandas\_libs\index.pyx", line 76, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1832, in pandas._libs.hashtable.UInt64HashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1841, in pandas._libs.hashtable.UInt64HashTable.get_item
KeyError: 324

here is a subset of the training-dataset: test_CollectedData_Sarah.csv

Thank you in advance, and congratulations on your great documentation it really is above any expectation!

@talmo talmo added the bug Something isn't working label Apr 7, 2022
@talmo
Copy link
Collaborator

talmo commented Apr 7, 2022

Hi @Guillermo-Hidalgo-Gadea,

Thanks for the detailed bug report! I think you're right -- we hadn't run into the new single animal DLC file format yet. Thanks for providing the test data and the full error logs!

I'm tagging this as a bug and we'll work on a fix ASAP. We'll update this thread as soon as we have a patch that you can test.

Cheers,

Talmo

roomrys added a commit that referenced this issue Apr 8, 2022
@Guillermo-Hidalgo-Gadea
Copy link
Author

Hi @talmo, hi @roomrys,

thanks for the quick reply! I am really looking forward to compare this to DLC with standard ResNet in single-animal case.

In the meantime I used the following lines to transform all CollectedData.csv files from DLC to their format before v2.2.0.6.
After that, import > Multiple DeepLabCut datasets from folder worked perfectly!

I also realized that dlc==2.2.0.6 updates the labeled data format from previous dlc versions but only in their .h5 files, so that a dataset generated over multiple training iterations with dlc < 2.2.0.6 will have .csv files that are formated differently (see try - except block below).

import os
import pandas as pd
import tkinter.filedialog

def scraper(extension):
    """
    This function walks through subdirectories and lists all files with a given extension
    """
    masterdir = tkinter.filedialog.askdirectory(title="Select directory to scrap:")
    filelist= list()

    for (dirpath, dirname, filename) in os.walk(masterdir):
        filelist += [os.path.join(dirpath,file) for file in filename]

    file_list= [video for video in filelist if extension in video]
    print(f'The function scraper() successfully selected {len(file_list)} files.')

    return file_list

def transformer(filelist):
    """
    This function changes the first column of DLC labeled data after the change to Multiindex after v2.2.0.3
    """
    for file in filelist:
        df = pd.read_csv(file, header=[0, 1, 2])
        try:
            # transform multiindex
            df['scorer'] = df[['scorer', 'Unnamed: 1_level_0', 'Unnamed: 2_level_0']].agg('/'.join, axis=1)
            new_df = df.drop(['Unnamed: 1_level_0', 'Unnamed: 2_level_0'], axis=1)
            # save in old format
            new_df.to_csv(file, sep=',', index=False)
            print(f'transformed for:  {file}')
        except:
            print(f'passed for:  {file}')
    return

filelist = scraper('.csv')
transformer(filelist)

@roomrys roomrys self-assigned this Apr 11, 2022
roomrys added a commit that referenced this issue Apr 14, 2022
* Add support for single animal DLC files (#702)

* Add test for new format single animal DLC

* Add test images for visual verification

* Add data and test for old version single animal DLC file
@roomrys roomrys added the fixed in future release Fix or feature is merged into develop and will be available in future release. label Apr 28, 2022
talmo added a commit that referenced this issue May 10, 2022
* Add support for new maDLC labels format (#678)

* Supervised Identity Prediction (#460) (#679)

* squash merge from roomrys/sleap-1 (#460)

* Add test dataset with tracks

* Add track indices to labels provider

* Add identity class map generator

* Update docstring

* Add class map model trainer, head and config

* Add inference

* Docs and tests for identity module
- Slightly modified matching to greedy-like behavior
* Fix inference
- Add imports to evals inference
- Move the common Predictor.predict() method to base class
- Fix docstrings for new inference classes
- Add test model and integration test

* Generate tracks from config metadata if not provided

* Force typecasting in identity functions

* Force boolean masking op

* Clean up inference module
- Move common Predictor methods to base class
- Switch to `model.predict_on_batch()` for massive performance increase
  with `predictor.predict()`.
- Enable prediction directly on arrays (slow)

* Enable Qt5Agg backend only when necessary during training

* Top-down supervised identity prediction (#476)

* Add sizematcher to new training pipelines

* Fix topdown ID visualization during training

* Add LabeledFrame.tracked_instances property for filtering
- Greedy checking in has_* properties

* Add Labels.copy() method for creating deep copies
- Works by serializing and deserializing to JSON (inefficient, but
  guaranteed to work since we have lots of coverage on I/O)

* Extract labels with tracked instances
- Add copy kwarg to extract to return deep copies
- Remove user and/or untracked instances in with_user_labels_only().
  Previously this functionality was blocked since we couldn't remove the
  instances from labeled frames without affecting the source labels.
- Add remove_untracked_instances() utility for filtering out instances
  from the labels.

* Add track filtering in LabelsReader provider
- This is slightly redundant with
  Labels.with_user_labels_only(..., with_track_only=True) but serves as
  an extra guarantee that we don't train on instances without tracks
  accidentally, regardless of how the data is preprocessed. Can still
  emit "empty" frames if no instances have tracks set, however.

* Add track filtering in DataReaders during training
- Auto-enabled when training from ID models
- Filters out instances without tracks BEFORE train/val splitting
- Split is now done on copy of labels
- Fix DataReaders arg typing
- Tests for DataReaders

* Add crop size detection to topdown ID models
- Add training integration test for topdown ID

* add removal of untracked instances for labeled instances (#460)

* Add removal of untracked instances for labeled instances
- previously used `LabeledFrame.tracked_instances()` which only returns predicted instances with tracking
- created `LabeledFrame.remove_untracked` which returns both user labeled and predicted instances with tracking
* Formatting
- using black v20.8b1

* add tests for Labels and LabeledFrames (#460)

* Add tests
- test `Labels.remove_untracked_instances()` for both cases of `remove_empty_frames: bool`
-test `LabeledFrames.remove_untracked()` for both user-labeled and predicted frames

* formatting (#460)

* add newline (no indent) at end of files which had failed Lint test

* clean-up comments and unneeded parenthesis (#460)

* Last merge fixes

* Lint

* Bump minor version (#684)

* Fix numpy conversion in inference (#687)

* Expose identity module in nn

* Override predict_on_batch to optionally cast data to numpy

* Fix topological sorting to always start with root node (#688)

* Fix topological sorting to always start with root node

* Add test

* Create unique default shortcuts (#686) (#690)

* Training monitor enhancements (#691)

* Training monitor enhancements
- Cleaned up imports
- Docstrings
- Now update based on time, not epochs
- Added markers for epoch-level losses
- Added best validation loss marker and text
- Reduced minimum possible y-axis value when log scaling
- Marker colors, alpha, sizes and line widths adjusted

* Move training monitor to gui submodule

* add metrics to training monitor title

* add mean time per epoch
* add ETA to finish next 10 epochs
* add plateau patience fraction (when in plateau)
* update dev_requirements to install version of click that does not break black

* Add code coverage

* add coverage for all lines within LossViewer.update_runtime()

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

* add hide instance menu item and hotkey (#692)

* Single press of hotkey (H) toggles instance visibility

* Add instance visibility message/warning to status bar

* Resize keyboard shortcuts dialog box

* Fix formatting to read and save tracking scores (#693)

* Update formatting to include tracking_scores

* Add formatting fixtures, tracking_scores test

* Hide predicted instances with hotkey (#694)

* add hide instance menu item and hotkey

* single press of hotkey (H) toggles instance visibility

* Add instance visibility message to status bar

* Resize keyboard shortcuts dialog box

* Make shortcuts pop-up slightly narrower and taller

* Hide predicted instances as well

* hide predicted instances
* update status bar message:
- count only visible predicted and labeled instances
- only show "hidden instances" warning when number instances in frame is greater than 0
- normal font weight

* Logic update for detecting instances to show

* Add test for instance visibility

* Change which qtbot wait is used

* Change timeout of qtbot.waitActive

- attempt to pass ubuntu tests on github actions

* Use arbitrary qtbot.wait

Hope to verify that ubuntu test fails due to a waiting error

* Add test for instance colors

- predict ubuntu test will fail

* Add test skip mark for ubuntu

* Import pytest

* Skip test for linux

* Remove unused packages

* Talmo/pre v1.2.2 (#696)

* Change default tab appearance

* Bump to 1.2.2

* Add more notebooks to docs (#698)

* Fix missing links and update content

* Add new notebooks

* Add troubleshooting guide

* Datasets and paper link update

* Add support for new single animal DLC format (#704)

* Add support for single animal DLC files (#702)

* Add test for new format single animal DLC

* Add test images for visual verification

* Add data and test for old version single animal DLC file

* Add edges to analysis h5 (#707)

* Add edge names and edge indices to analysis h5

* Add test for node names and edge names in analysis h5 export

* Speed-up labeling suggestions look-up (#709)

* Use data cache to speed-up labeling suggestions

* Move logic from Labels.__getitem__ to Labels.get

* Use Labels.__getitem__ as a wrapper to Labels.get

* Add support for AlphaTracker import (#716)

* Add support for AlphaTrackor import

* Integrate adaptor into sleap

* Add tests

* Specify pip version in environment_no_cuda.yml

* Specify pip version in environment.yml

* Remove pip version from environment_no_cuda.yml

* Specify channel and version for pip in environment_no_cuda

* Add GUI-based test

* Add property tests and lint

* Delete condaenv.25edtblj.requirements.txt

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

* Update links from murthylab to talmolab (#724)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* SLEAP v1.2.3 (#726)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* Update pip in all environments

* Update to v1.2.3

* Fix typo on the datasets

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

Co-authored-by: roomrys <[email protected]>
Co-authored-by: sheridana <[email protected]>
@roomrys
Copy link
Collaborator

roomrys commented May 11, 2022

SLEAP v1.2.3 has been released with support for the new single animal DLC format.

@roomrys roomrys closed this as completed May 11, 2022
@roomrys roomrys removed the fixed in future release Fix or feature is merged into develop and will be available in future release. label Jun 29, 2022
talmo added a commit that referenced this issue Jul 26, 2022
* Add support for new maDLC labels format (#678)

* Supervised Identity Prediction (#460) (#679)

* squash merge from roomrys/sleap-1 (#460)

* Add test dataset with tracks

* Add track indices to labels provider

* Add identity class map generator

* Update docstring

* Add class map model trainer, head and config

* Add inference

* Docs and tests for identity module
- Slightly modified matching to greedy-like behavior
* Fix inference
- Add imports to evals inference
- Move the common Predictor.predict() method to base class
- Fix docstrings for new inference classes
- Add test model and integration test

* Generate tracks from config metadata if not provided

* Force typecasting in identity functions

* Force boolean masking op

* Clean up inference module
- Move common Predictor methods to base class
- Switch to `model.predict_on_batch()` for massive performance increase
  with `predictor.predict()`.
- Enable prediction directly on arrays (slow)

* Enable Qt5Agg backend only when necessary during training

* Top-down supervised identity prediction (#476)

* Add sizematcher to new training pipelines

* Fix topdown ID visualization during training

* Add LabeledFrame.tracked_instances property for filtering
- Greedy checking in has_* properties

* Add Labels.copy() method for creating deep copies
- Works by serializing and deserializing to JSON (inefficient, but
  guaranteed to work since we have lots of coverage on I/O)

* Extract labels with tracked instances
- Add copy kwarg to extract to return deep copies
- Remove user and/or untracked instances in with_user_labels_only().
  Previously this functionality was blocked since we couldn't remove the
  instances from labeled frames without affecting the source labels.
- Add remove_untracked_instances() utility for filtering out instances
  from the labels.

* Add track filtering in LabelsReader provider
- This is slightly redundant with
  Labels.with_user_labels_only(..., with_track_only=True) but serves as
  an extra guarantee that we don't train on instances without tracks
  accidentally, regardless of how the data is preprocessed. Can still
  emit "empty" frames if no instances have tracks set, however.

* Add track filtering in DataReaders during training
- Auto-enabled when training from ID models
- Filters out instances without tracks BEFORE train/val splitting
- Split is now done on copy of labels
- Fix DataReaders arg typing
- Tests for DataReaders

* Add crop size detection to topdown ID models
- Add training integration test for topdown ID

* add removal of untracked instances for labeled instances (#460)

* Add removal of untracked instances for labeled instances
- previously used `LabeledFrame.tracked_instances()` which only returns predicted instances with tracking
- created `LabeledFrame.remove_untracked` which returns both user labeled and predicted instances with tracking
* Formatting
- using black v20.8b1

* add tests for Labels and LabeledFrames (#460)

* Add tests
- test `Labels.remove_untracked_instances()` for both cases of `remove_empty_frames: bool`
-test `LabeledFrames.remove_untracked()` for both user-labeled and predicted frames

* formatting (#460)

* add newline (no indent) at end of files which had failed Lint test

* clean-up comments and unneeded parenthesis (#460)

* Last merge fixes

* Lint

* Bump minor version (#684)

* Fix numpy conversion in inference (#687)

* Expose identity module in nn

* Override predict_on_batch to optionally cast data to numpy

* Fix topological sorting to always start with root node (#688)

* Fix topological sorting to always start with root node

* Add test

* Create unique default shortcuts (#686) (#690)

* Training monitor enhancements (#691)

* Training monitor enhancements
- Cleaned up imports
- Docstrings
- Now update based on time, not epochs
- Added markers for epoch-level losses
- Added best validation loss marker and text
- Reduced minimum possible y-axis value when log scaling
- Marker colors, alpha, sizes and line widths adjusted

* Move training monitor to gui submodule

* add metrics to training monitor title

* add mean time per epoch
* add ETA to finish next 10 epochs
* add plateau patience fraction (when in plateau)
* update dev_requirements to install version of click that does not break black

* Add code coverage

* add coverage for all lines within LossViewer.update_runtime()

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

* add hide instance menu item and hotkey (#692)

* Single press of hotkey (H) toggles instance visibility

* Add instance visibility message/warning to status bar

* Resize keyboard shortcuts dialog box

* Fix formatting to read and save tracking scores (#693)

* Update formatting to include tracking_scores

* Add formatting fixtures, tracking_scores test

* Hide predicted instances with hotkey (#694)

* add hide instance menu item and hotkey

* single press of hotkey (H) toggles instance visibility

* Add instance visibility message to status bar

* Resize keyboard shortcuts dialog box

* Make shortcuts pop-up slightly narrower and taller

* Hide predicted instances as well

* hide predicted instances
* update status bar message:
- count only visible predicted and labeled instances
- only show "hidden instances" warning when number instances in frame is greater than 0
- normal font weight

* Logic update for detecting instances to show

* Add test for instance visibility

* Change which qtbot wait is used

* Change timeout of qtbot.waitActive

- attempt to pass ubuntu tests on github actions

* Use arbitrary qtbot.wait

Hope to verify that ubuntu test fails due to a waiting error

* Add test for instance colors

- predict ubuntu test will fail

* Add test skip mark for ubuntu

* Import pytest

* Skip test for linux

* Remove unused packages

* Talmo/pre v1.2.2 (#696)

* Change default tab appearance

* Bump to 1.2.2

* Add more notebooks to docs (#698)

* Fix missing links and update content

* Add new notebooks

* Add troubleshooting guide

* Datasets and paper link update

* Add support for new single animal DLC format (#704)

* Add support for single animal DLC files (#702)

* Add test for new format single animal DLC

* Add test images for visual verification

* Add data and test for old version single animal DLC file

* Add edges to analysis h5 (#707)

* Add edge names and edge indices to analysis h5

* Add test for node names and edge names in analysis h5 export

* Speed-up labeling suggestions look-up (#709)

* Use data cache to speed-up labeling suggestions

* Move logic from Labels.__getitem__ to Labels.get

* Use Labels.__getitem__ as a wrapper to Labels.get

* Add support for AlphaTracker import (#716)

* Add support for AlphaTrackor import

* Integrate adaptor into sleap

* Add tests

* Specify pip version in environment_no_cuda.yml

* Specify pip version in environment.yml

* Remove pip version from environment_no_cuda.yml

* Specify channel and version for pip in environment_no_cuda

* Add GUI-based test

* Add property tests and lint

* Delete condaenv.25edtblj.requirements.txt

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

* Update links from murthylab to talmolab (#724)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* SLEAP v1.2.3 (#726)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* Update pip in all environments

* Update to v1.2.3

* Fix typo on the datasets

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

* Test CI

* Fix Imports in test_format.py (#732)

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

* Add links to discussion (#748)

* Update codecov badge token

* Add option to predict on all videos (#749)

* Contributing Guide, Code of Conduct, and Issues Template (#746)

* Add contributing draft

* Add code of conduct

* Add issues template

* Update bug_report.md

* Create codecov.yml

Split coverage into gui and non-gui counterpart

* Update codecov.yml

* Update codecov.yml

* Create multiple analysis files for multi-video projects (#768)

* Create occupancy matrix (h5) for single video at a time

* Write additional project metadata to the analysis file (for verification purposes)

* Add GUI option to export analysis of all videos

* Change `sleap-convert` to output one analysis file per video in project

* Use default filename for analysis files if multiple videos

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

* Update tracking docs (#761)

* Convert gui and proofreading rst files to md
* Add section in proofreading for culling target instances
* Add propagate track labels docs to gui and proofreading

Co-authored-by: Arlo Sheridan <[email protected]>

* Generate suggestions for videos with less frames than samples per video (#781)

* Add support for videos that have fewer frames than the Sample Stride length.

* Add support for videos that have less frames than the desired (random) Samples per Video (#783)

Allow suggestions to be generated randomly for all videos regardless of number of frames.

* Add button to toggle grayscale

* Revert "Add button to toggle grayscale"

This reverts commit 5d71030.

* Add button to toggle grayscale of current video (#788)

* Analysis HDF5 should prefer user-labeled instance over predicted instance (#772)

* Prefer same frame/track user-instances over predicted-instances when writing analysis hdf5

* Choose video to generate suggestions (#786)

Add option for users to select a certain video or all videos to generate suggestion(s) for.

* Add CLI sleap-render command to render videos (#796)

Sleap-render added to CLI & Updated docs

* Allow user to set grayscale when replacing videos (mp4/avi only)  (#787)

* Support grayscale for SingleImageVideo backend (#789)

* Fix h5py dependency (#815)

* Remove low-scoring predictions before merging inference results (#817)

* SLEAP v1.2.4

* SLEAP v1.2.4

No version left behind

* Remove cli.rst (back from the dead)

* Add read/write adaptor for ndx-pose (#835)

- Reads/writes predicted instances to NWB file.

* Change existing skeleton to match skeleton loaded via "Load Skeleton" button (#840)

* Fix Save As bug (#845)

* Update installation and labeling docs and no cuda yml (#847)

* Recalculate crop size if user-specified crop size indivisible by max stride (#841)

* Expose attributes of NWBFile and create Labels API for exporting to NWB (#855)

* SLEAP v1.2.5 (develop) (#856)

Update to SLEAP v1.2.5

* Fix NWB conda packaging (#860)

* Add pynwb and ndx-pose to conda packages

* Bump to v1.2.6

Co-authored-by: roomrys <[email protected]>
Co-authored-by: sheridana <[email protected]>
Co-authored-by: Arlo Sheridan <[email protected]>
Co-authored-by: David Samy <[email protected]>
talmo added a commit that referenced this issue Jul 26, 2022
SLEAP v1.2.6 (#862)

* Add support for new maDLC labels format (#678)

* Supervised Identity Prediction (#460) (#679)

* squash merge from roomrys/sleap-1 (#460)

* Add test dataset with tracks

* Add track indices to labels provider

* Add identity class map generator

* Update docstring

* Add class map model trainer, head and config

* Add inference

* Docs and tests for identity module
- Slightly modified matching to greedy-like behavior
* Fix inference
- Add imports to evals inference
- Move the common Predictor.predict() method to base class
- Fix docstrings for new inference classes
- Add test model and integration test

* Generate tracks from config metadata if not provided

* Force typecasting in identity functions

* Force boolean masking op

* Clean up inference module
- Move common Predictor methods to base class
- Switch to `model.predict_on_batch()` for massive performance increase
  with `predictor.predict()`.
- Enable prediction directly on arrays (slow)

* Enable Qt5Agg backend only when necessary during training

* Top-down supervised identity prediction (#476)

* Add sizematcher to new training pipelines

* Fix topdown ID visualization during training

* Add LabeledFrame.tracked_instances property for filtering
- Greedy checking in has_* properties

* Add Labels.copy() method for creating deep copies
- Works by serializing and deserializing to JSON (inefficient, but
  guaranteed to work since we have lots of coverage on I/O)

* Extract labels with tracked instances
- Add copy kwarg to extract to return deep copies
- Remove user and/or untracked instances in with_user_labels_only().
  Previously this functionality was blocked since we couldn't remove the
  instances from labeled frames without affecting the source labels.
- Add remove_untracked_instances() utility for filtering out instances
  from the labels.

* Add track filtering in LabelsReader provider
- This is slightly redundant with
  Labels.with_user_labels_only(..., with_track_only=True) but serves as
  an extra guarantee that we don't train on instances without tracks
  accidentally, regardless of how the data is preprocessed. Can still
  emit "empty" frames if no instances have tracks set, however.

* Add track filtering in DataReaders during training
- Auto-enabled when training from ID models
- Filters out instances without tracks BEFORE train/val splitting
- Split is now done on copy of labels
- Fix DataReaders arg typing
- Tests for DataReaders

* Add crop size detection to topdown ID models
- Add training integration test for topdown ID

* add removal of untracked instances for labeled instances (#460)

* Add removal of untracked instances for labeled instances
- previously used `LabeledFrame.tracked_instances()` which only returns predicted instances with tracking
- created `LabeledFrame.remove_untracked` which returns both user labeled and predicted instances with tracking
* Formatting
- using black v20.8b1

* add tests for Labels and LabeledFrames (#460)

* Add tests
- test `Labels.remove_untracked_instances()` for both cases of `remove_empty_frames: bool`
-test `LabeledFrames.remove_untracked()` for both user-labeled and predicted frames

* formatting (#460)

* add newline (no indent) at end of files which had failed Lint test

* clean-up comments and unneeded parenthesis (#460)

* Last merge fixes

* Lint

* Bump minor version (#684)

* Fix numpy conversion in inference (#687)

* Expose identity module in nn

* Override predict_on_batch to optionally cast data to numpy

* Fix topological sorting to always start with root node (#688)

* Fix topological sorting to always start with root node

* Add test

* Create unique default shortcuts (#686) (#690)

* Training monitor enhancements (#691)

* Training monitor enhancements
- Cleaned up imports
- Docstrings
- Now update based on time, not epochs
- Added markers for epoch-level losses
- Added best validation loss marker and text
- Reduced minimum possible y-axis value when log scaling
- Marker colors, alpha, sizes and line widths adjusted

* Move training monitor to gui submodule

* add metrics to training monitor title

* add mean time per epoch
* add ETA to finish next 10 epochs
* add plateau patience fraction (when in plateau)
* update dev_requirements to install version of click that does not break black

* Add code coverage

* add coverage for all lines within LossViewer.update_runtime()

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

* add hide instance menu item and hotkey (#692)

* Single press of hotkey (H) toggles instance visibility

* Add instance visibility message/warning to status bar

* Resize keyboard shortcuts dialog box

* Fix formatting to read and save tracking scores (#693)

* Update formatting to include tracking_scores

* Add formatting fixtures, tracking_scores test

* Hide predicted instances with hotkey (#694)

* add hide instance menu item and hotkey

* single press of hotkey (H) toggles instance visibility

* Add instance visibility message to status bar

* Resize keyboard shortcuts dialog box

* Make shortcuts pop-up slightly narrower and taller

* Hide predicted instances as well

* hide predicted instances
* update status bar message:
- count only visible predicted and labeled instances
- only show "hidden instances" warning when number instances in frame is greater than 0
- normal font weight

* Logic update for detecting instances to show

* Add test for instance visibility

* Change which qtbot wait is used

* Change timeout of qtbot.waitActive

- attempt to pass ubuntu tests on github actions

* Use arbitrary qtbot.wait

Hope to verify that ubuntu test fails due to a waiting error

* Add test for instance colors

- predict ubuntu test will fail

* Add test skip mark for ubuntu

* Import pytest

* Skip test for linux

* Remove unused packages

* Talmo/pre v1.2.2 (#696)

* Change default tab appearance

* Bump to 1.2.2

* Add more notebooks to docs (#698)

* Fix missing links and update content

* Add new notebooks

* Add troubleshooting guide

* Datasets and paper link update

* Add support for new single animal DLC format (#704)

* Add support for single animal DLC files (#702)

* Add test for new format single animal DLC

* Add test images for visual verification

* Add data and test for old version single animal DLC file

* Add edges to analysis h5 (#707)

* Add edge names and edge indices to analysis h5

* Add test for node names and edge names in analysis h5 export

* Speed-up labeling suggestions look-up (#709)

* Use data cache to speed-up labeling suggestions

* Move logic from Labels.__getitem__ to Labels.get

* Use Labels.__getitem__ as a wrapper to Labels.get

* Add support for AlphaTracker import (#716)

* Add support for AlphaTrackor import

* Integrate adaptor into sleap

* Add tests

* Specify pip version in environment_no_cuda.yml

* Specify pip version in environment.yml

* Remove pip version from environment_no_cuda.yml

* Specify channel and version for pip in environment_no_cuda

* Add GUI-based test

* Add property tests and lint

* Delete condaenv.25edtblj.requirements.txt

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

* Update links from murthylab to talmolab (#724)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* SLEAP v1.2.3 (#726)

* Update links from murthylab to talmolab

* Add conda channel for pip install in no cuda yml

* Add try/except for release checker

* Update rest API link

* Update pip in all environments

* Update to v1.2.3

* Fix typo on the datasets

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

* Test CI

* Fix Imports in test_format.py (#732)

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

* Add links to discussion (#748)

* Update codecov badge token

* Add option to predict on all videos (#749)

* Contributing Guide, Code of Conduct, and Issues Template (#746)

* Add contributing draft

* Add code of conduct

* Add issues template

* Update bug_report.md

* Create codecov.yml

Split coverage into gui and non-gui counterpart

* Update codecov.yml

* Update codecov.yml

* Create multiple analysis files for multi-video projects (#768)

* Create occupancy matrix (h5) for single video at a time

* Write additional project metadata to the analysis file (for verification purposes)

* Add GUI option to export analysis of all videos

* Change `sleap-convert` to output one analysis file per video in project

* Use default filename for analysis files if multiple videos

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

* Update tracking docs (#761)

* Convert gui and proofreading rst files to md
* Add section in proofreading for culling target instances
* Add propagate track labels docs to gui and proofreading

Co-authored-by: Arlo Sheridan <[email protected]>

* Generate suggestions for videos with less frames than samples per video (#781)

* Add support for videos that have fewer frames than the Sample Stride length.

* Add support for videos that have less frames than the desired (random) Samples per Video (#783)

Allow suggestions to be generated randomly for all videos regardless of number of frames.

* Add button to toggle grayscale

* Revert "Add button to toggle grayscale"

This reverts commit 5d71030.

* Add button to toggle grayscale of current video (#788)

* Analysis HDF5 should prefer user-labeled instance over predicted instance (#772)

* Prefer same frame/track user-instances over predicted-instances when writing analysis hdf5

* Choose video to generate suggestions (#786)

Add option for users to select a certain video or all videos to generate suggestion(s) for.

* Add CLI sleap-render command to render videos (#796)

Sleap-render added to CLI & Updated docs

* Allow user to set grayscale when replacing videos (mp4/avi only)  (#787)

* Support grayscale for SingleImageVideo backend (#789)

* Fix h5py dependency (#815)

* Remove low-scoring predictions before merging inference results (#817)

* SLEAP v1.2.4

* SLEAP v1.2.4

No version left behind

* Remove cli.rst (back from the dead)

* Add read/write adaptor for ndx-pose (#835)

- Reads/writes predicted instances to NWB file.

* Change existing skeleton to match skeleton loaded via "Load Skeleton" button (#840)

* Fix Save As bug (#845)

* Update installation and labeling docs and no cuda yml (#847)

* Recalculate crop size if user-specified crop size indivisible by max stride (#841)

* Expose attributes of NWBFile and create Labels API for exporting to NWB (#855)

* SLEAP v1.2.5 (develop) (#856)

Update to SLEAP v1.2.5

* Fix NWB conda packaging (#860)

* Add pynwb and ndx-pose to conda packages

* Bump to v1.2.6

Co-authored-by: roomrys <[email protected]>
Co-authored-by: sheridana <[email protected]>
Co-authored-by: Arlo Sheridan <[email protected]>
Co-authored-by: David Samy <[email protected]>

Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: sheridana <[email protected]>
Co-authored-by: Arlo Sheridan <[email protected]>
Co-authored-by: David Samy <[email protected]>
@dprotter dprotter mentioned this issue Jan 5, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants