Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .codeboarding/Advanced_Analysis_Post_processing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
```mermaid

graph LR

Multi_Animal_Tracking["Multi-Animal Tracking"]

Refinement["Refinement"]

Post_processing["Post-processing"]

Pose_Estimation_3D["Pose Estimation 3D"]

Multi_Animal_Tracking -- "provides to" --> Refinement

Refinement -- "provides to" --> Post_processing

Refinement -- "provides to" --> Pose_Estimation_3D

Pose_Estimation_3D -- "uses" --> Post_processing

click Post_processing href "https://github.com/DeepLabCut/DeepLabCut/blob/main/.codeboarding//Post_processing.md" "Details"
Copy link

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

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

There’s an extra slash in the URL path (.codeboarding//Post_processing.md), which may break the link. Please remove the duplicate slash.

Suggested change
click Post_processing href "https://github.com/DeepLabCut/DeepLabCut/blob/main/.codeboarding//Post_processing.md" "Details"
click Post_processing href "https://github.com/DeepLabCut/DeepLabCut/blob/main/.codeboarding/Post_processing.md" "Details"

Copilot uses AI. Check for mistakes.

```



[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Details



The `Advanced Analysis & Post-processing` subsystem is crucial for transforming raw pose estimation outputs into refined, accurate, and insightful behavioral data. It encompasses several key stages, including multi-animal identity management, data cleaning, 3D reconstruction, and general data enhancement. This modular design aligns with the project's emphasis on a pipeline-driven and data-centric architecture, ensuring that each step of data refinement is handled by specialized, decoupled components.



### Multi-Animal Tracking

This component is responsible for maintaining individual identities across frames in multi-animal scenarios. It includes functionalities for training and inference of re-identification models (e.g., DLCTrans), creating tracking datasets, and preprocessing tracking data. Its purpose is to enable the analysis of complex social behaviors by ensuring consistent individual identification.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_tracking_pytorch/apis.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_tracking_pytorch/apis.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_tracking_pytorch/create_dataset.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_tracking_pytorch/create_dataset.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_tracking_pytorch/tracking_utils/preprocessing.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_tracking_pytorch/tracking_utils/preprocessing.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_tracking_pytorch/train_dlctransreid.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_tracking_pytorch/train_dlctransreid.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_tracking_pytorch/inference.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_tracking_pytorch/inference.py`</a>





### Refinement

This component focuses on improving the quality and continuity of pose estimation and tracking data. It identifies and corrects outlier frames (e.g., using statistical models like SARIMAX) and stitches fragmented tracklets to ensure smooth and accurate trajectories for each individual. This is vital for downstream analysis accuracy.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/refine_training_dataset/outlier_frames.py" target="_blank" rel="noopener noreferrer">`deeplabcut/refine_training_dataset/outlier_frames.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/refine_training_dataset/tracklets.py" target="_blank" rel="noopener noreferrer">`deeplabcut/refine_training_dataset/tracklets.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/refine_training_dataset/stitch.py" target="_blank" rel="noopener noreferrer">`deeplabcut/refine_training_dataset/stitch.py`</a>





### Post-processing [[Expand]](./Post_processing.md)

This component provides general post-processing functionalities for the pose estimation results. This includes applying various filters to smooth trajectories, correcting minor errors, and analyzing the skeleton (e.g., calculating bone lengths or angles) to derive higher-level behavioral metrics. It serves as a versatile tool for data enhancement.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/post_processing/analyze_skeleton.py" target="_blank" rel="noopener noreferrer">`deeplabcut/post_processing/analyze_skeleton.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/post_processing/filtering.py" target="_blank" rel="noopener noreferrer">`deeplabcut/post_processing/filtering.py`</a>





### Pose Estimation 3D

This component specializes in reconstructing 3D poses from 2D estimations, which is essential for depth perception and more accurate spatial analysis. It handles multi-view camera calibration, triangulating 2D keypoints into 3D coordinates, and visualizing the reconstructed 3D poses.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_3d/camera_calibration.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_estimation_3d/camera_calibration.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_3d/plotting3D.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_estimation_3d/plotting3D.py`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_3d/triangulation.py" target="_blank" rel="noopener noreferrer">`deeplabcut/pose_estimation_3d/triangulation.py`</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
115 changes: 115 additions & 0 deletions .codeboarding/Core_Deep_Learning_Engine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
```mermaid

graph LR

Framework_Compatibility_Layer["Framework Compatibility Layer"]

TensorFlow_Deep_Learning_Engine["TensorFlow Deep Learning Engine"]

PyTorch_Deep_Learning_Engine["PyTorch Deep Learning Engine"]

Framework_Compatibility_Layer -- "Uses" --> TensorFlow_Deep_Learning_Engine

Framework_Compatibility_Layer -- "Uses" --> PyTorch_Deep_Learning_Engine

```



[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Details



The `Core Deep Learning Engine` subsystem in DeepLabCut is designed to abstract the complexities of underlying deep learning frameworks (TensorFlow/PyTorch) while providing robust capabilities for neural network model definition, training, inference (pose prediction), and internal evaluation. This modular design adheres to the project's emphasis on decoupling high-level application flow from specific deep learning implementations.



### Framework Compatibility Layer

This component acts as a crucial abstraction layer, offering a unified interface for the rest of the DeepLabCut application to interact seamlessly with either the TensorFlow or PyTorch deep learning backends. It encapsulates framework-specific calls, allowing for flexible switching between implementations without altering higher-level logic.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/compat.py#L657-L975" target="_blank" rel="noopener noreferrer">`deeplabcut.compat.analyze_videos` (657:975)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/compat.py#L978-L1108" target="_blank" rel="noopener noreferrer">`deeplabcut.compat.create_tracking_dataset` (978:1108)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/compat.py#L310-L373" target="_blank" rel="noopener noreferrer">`deeplabcut.compat.return_train_network_path` (310:373)</a>





### TensorFlow Deep Learning Engine

This component is the dedicated computational engine for all deep learning operations performed using the TensorFlow framework. It encompasses the definition, training, and inference of neural network models for pose estimation, along with utilities for dataset management and model configuration specific to TensorFlow.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_tensorflow/nnets/base.py#L18-L245" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_tensorflow.nnets.base.BasePoseNet` (18:245)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_tensorflow/datasets/pose_base.py#L16-L36" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_tensorflow.datasets.pose_base.BasePoseDataset` (16:36)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_tensorflow/core/train.py#L146-L313" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_tensorflow.core.train` (146:313)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_tensorflow/core/predict.py" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_tensorflow.core.predict`</a>





### PyTorch Deep Learning Engine

This component provides the core deep learning functionalities for model definition, training, and inference within the PyTorch framework. It includes a comprehensive set of APIs for various deep learning tasks, modules for data handling (preprocessing, post-processing), diverse model architectures (backbones, heads, loss functions), and runners to orchestrate training and inference workflows.





**Related Classes/Methods**:



- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/models/model.py#L32-L239" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.models.model.PoseModel` (32:239)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/models/backbones/base.py#L26-L83" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.models.backbones.base.BaseBackbone` (26:83)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/models/heads/base.py#L32-L140" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.models.heads.base.BaseHead` (32:140)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/models/criterions/base.py#L23-L40" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.models.criterions.base.BaseCriterion` (23:40)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/data/base.py#L36-L372" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.data.base.Loader` (36:372)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/runners/base.py#L51-L117" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.runners.base.Runner` (51:117)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/apis/training.py" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.apis.training`</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/apis/analyze_images.py#L217-L382" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.apis.analyze_images` (217:382)</a>

- <a href="https://github.com/DeepLabCut/DeepLabCut/blob/main/deeplabcut/pose_estimation_pytorch/apis/videos.py" target="_blank" rel="noopener noreferrer">`deeplabcut.pose_estimation_pytorch.apis.videos`</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
Loading
Loading