Skip to content

Commit

Permalink
added some docstrings to files
Browse files Browse the repository at this point in the history
  • Loading branch information
josegcpa committed Aug 31, 2023
1 parent b585ec3 commit 0c7d590
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ In other words, the non-local means of a given pixel is the weighted average of

## Usage

To use this package all you have to do is clone and install this (a `pyproject.toml` is provided so that you can easily install this with [`poetry`](https://python-poetry.org/)). Then, two main functions are exported: `nlm2d` and `nlm3d`, which are aliases for the most efficient `torch`-based NLMM versions (`apply_nonlocal_means_2d_mem_efficient` and `apply_nonlocal_means_3d_mem_efficient`), respectively. So if you want to apply it to your favourite image:
To use this package all you have to do is clone and install this (a `pyproject.toml` is provided so that you can easily install this with [`poetry`](https://python-poetry.org/)). Alternatively, use `requirements.txt` with `pip` (i.e. `pip install -r requirements.txt`).

Two main functions are exported: `nlm2d` and `nlm3d`, which are aliases for the most efficient `torch`-based NLMM versions (`apply_nonlocal_means_2d_mem_efficient` and `apply_nonlocal_means_3d_mem_efficient`), respectively. So if you want to apply it to your favourite image and have a CUDA compatible GPU:

```python
import torch # necessary for obvious reasons
Expand Down
Binary file modified dist/nlm_torch-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file modified dist/nlm_torch-0.1.0.tar.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions torch_nlm/apply_2d_ops.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
"""
Functions for 2d NLM using torch.
"""

__author__ = "José Guilherme de Almeida"
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "José Guilherme de Almeida"
__email__ = "[email protected]"

import torch
import einops
import torch.nn.functional as F
Expand Down
10 changes: 10 additions & 0 deletions torch_nlm/apply_3d_ops.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
"""
Functions for 3d NLM using torch.
"""

__author__ = "José Guilherme de Almeida"
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "José Guilherme de Almeida"
__email__ = "[email protected]"

import torch
import einops
import torch.nn.functional as F
Expand Down
11 changes: 10 additions & 1 deletion torch_nlm/base_ops.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
"""
Generic operations for torch_nlm.
"""

__author__ = "José Guilherme de Almeida"
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "José Guilherme de Almeida"
__email__ = "[email protected]"

import numpy as np
import torch
import torch.nn.functional as F
import einops
from itertools import product
from tqdm import tqdm
from typing import Tuple,List
Expand Down

0 comments on commit 0c7d590

Please sign in to comment.