Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
7b5c26b
Adding pyproject.toml and src structure outline
bergsalex May 30, 2025
a850417
applying ruff formatting
bergsalex May 30, 2025
f5144b1
Adding tests for new CLI interface
bergsalex May 30, 2025
17ca46a
Cleanup of cli implementation from testing
bergsalex May 30, 2025
46131a4
Adding pytest and uv lock
bergsalex May 30, 2025
679a316
Removing tests directory from gitignore
bergsalex May 30, 2025
04ebb2f
Adding new CLI definitions for all inference commands
bergsalex Jun 2, 2025
4a9472c
Merge pull request #36 from KumarLabJax/YODA-128-build-new-cli-module…
bergsalex Jun 2, 2025
b9cb119
Automatic formatting
bergsalex Jun 2, 2025
1e7de81
Code comment cleanup
bergsalex Jun 2, 2025
77f7da3
Cleanup tests
bergsalex Jun 2, 2025
9e204f8
Merge pull request #37 from KumarLabJax/YODA-128-build-new-cli-module…
bergsalex Jun 30, 2025
1272649
Merge remote-tracking branch 'origin' into repository-reorganization
bergsalex Jun 30, 2025
99a1cb4
Renaming root package to
bergsalex Jun 30, 2025
45bcfd3
Updating root __version__ and pyproject.toml package references
bergsalex Jun 30, 2025
f05887c
Merge pull request #41 from KumarLabJax/shorten-package-name
bergsalex Jul 1, 2025
e00152b
Refactoring pose utilities and adding tests
bergsalex Jul 1, 2025
aa5fa6d
Adding two missed test files
bergsalex Jul 1, 2025
50b331c
Moving all non top-level code files into the src directory and fixing…
bergsalex Jul 1, 2025
be32b3f
Adding typing to array utils
bergsalex Jul 1, 2025
39318e6
Merge pull request #42 from KumarLabJax/refactor-pose-utils
bergsalex Jul 1, 2025
182b331
Merge pull request #43 from KumarLabJax/move-non-top-level-files
bergsalex Jul 1, 2025
3d9090d
Adding tests for pose inspect, and adding to CLI
bergsalex Jul 1, 2025
3f32045
Fixing imports for CLI modules
bergsalex Jul 1, 2025
b020b86
Adding inspect functions to pose.inspect module
bergsalex Jul 2, 2025
b34500c
Switch pose inspect functions to use dict literal syntax
bergsalex Jul 7, 2025
26e1217
Specifying tf torch and jax related dependencies and updating lock file
bergsalex Jul 7, 2025
a524c07
Merge remote-tracking branch 'origin/fix-tf-pytorch-jax-dependencies'…
bergsalex Jul 7, 2025
9d178de
Merge pull request #44 from KumarLabJax/implement-single-pose-qa
bergsalex Jul 7, 2025
2fff3f5
Adding pose converter functions with tests
bergsalex Jul 7, 2025
b7d9b3e
Adding fecal_boli related code and associated tests
bergsalex Jul 7, 2025
5995ee0
Adding remaining tests for utils.static_objects module
bergsalex Jul 7, 2025
0228f49
Remove jax dependency
bergsalex Jul 7, 2025
30c956d
Merge pull request #45 from KumarLabJax/fix-tf-pytorch-jax-dependencies
bergsalex Jul 7, 2025
07b6098
Merge remote-tracking branch 'origin/repository-reorganization' into …
bergsalex Jul 7, 2025
b216cc1
Adding tests for the utils.writers module
bergsalex Jul 8, 2025
912f4ca
Migrate fecal_boli CLI definition
bergsalex Jul 8, 2025
37b4e63
Finishing up initial utils CLI comands
bergsalex Jul 8, 2025
e2e4160
Addressing PR comments
bergsalex Jul 10, 2025
6cc4bf9
Merge pull request #46 from KumarLabJax/migrate-remaining-commands
bergsalex Jul 10, 2025
bbed089
Rewriting VideoObservations.stitch_greedy_tracklets method and adding…
bergsalex Jul 10, 2025
f808fb1
Update pyproject toml and lock file dependencies based on reconciliat…
bergsalex Jul 10, 2025
fe6a98e
Adding dockerfile definition to extend colab image with mouse_trackin…
bergsalex Jul 10, 2025
2df043b
Dockerfile should end with a newline
bergsalex Jul 10, 2025
07075db
First pass at segmentation utils unit tests
bergsalex Jul 11, 2025
b34757c
Better docstrings in new segmentation utils tests
bergsalex Jul 11, 2025
e5ceb4f
Update CLI tests for Utils commands
bergsalex Jul 11, 2025
d31f0dd
Adding additional tests for merge_multiple_seg_instances when no data…
bergsalex Jul 11, 2025
127a247
Merge remote-tracking branch 'origin/main' into migrate-inference-com…
bergsalex Jul 11, 2025
e510c76
Fill out implementation of inference cli commands
bergsalex Jul 11, 2025
5553b8d
Updating tests for inference CLI
bergsalex Jul 11, 2025
158ce02
Fix pytorch_inference models import
bergsalex Jul 11, 2025
e82b2db
Merge remote-tracking branch 'origin/main' into repository-reorganiza…
bergsalex Jul 11, 2025
91a3b60
Updating nextflow command calls to use new Typer CLI
bergsalex Jul 11, 2025
20db522
Merge pull request #49 from KumarLabJax/reconcile-dependencies-with-c…
bergsalex Jul 15, 2025
ca1a33d
Merge pull request #48 from KumarLabJax/improve-stich-tracklets-perfo…
bergsalex Jul 15, 2025
3de3ab6
Merge pull request #51 from KumarLabJax/update-cli-utils-tests
bergsalex Jul 15, 2025
c1f74bd
Add missing newline
bergsalex Jul 15, 2025
b718657
Add unit tests for generate_greedy_tracklets and _calculate_costs
bergsalex Jul 15, 2025
8863a01
Early implementation of vectorized calculate_costs
bergsalex Jul 16, 2025
b190fd5
Merge pull request #50 from KumarLabJax/tests-for-segmentation-utils
bergsalex Jul 17, 2025
69eb091
Merge pull request #52 from KumarLabJax/migrate-inference-commands
bergsalex Jul 17, 2025
68246c4
Merge pull request #53 from KumarLabJax/migrate-nextflow-command-calls
bergsalex Jul 23, 2025
f02a41c
Vectorizing greedy matching and adding associated tests
bergsalex Jul 23, 2025
65312e5
Update comments
bergsalex Jul 23, 2025
581b68b
Cleanup of test organization and removing old utils.matching file
bergsalex Jul 24, 2025
bc3ec73
Merge pull request #55 from KumarLabJax/improve-generate-tracklets-pe…
bergsalex Aug 4, 2025
9ec24e1
Apply formatting fixes to matching code and tests
bergsalex Aug 5, 2025
8f08d80
Merge remote-tracking branch 'origin/repository-reorganization' into …
bergsalex Aug 5, 2025
1957ec5
Removing commented out class definition
bergsalex Aug 5, 2025
3283eeb
Merge pull request #57 from KumarLabJax/improve-generate-tracklets-pe…
bergsalex Aug 7, 2025
c99ccd8
Merge remote-tracking branch 'origin/main' into repository-reorganiza…
bergsalex Aug 14, 2025
988f9eb
Adding PR verification action
bergsalex Aug 14, 2025
d4ba198
Testing docker image build
bergsalex Aug 14, 2025
15f78a8
Testing node cleanup
bergsalex Aug 14, 2025
34aaff3
Debug image size
bergsalex Aug 14, 2025
11ae9b6
Testing GCP Cloud Build
bergsalex Aug 14, 2025
abf0670
Docker build in github with custom base image
bergsalex Aug 15, 2025
14791c4
Fix uv python location in Dockerfile
bergsalex Aug 15, 2025
1113b3c
Refactor github actions and split test and lint dev dependencies
bergsalex Aug 15, 2025
b753929
Fix optional workflow call inputs
bergsalex Aug 15, 2025
a7b096e
Limit dependency install to lint only on format-lint action
bergsalex Aug 15, 2025
a45ddd2
Update singularity and docker images to remove Google Colab dependency
bergsalex Aug 19, 2025
8b4d774
Apply automated ruff check fixes
bergsalex Aug 19, 2025
db4aa5b
Apply ruff auto-formatting
bergsalex Aug 19, 2025
b0cd05f
Merge pull request #66 from KumarLabJax/YODA-220-fix-mouse-tracking-r…
bergsalex Aug 19, 2025
45c3133
Manual fixes for ruff linting errors
bergsalex Aug 19, 2025
e71c501
Merge remote-tracking branch 'origin/repository-reorganization' into …
bergsalex Aug 19, 2025
a749f69
Fix description of CLI per-file lint ignore
bergsalex Aug 19, 2025
e40b935
Adding auto-formatting for manually changed files
bergsalex Aug 19, 2025
6dbd9f0
Merge pull request #67 from KumarLabJax/YODA-220-fix-mouse-tracking-r…
bergsalex Aug 19, 2025
4ed0a5d
Allow setting model directory with environment variable
bergsalex Aug 19, 2025
284b51a
Adding new root config file
bergsalex Aug 19, 2025
22af770
Merge branch 'repository-reorganization' into YODA-219-update-the-mod…
bergsalex Aug 19, 2025
6eab176
Adding newline at end of Dockerfile
bergsalex Aug 19, 2025
f0b8141
Merge remote-tracking branch 'origin/repository-reorganization' into …
bergsalex Aug 19, 2025
3f01a97
Revise vm/README language, update base image CUDE to match pyproject.…
bergsalex Aug 19, 2025
36c90ca
Merge remote-tracking branch 'origin/YODA-217-update-mouse-tracking-r…
bergsalex Aug 19, 2025
d096b61
Temporarily enable PR action on merges to repository-reorganizatiom b…
bergsalex Aug 19, 2025
627585e
Adding cpu group option to add pytorch tf in tests
bergsalex Aug 19, 2025
c3d9b18
Fixing macos torch index mismatch bug and fixing extra cpu flag in te…
bergsalex Aug 19, 2025
b50b9ea
Debugging missing pytorch
bergsalex Aug 19, 2025
976ebe8
Specifying pytorch-cpu index in GH Actions test step
bergsalex Aug 19, 2025
0ccf604
Removing pytorch-cpu repository
bergsalex Aug 19, 2025
1add278
Explicitly specify pypi index
bergsalex Aug 19, 2025
e049320
Explicitly set pypi index
bergsalex Aug 19, 2025
3e9c91f
Force pytorch install with uv pip
bergsalex Aug 19, 2025
cea427e
Fix locally failing tests
bergsalex Aug 19, 2025
19f2a07
Testing if NO_COLOR=1 env fixes formatting issue in Github Actions Tests
bergsalex Aug 20, 2025
a90b3a7
Fixing auto formatting
bergsalex Aug 20, 2025
f4ccf11
Testing TTY_COMPATIBLE and TERM env vars to get CLI tests to pass in …
bergsalex Aug 20, 2025
6b0952f
Fixing terminal issues in GitHub Actions unit tests, and mocking csv …
bergsalex Aug 20, 2025
dd6e544
Fix additional terminal errors in GitHub Actions tests
bergsalex Aug 20, 2025
837535b
Fix CUDA version in readme and fix --extra install instructions
bergsalex Aug 20, 2025
e53b312
Merge pull request #65 from KumarLabJax/YODA-217-update-mouse-trackin…
bergsalex Aug 20, 2025
4bc4843
Merge remote-tracking branch 'origin/repository-reorganization' into …
bergsalex Aug 20, 2025
87a151c
Switch from GitHub Artifacts to Docker Hub
bergsalex Aug 21, 2025
f8860dd
Address PR comments
bergsalex Aug 21, 2025
538ddaf
Deleting mouse-tracking-runtime directory, moving some old files to l…
bergsalex Aug 21, 2025
ef081b6
Merge pull request #68 from KumarLabJax/YODA-219-update-the-model-loc…
bergsalex Aug 21, 2025
462366a
Merge pull request #70 from KumarLabJax/cleanup-before-reorganization…
bergsalex Aug 21, 2025
65f3cfa
Merge pull request #69 from KumarLabJax/task/add-github-actions
bergsalex Aug 21, 2025
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
50 changes: 50 additions & 0 deletions .github/workflows/_build-docker-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Build Docker Image'
on:
workflow_call:
env:
REGISTRY: docker.io
IMAGE_NAME: aberger4/mouse-tracking
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: aberger4
password: ${{ secrets.DOCKER_SECRET }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
33 changes: 33 additions & 0 deletions .github/workflows/_format-lint-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Lint Code Definition'
on:
workflow_call:
inputs:
python-version:
description: 'Python version to set up'
required: false
default: '3.10'
type: string
jobs:
format-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install dependencies with uv
run: uv sync --only-group lint

- name: Run Ruff Linter
run: uv run --only-group lint ruff check src/ tests/

- name: Run Ruff Formatter
run: uv run --only-group lint ruff format --check src/ tests/
38 changes: 38 additions & 0 deletions .github/workflows/_run-tests-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Python Tests Definition'
on:
workflow_call:
inputs:
python-version:
description: Python version to set up'
required: false
default: '3.10'
type: string
runner-os:
description: 'Runner OS'
required: false
default: 'ubuntu-latest'
type: string
jobs:
run-tests:
runs-on: ${{ inputs.runner-os }}
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install dependencies with uv
run: uv sync --extra cpu

- name: Make Sure PyTorch is Installed
run: uv pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cpu

- name: Test with pytest
run: uv run pytest tests
20 changes: 20 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pull Request Checks

on:
pull_request:
branches: [ main, repository-reorganization ]

jobs:
format-lint:
name: "Format and Lint"
uses: ./.github/workflows/_format-lint-action.yml

test:
name: "Run Tests"
needs: format-lint
uses: ./.github/workflows/_run-tests-action.yml

build:
name: "Build Docker Image"
needs: [format-lint, test]
uses: ./.github/workflows/_build-docker-action.yml
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
__pycache__
models
work
tests
!mouse-tracking-runtime/models
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM aberger4/mouse-tracking-base:python3.10-slim

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

ENV UV_SYSTEM_PYTHON=1 \
UV_PYTHON=/usr/local/bin/python \
PYTHONUNBUFFERED=1

# Copy metadata first for layer caching
COPY pyproject.toml uv.lock* README.md ./

# Only install runtime dependencies
RUN uv sync --frozen --no-group dev --no-group test --no-group lint --no-install-project

# Now add source and install the project itself
COPY src ./src

RUN uv pip install --system .

CMD ["mouse-tracking-runtime", "--help"]
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,70 @@ This repository uses both Pytorch and Tensorflow Serving (TFS).

# Installation

Both Google Colab and singularity environments are supported. This environment is used because it is a convenient method to have both pytorch and tensorflow present.
## Runtime Environments

## Singularity Containers
This repository supports both Docker and Singularity environments.

See the [container definition file](vm/deployment-runtime-RHEL9.def) in the vm folder. This container is based off a google colab public docker.
The dockerfile is provided at the root of the repository ([Dockerfile](Dockerfile)), and the singularity
definition file is in the `vm` folder ([singularity.def](vm/singularity.def)).

To learn more about how we support this, please read [vm/README.md](vm/README.md).

## Development
This repository uses [uv](https://uv.run/) to manage multiple python environments.
To install uv, see the [uv installation instructions](https://uv.run/docs/installation).

To create the development environment, run:
```
uv sync --extra cpu
```

If you happen to have access to a GPU, you can create a GPU-enabled environment with:
```
uv sync --extra gpu
```

# Available Models

See [model docs](docs/models.md) for information about available models.

## Model Directory Configuration

The model directory can be configured at runtime using environment variables or nextflow parameters:

### Environment Variable
Set the `MOUSE_TRACKING_MODEL_DIRECTORY` environment variable:
```bash
export MOUSE_TRACKING_MODEL_DIRECTORY=/path/to/your/models
```

### Nextflow Parameter
Use the `--model_dir` parameter when running nextflow:
```bash
nextflow run main.nf --model_dir /path/to/your/models --input_batch video_batch.txt --workflow single-mouse
```

### Default Location
By default, models are expected at `/kumar_lab_models/models/`. The directory structure should follow:
```
models/
├── pytorch-models/
│ ├── single-mouse-pose/
│ ├── multi-mouse-pose/
│ └── fecal-boli/
└── tfs-models/
├── single-mouse-segmentation/
├── multi-mouse-segmentation/
├── multi-mouse-identity/
├── static-object-arena/
├── static-object-food/
└── static-object-lixit/
```

# Running a pipeline

Pipelines are run using nextflow. For a list of all available parameters, see [nextflow parameters](nextflow.config). Not all parameters will affect all pipeline workflows.
Pipelines are run using nextflow. For a list of all available parameters, see
[nextflow parameters](nextflow.config). Not all parameters will affect all pipeline workflows.

You will need a batch file that lists the input files to process.

Expand Down
5 changes: 5 additions & 0 deletions docs/legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The files in this directory are kept for reference from an earlier organization
of the project.

For the latest documentation, please refer to the main README.md file in the root
directory.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions mouse-tracking-runtime/__init__.py

This file was deleted.

71 changes: 0 additions & 71 deletions mouse-tracking-runtime/aggregate_fecal_boli.py

This file was deleted.

Loading