Skip to content

Commit

Permalink
Merge pull request #3 from EthoML/dev
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
katiekly authored Jun 4, 2024
2 parents 71dc5d9 + 6247cab commit de932d1
Show file tree
Hide file tree
Showing 47 changed files with 4,118 additions and 1,129 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release-vame-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Release

on:
workflow_run:
workflows: [Testing]
branches: [main]
types:
- completed
jobs:
pypi-release:
name: Release VAME in pypi
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install twine
- name: Build and publish to PyPI
run: |
python -m build
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Testing

on:
push:
branches:
- main
- dev


jobs:
run:
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install tests dependencies
run: |
python -m pip install -U pip
pip install . --no-cache-dir
pip install -r tests/requirements-tests.txt --no-cache-dir
- name: Run tests.
run: pytest --cov=src/vame --cov-report=xml --cov-report=term-missing -v

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Sample files
examples/*.mp4


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class



# C extensions
*.so


# Distribution / packaging
.Python
env/
Expand Down Expand Up @@ -91,6 +98,7 @@ celerybeat-schedule
.venv
venv/
ENV/
venv_docs/

# Spyder project settings
.spyderproject
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dockerfile for VAME pipeline
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /vame

# Copy the vame package to the working directory
COPY requirements.txt /vame
COPY pyproject.toml /vame
COPY src/ /vame/src

# Copy the demo docker example to working dir
COPY ./examples/demo_docker.py /vame

# Install vame
RUN pip install --no-cache-dir .


CMD ["python", "demo_docker.py"]



Binary file added Images/vame-workflow-diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prune tests
prune docs
prune examples
prune Images
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
![image](https://github.com/EthoML/VAME/assets/844306/0f08424f-06ab-48e4-8094-da0f0c78a08d)

<p align="center">
<a href="https://codecov.io/gh/EthoML/VAME" >
<img src="https://codecov.io/gh/EthoML/VAME/graph/badge.svg?token=J1CUXB4N0E"/>
</a>
</p>

🌟 Welcome to EthoML/VAME (Variational Animal Motion Encoding), an open-source machine learning tool for behavioral segmentation and analyses.

We are a group of behavioral enthusiasts, comprising the original VAME developers Kevin Luxem and Pavol Bauer, behavioral neuroscientists Stephanie R. Miller and Jorge J. Palop, and computer scientists and statisticians Alex Pico, Reuben Thomas, and Katie Ly). Our aim is to provide scalable, unbiased and sensitive approaches for assessing mouse behavior using computer vision and machine learning approaches.

We are focused on the expanding the analytical capabilities of VAME segmentation by providing curated scripts for VAME implementation and tools for data processing, visualization, and statistical analyses.
We are focused on the expanding the analytical capabilities of VAME segmentation by providing curated scripts for VAME implementation and tools for data processing, visualization, and statistical analyses.

## Recent Improvements to VAME
* Curated scripts for VAME implementation
Expand Down
24 changes: 3 additions & 21 deletions VAME.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,11 @@
#
# install: conda env create -f VAME.yaml
# update: conda env update -f VAME.yaml
name: VAME
name: vame
channels:
- pytorch
- defaults
dependencies:
- python=3.7
- python=3.11
- pip
- torchvision
- jupyter
- nb_conda
- pip:
- pytest-shutil
- scipy
- numpy
- matplotlib
- pathlib
- pandas
- ruamel.yaml
- sklearn
- pyyaml
- opencv-python-headless
- h5py
- umap-learn
- networkx
- tqdm
- hmmlearn
- -r requirements.txt
42 changes: 42 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Running the first demo (demo.py)

The first demo is a simple example of how to use the library.

## 1. Downloading the necessary resources:

To run the demo you will need vame package installed, follow the installation guide [here](/README.md#Installation) .
Also you will need two files to properly run the demo:
- `video-1.mp4`: A video file that will be used as input, for the demo you can download from [this link](https://drive.google.com/file/d/1w6OW9cN_-S30B7rOANvSaR9c3O5KeF0c/view)
- `video-1.csv`: the pose estimation results for the video file. You can use the video-1.csv file that is in the examples folder [video](/examples/video-1.csv)

## 2. Setting the demo variables
To start the demo you must define 4 variables. In order to do that, open the `demo.py` file and edit the following:

**The values below are just examples. You must set the variables according to your needs.**
```python
# The directory where the project will be saved
working_directory = './'

# The name you want for the project
project = 'first_vame_project'

# A list of paths to the videos file
videos = ['./video-1.mp4']

# A list of paths to the poses estimations files.
# Important: The name (without the extension) of the video file and the pose estimation file must be the same. E.g. `video-1.mp4` and `video-1.csv`
poses_estimations = ['./video-1.csv']
```

## 3. Running the demo
After setting the variables, you can run the demo by running the following code:

```python
python demo.py
```

The demo will create a project folder in the working directory with the name you defined in the `project` variable and a date suffix, e.g: `first_name-May-9-2024`.

In this folder you can find a config file called `config.yaml` where you can set the parameters for the VAME algorithm. The videos and poses estimations files will be copied to the project videos folder. If everything is ok, the workflow will run and the logs will be displayed in your terminal. The image below shows the VAME workflow.

![demo workflow](/Images/vame-workflow-diagram.jpg)
Loading

0 comments on commit de932d1

Please sign in to comment.