From 072e1d43f8f055ce8b1004ae0e4513c47d4778d0 Mon Sep 17 00:00:00 2001 From: MMathisLab Date: Thu, 16 Apr 2026 16:51:21 +0200 Subject: [PATCH 1/2] Add CI workflows for headers, spelling, and PyPI release. Introduce GitHub Actions for Python header checks, codespell, and tag-based PyPI publishing, plus a helper script to enforce standardized file headers. Made-with: Cursor --- .github/workflows/check-headers.yml | 36 ++++ .github/workflows/codespell.yml | 21 +++ .github/workflows/release-pypi.yml | 48 +++++ scripts/update_headers.py | 282 ++++++++++++++++++++++++++++ 4 files changed, 387 insertions(+) create mode 100644 .github/workflows/check-headers.yml create mode 100644 .github/workflows/codespell.yml create mode 100644 .github/workflows/release-pypi.yml create mode 100644 scripts/update_headers.py diff --git a/.github/workflows/check-headers.yml b/.github/workflows/check-headers.yml new file mode 100644 index 0000000..b44c56c --- /dev/null +++ b/.github/workflows/check-headers.yml @@ -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." \ No newline at end of file diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..d753607 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml new file mode 100644 index 0000000..e45b97f --- /dev/null +++ b/.github/workflows/release-pypi.yml @@ -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/* \ No newline at end of file diff --git a/scripts/update_headers.py b/scripts/update_headers.py new file mode 100644 index 0000000..ab35d63 --- /dev/null +++ b/scripts/update_headers.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python3 +""" +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 os +import sys +from pathlib import Path + +# Define the standard header for the project +STANDARD_HEADER = '''""" +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 +"""''' + +# Old headers that should be replaced +OLD_HEADERS = [ + '''""" + +"""''' +] + + +def should_skip_file(file_path): + """ + Determine if a file should be skipped for header addition. + + Args: + file_path: Path to check + + Returns: + True if the file should be skipped, False otherwise + """ + skip_dirs = {'.git', '__pycache__', '.pytest_cache', 'venv', 'env', '.tox', 'build', 'dist', '.eggs'} + + # Skip if in excluded directory + for part in file_path.parts: + if part in skip_dirs: + return True + + # Skip __init__.py files that are typically minimal + if file_path.name == '__init__.py': + try: + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read() + # Skip if __init__.py is very short (likely just imports) + if len(content.strip()) < 50: + return True + except Exception: + pass + + return False + + +def has_header(content): + """ + Check if content already has the standard header or a valid variant. + + Args: + content: File content to check + + Returns: + True if the file has the standard header or acceptable variant, False otherwise + """ + # Check for exact match + if STANDARD_HEADER.strip() in content: + return True + + # Check for header with additional content (like in sort.py) + # Header should contain the key elements + lines = content.split('\n') + if len(lines) < 3: + return False + + # Check if it starts with a docstring + if not lines[0].strip().startswith('"""'): + return False + + # Check for key header components in the first 15 lines + header_section = '\n'.join(lines[:15]) + required_elements = [ + 'FMPose3D: monocular 3D Pose Estimation via Flow Matching', + 'Ti Wang, Xiaohang Yu, and Mackenzie Weygandt Mathis', + 'Licensed under Apache 2.0' + ] + + return all(elem in header_section for elem in required_elements) + + +def needs_header_update(content): + """ + Check if content has an old header that needs updating. + + Args: + content: File content to check + + Returns: + Old header if found, None otherwise + """ + for old_header in OLD_HEADERS: + if old_header.strip() in content: + return old_header + return None + + +def add_or_update_header(file_path, check_only=False): + """ + Add or update the header in a single file. + + Args: + file_path: Path to the file to update + check_only: If True, only check without modifying + + Returns: + Tuple of (status, message) where status is 'ok', 'updated', 'added', or 'error' + """ + try: + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read() + + # Check if file already has the correct header + if has_header(content): + return ('ok', 'Already has correct header') + + # Check if file has an old header that needs replacing + old_header = needs_header_update(content) + if old_header: + if not check_only: + new_content = content.replace(old_header, STANDARD_HEADER) + with open(file_path, 'w', encoding='utf-8') as f: + f.write(new_content) + return ('updated', 'Replaced old header with standard header') + + # File has no header, add one + # Skip adding header to files that start with shebang or are very short + lines = content.split('\n') + if content.strip() and len(content.strip()) > 10: + if not check_only: + # Handle special cases for header placement + new_lines = [] + insert_index = 0 + + # If file starts with shebang, keep it at the top + if lines[0].startswith('#!'): + new_lines.append(lines[0]) + insert_index = 1 + + # Check for 'from __future__' imports which must be very early + # Find the first non-comment, non-shebang, non-empty line + future_import_index = None + for i in range(insert_index, min(len(lines), 10)): + line = lines[i].strip() + if line.startswith('from __future__'): + future_import_index = i + break + elif line and not line.startswith('#'): + # Found a non-comment line that isn't a future import + break + + if future_import_index is not None: + # If there's a from __future__ import, add header AFTER it + new_lines.extend(lines[insert_index:future_import_index+1]) + new_lines.append(STANDARD_HEADER) + new_lines.append('') + new_lines.extend(lines[future_import_index+1:]) + else: + # Otherwise, add header at the beginning (after shebang if present) + new_lines.append(STANDARD_HEADER) + new_lines.append('') + new_lines.extend(lines[insert_index:]) + + new_content = '\n'.join(new_lines) + + with open(file_path, 'w', encoding='utf-8') as f: + f.write(new_content) + return ('added', 'Added standard header') + + return ('ok', 'Skipped (file too short or empty)') + + except Exception as e: + return ('error', f"Error processing file: {e}") + + +def find_and_process_headers(root_dir, check_only=False): + """ + Find and process all Python files. + + Args: + root_dir: Root directory to search from + check_only: If True, only check without modifying files + + Returns: + Dictionary with statistics about processed files + """ + root_path = Path(root_dir) + stats = { + 'ok': [], + 'updated': [], + 'added': [], + 'error': [] + } + + # Find all Python files + for py_file in root_path.rglob('*.py'): + # Skip files that should not be processed + if should_skip_file(py_file): + continue + + status, message = add_or_update_header(py_file, check_only) + stats[status].append((py_file, message)) + + if status in ['updated', 'added']: + rel_path = py_file.relative_to(root_path) + print(f"{'[CHECK]' if check_only else '✓'} {rel_path}: {message}") + elif status == 'error': + rel_path = py_file.relative_to(root_path) + print(f"✗ {rel_path}: {message}") + + return stats + + +def main(): + """Main function to run the header update script.""" + check_only = '--check' in sys.argv + + if len(sys.argv) > 1 and not sys.argv[1].startswith('--'): + root_dir = Path(sys.argv[1]) + else: + root_dir = Path(os.getcwd()) + + mode = "Checking" if check_only else "Processing" + print(f"{mode} files for headers in: {root_dir}") + print("-" * 60) + + stats = find_and_process_headers(root_dir, check_only) + + print("-" * 60) + + # Print summary + total_changes = len(stats['updated']) + len(stats['added']) + + if check_only: + if total_changes > 0: + print(f"\n⚠ Found {total_changes} file(s) needing header updates:") + for file_path, msg in stats['updated']: + print(f" - {file_path.relative_to(root_dir)}: {msg}") + for file_path, msg in stats['added']: + print(f" - {file_path.relative_to(root_dir)}: {msg}") + return 1 + else: + print("\n✓ All Python files have correct headers!") + return 0 + else: + if total_changes > 0: + print(f"\n✓ Successfully processed {total_changes} file(s):") + if stats['updated']: + print(f" - Updated: {len(stats['updated'])} file(s)") + if stats['added']: + print(f" - Added headers: {len(stats['added'])} file(s)") + else: + print("\n✓ No files needed header updates.") + + if stats['error']: + print(f"\n✗ Errors: {len(stats['error'])} file(s)") + for file_path, msg in stats['error']: + print(f" - {file_path.relative_to(root_dir)}: {msg}") + return 1 + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) \ No newline at end of file From 9cf04e7d8b5a2991951668a37d0ef05634d761d9 Mon Sep 17 00:00:00 2001 From: MMathisLab Date: Thu, 16 Apr 2026 16:54:16 +0200 Subject: [PATCH 2/2] Apply standard PRIMA headers across Python source files. Run the header updater script repo-wide to add the project-standard file header to Python modules and scripts for consistent licensing and attribution metadata. Made-with: Cursor --- app.py | 9 +++++++++ demo.py | 9 +++++++++ demo_tta.py | 9 +++++++++ eval.py | 9 +++++++++ prima/__init__.py | 9 +++++++++ prima/configs/__init__.py | 9 +++++++++ prima/datasets/__init__.py | 9 +++++++++ prima/datasets/datasets.py | 9 +++++++++ prima/datasets/dlc2coco.py | 9 +++++++++ prima/datasets/split_acinoset.py | 9 +++++++++ prima/datasets/utils.py | 9 +++++++++ prima/datasets/vitdet_dataset.py | 9 +++++++++ prima/models/__init__.py | 9 +++++++++ prima/models/backbones/__init__.py | 9 +++++++++ prima/models/backbones/vit.py | 9 +++++++++ prima/models/bioclip_embedding.py | 9 +++++++++ prima/models/components/model_utils.py | 9 +++++++++ prima/models/components/pose_transformer.py | 9 +++++++++ prima/models/components/position_encoding.py | 9 +++++++++ prima/models/components/t_cond_mlp.py | 9 +++++++++ prima/models/components/transformer.py | 9 +++++++++ prima/models/discriminator.py | 9 +++++++++ prima/models/heads/classifier_head.py | 9 +++++++++ prima/models/heads/smal_head.py | 9 +++++++++ prima/models/losses.py | 9 +++++++++ prima/models/prima.py | 9 +++++++++ prima/models/smal_wrapper.py | 9 +++++++++ prima/utils/__init__.py | 9 +++++++++ prima/utils/evaluate_metric.py | 9 +++++++++ prima/utils/geometry.py | 9 +++++++++ prima/utils/mesh_renderer.py | 9 +++++++++ prima/utils/misc.py | 9 +++++++++ prima/utils/pylogger.py | 9 +++++++++ prima/utils/renderer.py | 9 +++++++++ prima/utils/rich_utils.py | 9 +++++++++ train.py | 9 +++++++++ 36 files changed, 324 insertions(+) diff --git a/app.py b/app.py index 85d65f8..eb3c353 100644 --- a/app.py +++ b/app.py @@ -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 diff --git a/demo.py b/demo.py index 63ad88e..2a68d82 100644 --- a/demo.py +++ b/demo.py @@ -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 diff --git a/demo_tta.py b/demo_tta.py index 0140d26..3980d3d 100644 --- a/demo_tta.py +++ b/demo_tta.py @@ -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 diff --git a/eval.py b/eval.py index a5119a8..b7031c5 100644 --- a/eval.py +++ b/eval.py @@ -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 diff --git a/prima/__init__.py b/prima/__init__.py index 1ab2336..a653e90 100644 --- a/prima/__init__.py +++ b/prima/__init__.py @@ -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 diff --git a/prima/configs/__init__.py b/prima/configs/__init__.py index 22925ea..2c465c6 100644 --- a/prima/configs/__init__.py +++ b/prima/configs/__init__.py @@ -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 diff --git a/prima/datasets/__init__.py b/prima/datasets/__init__.py index 4775b7c..f05024b 100644 --- a/prima/datasets/__init__.py +++ b/prima/datasets/__init__.py @@ -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 diff --git a/prima/datasets/datasets.py b/prima/datasets/datasets.py index 915d731..b28cef2 100644 --- a/prima/datasets/datasets.py +++ b/prima/datasets/datasets.py @@ -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 diff --git a/prima/datasets/dlc2coco.py b/prima/datasets/dlc2coco.py index b5e3fda..9e4d298 100644 --- a/prima/datasets/dlc2coco.py +++ b/prima/datasets/dlc2coco.py @@ -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. diff --git a/prima/datasets/split_acinoset.py b/prima/datasets/split_acinoset.py index 9e1e395..aeb327d 100644 --- a/prima/datasets/split_acinoset.py +++ b/prima/datasets/split_acinoset.py @@ -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). diff --git a/prima/datasets/utils.py b/prima/datasets/utils.py index 70a51e9..3add793 100644 --- a/prima/datasets/utils.py +++ b/prima/datasets/utils.py @@ -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 diff --git a/prima/datasets/vitdet_dataset.py b/prima/datasets/vitdet_dataset.py index 1f2bd54..55ba785 100644 --- a/prima/datasets/vitdet_dataset.py +++ b/prima/datasets/vitdet_dataset.py @@ -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 diff --git a/prima/models/__init__.py b/prima/models/__init__.py index 276ed24..6cc213e 100644 --- a/prima/models/__init__.py +++ b/prima/models/__init__.py @@ -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 diff --git a/prima/models/backbones/__init__.py b/prima/models/backbones/__init__.py index 3beabe4..fedb1b1 100644 --- a/prima/models/backbones/__init__.py +++ b/prima/models/backbones/__init__.py @@ -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 diff --git a/prima/models/backbones/vit.py b/prima/models/backbones/vit.py index 1602a9a..b08b625 100644 --- a/prima/models/backbones/vit.py +++ b/prima/models/backbones/vit.py @@ -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 diff --git a/prima/models/bioclip_embedding.py b/prima/models/bioclip_embedding.py index 456a513..1f1ebd5 100644 --- a/prima/models/bioclip_embedding.py +++ b/prima/models/bioclip_embedding.py @@ -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 diff --git a/prima/models/components/model_utils.py b/prima/models/components/model_utils.py index b0343aa..16d8a5a 100644 --- a/prima/models/components/model_utils.py +++ b/prima/models/components/model_utils.py @@ -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. diff --git a/prima/models/components/pose_transformer.py b/prima/models/components/pose_transformer.py index eb7d1e6..698e30b 100644 --- a/prima/models/components/pose_transformer.py +++ b/prima/models/components/pose_transformer.py @@ -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 diff --git a/prima/models/components/position_encoding.py b/prima/models/components/position_encoding.py index ae9c830..8456b77 100644 --- a/prima/models/components/position_encoding.py +++ b/prima/models/components/position_encoding.py @@ -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. diff --git a/prima/models/components/t_cond_mlp.py b/prima/models/components/t_cond_mlp.py index 9648987..df2e931 100644 --- a/prima/models/components/t_cond_mlp.py +++ b/prima/models/components/t_cond_mlp.py @@ -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 diff --git a/prima/models/components/transformer.py b/prima/models/components/transformer.py index 018c47c..5e42ddf 100644 --- a/prima/models/components/transformer.py +++ b/prima/models/components/transformer.py @@ -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. diff --git a/prima/models/discriminator.py b/prima/models/discriminator.py index 526de33..1465965 100644 --- a/prima/models/discriminator.py +++ b/prima/models/discriminator.py @@ -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 diff --git a/prima/models/heads/classifier_head.py b/prima/models/heads/classifier_head.py index 092bdb0..ff034cb 100644 --- a/prima/models/heads/classifier_head.py +++ b/prima/models/heads/classifier_head.py @@ -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 torch import nn diff --git a/prima/models/heads/smal_head.py b/prima/models/heads/smal_head.py index 57a0606..53e20b0 100644 --- a/prima/models/heads/smal_head.py +++ b/prima/models/heads/smal_head.py @@ -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 import torch.nn.functional as F diff --git a/prima/models/losses.py b/prima/models/losses.py index fc985a9..971c0c8 100644 --- a/prima/models/losses.py +++ b/prima/models/losses.py @@ -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 import numpy as np diff --git a/prima/models/prima.py b/prima/models/prima.py index 0304d30..f03bcd6 100755 --- a/prima/models/prima.py +++ b/prima/models/prima.py @@ -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 pickle import pytorch_lightning as pl diff --git a/prima/models/smal_wrapper.py b/prima/models/smal_wrapper.py index ee59386..ea9de81 100644 --- a/prima/models/smal_wrapper.py +++ b/prima/models/smal_wrapper.py @@ -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 json from torch import nn import torch diff --git a/prima/utils/__init__.py b/prima/utils/__init__.py index c0ce6dd..5a5ab0b 100755 --- a/prima/utils/__init__.py +++ b/prima/utils/__init__.py @@ -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 from typing import Any from .mesh_renderer import MeshRenderer diff --git a/prima/utils/evaluate_metric.py b/prima/utils/evaluate_metric.py index db80c73..7aa8a44 100644 --- a/prima/utils/evaluate_metric.py +++ b/prima/utils/evaluate_metric.py @@ -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 numpy as np import open3d as o3d diff --git a/prima/utils/geometry.py b/prima/utils/geometry.py index 58142c3..2dc16e8 100644 --- a/prima/utils/geometry.py +++ b/prima/utils/geometry.py @@ -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 Optional import torch from torch.nn import functional as F diff --git a/prima/utils/mesh_renderer.py b/prima/utils/mesh_renderer.py index ef33579..798bc4d 100644 --- a/prima/utils/mesh_renderer.py +++ b/prima/utils/mesh_renderer.py @@ -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 os if 'PYOPENGL_PLATFORM' not in os.environ: diff --git a/prima/utils/misc.py b/prima/utils/misc.py index ffcfe78..a22cb01 100644 --- a/prima/utils/misc.py +++ b/prima/utils/misc.py @@ -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 time import warnings from importlib.util import find_spec diff --git a/prima/utils/pylogger.py b/prima/utils/pylogger.py index 92ffa71..bb5e2f9 100644 --- a/prima/utils/pylogger.py +++ b/prima/utils/pylogger.py @@ -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 logging from pytorch_lightning.utilities import rank_zero_only diff --git a/prima/utils/renderer.py b/prima/utils/renderer.py index 2efd238..a04e05f 100644 --- a/prima/utils/renderer.py +++ b/prima/utils/renderer.py @@ -1,4 +1,13 @@ from __future__ import annotations +""" +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 os diff --git a/prima/utils/rich_utils.py b/prima/utils/rich_utils.py index d5046c2..20f8c36 100644 --- a/prima/utils/rich_utils.py +++ b/prima/utils/rich_utils.py @@ -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 from typing import Sequence diff --git a/train.py b/train.py index 9cef3de..d9bcdf7 100644 --- a/train.py +++ b/train.py @@ -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 Optional import pyrootutils