Skip to content

Commit

Permalink
Rename biogtr to dreem (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaprasad committed Jun 5, 2024
1 parent 152fca6 commit f04eb9f
Show file tree
Hide file tree
Showing 59 changed files with 152 additions and 152 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- "biogtr/**"
- "dreem/**"
- "tests/**"
- ".github/workflows/ci.yml"
- "environment_cpu.yml"
Expand All @@ -14,7 +14,7 @@ on:
branches:
- main
paths:
- "biogtr/**"
- "dreem/**"
- "tests/**"
- ".github/workflows/ci.yml"
- "environment_cpu.yml"
Expand Down Expand Up @@ -53,11 +53,11 @@ jobs:
- name: Run Black
run: |
black --check biogtr tests
black --check dreem tests
- name: Run pydocstyle
run: |
pydocstyle --convention=google biogtr/
pydocstyle --convention=google dreem/
# Tests with pytest
tests:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.python == 3.9 }}
shell: bash -l {0}
run: |
pytest --cov=biogtr --cov-report=xml tests/
pytest --cov=dreem --cov-report=xml tests/
- name: Upload coverage
uses: codecov/codecov-action@v3
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ logs

# vscode
.vscode
biogtr/training/.hydra/*
biogtr/training/models/*
dreem/training/.hydra/*
dreem/training/models/*
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# BioGTR
# DREEM Reconstructs Every Entities' Motion
Global Tracking Transformers for biological multi-object tracking.

## Installation
<!-- ### Basic
```
pip install biogtr
pip install dreem
``` -->
### Development
1. Clone the repository:
```
git clone https://github.com/talmolab/biogtr && cd biogtr
git clone https://github.com/talmolab/dreem && cd dreem
```
2. Set up in a new conda environment:
```
conda env create -y -f environment.yml && conda activate biogtr
conda env create -y -f environment.yml && conda activate dreem
```

### Uninstalling
```
conda env remove -n biogtr
conda env remove -n dreem
```
18 changes: 0 additions & 18 deletions biogtr/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion biogtr/cli.py

This file was deleted.

7 changes: 0 additions & 7 deletions biogtr/io/__init__.py

This file was deleted.

18 changes: 18 additions & 0 deletions dreem/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Top-level package for dreem."""

from dreem.version import __version__

from dreem.models.global_tracking_transformer import GlobalTrackingTransformer
from dreem.models.gtr_runner import GTRRunner
from dreem.models.transformer import Transformer
from dreem.models.visual_encoder import VisualEncoder

from dreem.io.frame import Frame
from dreem.io.instance import Instance
from dreem.io.association_matrix import AssociationMatrix
from dreem.io.config import Config
from dreem.io.visualize import annotate_video

# from .training import run

from dreem.inference.tracker import Tracker
1 change: 1 addition & 0 deletions dreem/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""This module contains the command line interfaces for the dreem package."""
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module containing logic for loading datasets."""

from biogtr.datasets import data_utils
from biogtr.io import Frame
from dreem.datasets import data_utils
from dreem.io import Frame
from torch.utils.data import Dataset
from typing import List, Union
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Module containing cell tracking challenge dataset."""

from PIL import Image
from biogtr.datasets import data_utils, BaseDataset
from biogtr.io import Frame, Instance
from dreem.datasets import data_utils, BaseDataset
from dreem.io import Frame, Instance
from scipy.ndimage import measurements
from typing import List, Optional, Union
import albumentations as A
Expand Down Expand Up @@ -122,7 +122,7 @@ def get_instances(self, label_idx: List[int], frame_idx: List[int]) -> List[Fram
Returns:
a list of Frame objects containing frame metadata and Instance Objects.
See `biogtr.io.data_structures` for more info.
See `dreem.io.data_structures` for more info.
"""
image = self.videos[label_idx]
gt = self.labels[label_idx]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module containing wrapper for merging gt and pred datasets for evaluation."""

from torch.utils.data import Dataset
from biogtr.io import Instance, Frame
from dreem.io import Instance, Frame
from typing import List


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Module containing microscopy dataset."""

from PIL import Image
from biogtr.datasets import data_utils, BaseDataset
from biogtr.io import Instance, Frame
from dreem.datasets import data_utils, BaseDataset
from dreem.io import Instance, Frame
from typing import Union
import albumentations as A
import numpy as np
Expand Down Expand Up @@ -122,7 +122,7 @@ def get_instances(self, label_idx: list[int], frame_idx: list[int]) -> list[Fram
frame_idx: index of the frames
Returns:
A list of Frames containing Instances to be tracked (See `biogtr.io.data_structures for more info`)
A list of Frames containing Instances to be tracked (See `dreem.io.data_structures for more info`)
"""
labels = self.labels[label_idx]
labels = labels.dropna(how="all")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import sleap_io as sio
import random
import warnings
from biogtr.io import Instance, Frame
from biogtr.datasets import data_utils, BaseDataset
from dreem.io import Instance, Frame
from dreem.datasets import data_utils, BaseDataset
from torchvision.transforms import functional as tvf
from typing import List, Union

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Module containing Lightning module wrapper around all other datasets."""

from biogtr.datasets.cell_tracking_dataset import CellTrackingDataset
from biogtr.datasets.microscopy_dataset import MicroscopyDataset
from biogtr.datasets.sleap_dataset import SleapDataset
from dreem.datasets.cell_tracking_dataset import CellTrackingDataset
from dreem.datasets.microscopy_dataset import MicroscopyDataset
from dreem.datasets.sleap_dataset import SleapDataset
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from typing import Union
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions biogtr/inference/metrics.py → dreem/inference/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import torch
from typing import Union, Iterable

# from biogtr.inference.post_processing import _pairwise_iou
# from biogtr.inference.boxes import Boxes
# from dreem.inference.post_processing import _pairwise_iou
# from dreem.inference.boxes import Boxes


def get_matches(frames: list["biogtr.io.Frame"]) -> tuple[dict, list, int]:
def get_matches(frames: list["dreem.io.Frame"]) -> tuple[dict, list, int]:
"""Get comparison between predicted and gt trajectory labels.
Args:
Expand Down Expand Up @@ -100,11 +100,11 @@ def get_switch_count(switches: dict) -> int:
return sw_cnt


def to_track_eval(frames: list["biogtr.io.Frame"]) -> dict:
def to_track_eval(frames: list["dreem.io.Frame"]) -> dict:
"""Reformats frames the output from `sliding_inference` to be used by `TrackEval`.
Args:
frames: A list of Frames. `See biogtr.io.data_structures for more info`.
frames: A list of Frames. `See dreem.io.data_structures for more info`.
Returns:
data: A dictionary. Example provided below.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Helper functions for post-processing association matrix pre-tracking."""

import torch
from biogtr.inference.boxes import Boxes
from dreem.inference.boxes import Boxes


def weight_decay_time(
Expand Down
8 changes: 4 additions & 4 deletions biogtr/inference/track.py → dreem/inference/track.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Script to run inference and get out tracks."""

from biogtr.io import Config
from biogtr.models import GTRRunner
from dreem.io import Config
from dreem.models import GTRRunner
from omegaconf import DictConfig
from pathlib import Path
from pprint import pprint
Expand All @@ -14,7 +14,7 @@
import sleap_io as sio


def export_trajectories(frames_pred: list["biogtr.io.Frame"], save_path: str = None):
def export_trajectories(frames_pred: list["dreem.io.Frame"], save_path: str = None):
"""Convert trajectories to data frame and save as .csv.
Args:
Expand Down Expand Up @@ -132,7 +132,7 @@ def run(cfg: DictConfig) -> dict[int, sio.Labels]:
for i, pred in preds.items():
outpath = os.path.join(
outdir,
f"{Path(dataloader.dataset.label_files[i]).stem}.biogtr_inference.v{run_num}.slp",
f"{Path(dataloader.dataset.label_files[i]).stem}.dreem_inference.v{run_num}.slp",
)
if os.path.exists(outpath):
run_num += 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module handling sliding window tracking."""

import warnings
from biogtr.io import Frame
from dreem.io import Frame
from collections import deque
import numpy as np

Expand Down
14 changes: 7 additions & 7 deletions biogtr/inference/tracker.py → dreem/inference/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import torch
import pandas as pd
import warnings
from biogtr.io import Frame
from biogtr.models import model_utils, GlobalTrackingTransformer
from biogtr.inference.track_queue import TrackQueue
from biogtr.inference import post_processing
from biogtr.inference.boxes import Boxes
from dreem.io import Frame
from dreem.models import model_utils, GlobalTrackingTransformer
from dreem.inference.track_queue import TrackQueue
from dreem.inference import post_processing
from dreem.inference.boxes import Boxes
from scipy.optimize import linear_sum_assignment
from math import inf

Expand Down Expand Up @@ -127,7 +127,7 @@ def sliding_inference(self, model: GlobalTrackingTransformer, frames: list[Frame
Args:
model: the pretrained GlobalTrackingTransformer to be used for inference
frames: A list of Frames (See `biogtr.io.Frame` for more info).
frames: A list of Frames (See `dreem.io.Frame` for more info).
Returns:
Frames: A list of Frames populated with pred_track_ids and asso_matrices
Expand Down Expand Up @@ -207,7 +207,7 @@ def _run_global_tracker(
Args:
model: the pretrained GlobalTrackingTransformer to be used for inference
frames: A list of Frames containing reid features. See `biogtr.io.data_structures` for more info.
frames: A list of Frames containing reid features. See `dreem.io.data_structures` for more info.
query_ind: An integer for the query frame within the window of instances.
Returns:
Expand Down
7 changes: 7 additions & 0 deletions dreem/io/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Module containing input/output data structures for easy storage and manipulation."""

from dreem.io.frame import Frame
from dreem.io.instance import Instance
from dreem.io.association_matrix import AssociationMatrix
from dreem.io.track import Track
from dreem.io.config import Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
import pandas as pd
import attrs
from biogtr.io import Instance
from dreem.io import Instance
from typing import Union


Expand Down
Loading

0 comments on commit f04eb9f

Please sign in to comment.