Skip to content
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/check-headers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Check File Headers

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check-headers:
name: Check Python file headers
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Check headers
run: |
python scripts/update_headers.py --check
continue-on-error: false

- name: Provide fix instructions
if: failure()
run: |
echo "::error::Some files are missing proper headers."
echo "To fix this, run: python scripts/update_headers.py"
echo "Then commit the changes."
21 changes: 21 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v1
with:
ignore_words_list: prima-animal, mpjpe, uvd, xyz, hm36, cpn, dbb
48 changes: 48 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update pypi release

on:
push:
tags:
- 'v*.*.*'
pull_request:
branches:
- main
types:
- labeled
- opened
- edited
- synchronize
- reopened

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Cache dependencies
id: pip-cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip

- name: Install dependencies
run: |
pip install --upgrade pip
pip install wheel
# NOTE(stes) see https://github.com/pypa/twine/issues/1216#issuecomment-2629069669
pip install "packaging>=24.2"

- name: Checkout code
uses: actions/checkout@v3

- name: Build and publish to PyPI
if: ${{ github.event_name == 'push' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
pip install build twine
python3 -m build
ls dist/
python3 -m twine upload --verbose dist/*
9 changes: 9 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""Gradio demo for PRIMA + SuperAnimal + TTA.

This script wraps the ``demo_tta.py`` pipeline into an interactive
Expand Down
9 changes: 9 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from pathlib import Path
import detectron2.config
import detectron2.engine
Expand Down
9 changes: 9 additions & 0 deletions demo_tta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""
demo_tta.py: PRIMA inference with DeepLabCut SuperAnimal TTA

Expand Down
9 changes: 9 additions & 0 deletions eval.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

import numpy as np
from tqdm import tqdm
import torch
Expand Down
9 changes: 9 additions & 0 deletions prima/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""Top-level package for PRIMA.

This package contains models, datasets and utilities for
Expand Down
9 changes: 9 additions & 0 deletions prima/configs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from typing import Dict
from yacs.config import CfgNode as CN

Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from typing import Dict, Optional
from torch.utils.data import WeightedRandomSampler
import torch
Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/datasets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

import copy
import os
import numpy as np
Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/dlc2coco.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

'''
this scripts if to convert DeepLabCut labeled data format (20 keypoints) to COCO format (26 keypoints ), also image should be extracted from the raw video to save as frames.

Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/split_acinoset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""
Split acinoset multiview_mapping.json into train and test sets (7:3 ratio).

Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""
Parts of the code are taken or adapted from
https://github.com/mkocabas/EpipolarPose/blob/master/lib/utils/img_utils.py
Expand Down
9 changes: 9 additions & 0 deletions prima/datasets/vitdet_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from typing import Dict

import cv2
Expand Down
9 changes: 9 additions & 0 deletions prima/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from .prima import PRIMA


Expand Down
9 changes: 9 additions & 0 deletions prima/models/backbones/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from .vit import vith


Expand Down
9 changes: 9 additions & 0 deletions prima/models/backbones/vit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

# Copyright (c) OpenMMLab. All rights reserved.
import math

Expand Down
9 changes: 9 additions & 0 deletions prima/models/bioclip_embedding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

"""
bioclip Embedding Module
Converts image batch to embeddings that can be concatenated with image features
Expand Down
9 changes: 9 additions & 0 deletions prima/models/components/model_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

Expand Down
9 changes: 9 additions & 0 deletions prima/models/components/pose_transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

from inspect import isfunction
from typing import Callable, Optional

Expand Down
9 changes: 9 additions & 0 deletions prima/models/components/position_encoding.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

Expand Down
9 changes: 9 additions & 0 deletions prima/models/components/t_cond_mlp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

import copy
from typing import List, Optional

Expand Down
9 changes: 9 additions & 0 deletions prima/models/components/transformer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

Expand Down
9 changes: 9 additions & 0 deletions prima/models/discriminator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"""
PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation

Official implementation of the paper:
"PRIMA: Boosting Animal Mesh Recovery with Biological Priors and Test-Time Adaptation"
by Xiaohang Yu, Ti Wang, and Mackenzie Weygandt Mathis
Licensed under a modified MIT license
"""

import torch
import torch.nn as nn

Expand Down
Loading
Loading