-
Notifications
You must be signed in to change notification settings - Fork 109
Self-contain sleap.nn
code
#2159
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
Comments
I think the tough part of the refactor here will be the config. The config (
(1) is specific to the backend implementation. The The training config editor is overdue for a refresh and we have to gut it no matter what. I propose we have two UIs: a simple one with the most common presets and parameters, and another that is basically a field-value table that has the full list of config items. The first requires explicit mappings, but this would be more manageable with fewer fields. The second could be auto populated from a schema, so no change required for the different backends -- and it exposes all the settings for advanced users automatically. (2) could be made to be a bit more abstracted from the backend and is probably the right pattern, but it'll take a bit of work to implement. We need to list out what properties of the model are necessary in the GUI (e.g., model type, number of labeled frames, etc.) in a dataclass. Then we have something that pulls out or infers these values from the config. The tricky decoupling will need to deal with config fields that are computed on the fly downstream. For example, some config fields are inferred from the data, which requires iterating over the dataset so we defer those to model building in the backend. Some of this logic is in the network factories themselves (e.g., the UNet class), so it's hard to not duplicate that logic if we can't import |
Uh oh!
There was an error while loading. Please reload this page.
Goal
The goal of the PRs that solve this issue is to self-contain the
sleap.nn
code and essentially create a "sleap-nn
" placeholder. Unlikesleap-nn
which has turned into a long-develop project, the PRs that solve this issue will basically just rearrange existing code so that all thesleap.nn
code is self contained and can be moved to it's own package. This will also support 🤞🏼 seamless replacement with the actualsleap-nn
package.Caveat
However, there are a few places where
sleap.gui
imports from thesleap.nn
code. Here we keep track of those places and plan resolutions (which will also affect the main sleap repo). Ideally,sleap.nn
code is ONLY used (and only needssleap-nn
installation) IF the user wants to run training through the GUI.Suggestion
We find that often, we access the model and training job config classes through the GUI - which is expected as we want to be able to write training configuration and load model/training configurations from the GUI. Perhaps the best place for these classes is in the middle-man
sleap-io
library?Places where
sleap.nn
code is used (outside ofsleap.nn
)sleap/__init__.py
sleap/sleap/__init__.py
Lines 14 to 21 in ad7c563
sleap/instance.py
LabeledFrame.plot
uses methods fromsleap.nn.viz
LabeledFrame.plot_predicted
uses methods fromsleap.nn.viz
sleap.nn.viz
functions tosleap.utils
#2168sleap/gui/learning/config.py
ConfigFileInfo.from_config_file
usessleap.nn.config.TrainingJobConfig
TrainingJobConfigsGetter.try_loading_path
usessleap.nn.config.TrainingJobConfig
sleap/gui/learning/datagen.py
show_datagen_preview
usessleap.nn.data.providers.LabelsReader
make_datagen_results
uses methods fromsleap.nn.data
sleap/gui/learning/receptivefield.py
receptive_field_info_from_model_cfg
usessleap.nn.model.ModelConfig
andsleap.nn.model.Model
ReceptiveFieldWidget.setModelConfig
usessleap.nn.model.ModelConfig
sleap/gui/learning/runners.py
write_pipeline_files
usessleap.nn.training.setup_new_run_folder
run_gui_training
usessleap.nn.training.setup_new_run_folder
train_subprocess
usessleap.nn.config.TrainingJobConfig
sleap/gui/learning/scopedkeydict.py
make_training_config_from_key_val_dict
usessleap.nn.config.TrainingJobConfig
make_model_config_from_key_val_dict
usessleap.nn.config.ModelConfig
sleap/gui/learning/base.py
ModelData.__getitem__
usessleap.nn.data.providers.VideoReader
DataOverlay.make_predictor
usessleap.nn.inference.VisualPredictor
VisualPredictor
class #2167sleap/gui/widgets/monitor.py
LossViewer.reset
usessleap.nn/config.training_job.TrainingJobConfig
TrainingJobConfig
use inLossViewer
#2162sleap/info/trackcleaner.py
fit_tracks
usessleap.nn.tracking.TrackCleaner
sleap/io/dataset.py
Labels.to_pipeline
usessleap.nn.data.pipelines
Pipeline.from_data
method #2160sleap/io/video.py
Video.to_pipeline
usessleap.nn.data.pipelines
Pipeline.from_data
method #2160The text was updated successfully, but these errors were encountered: