Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
updated build files and README. updated packaged pretrained models to…
Browse files Browse the repository at this point in the history
… be state_dict for better cross pytorch version compatability
  • Loading branch information
tbepler committed May 14, 2019
1 parent 3675049 commit 31cbbeb
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-la

ENV PATH /opt/conda/bin:$PATH
ENV PATH /opt/conda/envs/$NAME/bin:$PATH
RUN conda install --name $NAME -c soumith pytorch=0.2.0 torchvision cuda80
RUN conda install --name $NAME -c pytorch pytorch torchvision

# setup topaz install directory
WORKDIR /opt/topaz
Expand Down
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Topaz
A pipeline for particle detection in cryo-electron microscopy images using convolutional neural networks trained from positive and unlabeled examples.

## New in v0.2.0

- Topaz now supports the newest versions of pytorch (>= 0.4.0). If you have pytorch installed for an older version of topaz, it will need to be upgraded. See installation instructions for details.
- Added __topaz denoise__, a command for denoising micrographs using neural networks.
- Usability improvements to the GUI.

# Prerequisites

- An Nvidia GPU with CUDA support for GPU acceleration.
Expand All @@ -25,20 +31,43 @@ More information on conda environments can be found [here](https://conda.io/docs

To install the precompiled Topaz package and its dependencies, including pytorch:
```
conda install topaz -c tbepler -c soumith
conda install topaz -c tbepler -c pytorch
```
This installs pytorch from the soumith channel. To install pytorch for cuda 8.0, you also need to install the 'cuda80' package:
This installs pytorch from the official channel. To install pytorch for specific cuda versions, you will need to add the 'cudatoolkit=X.X' package. E.g. to install pytorch for CUDA 9.1:
```
conda install cuda80 -c soumith
conda install cudatoolkit=9.1 -c pytorch
```
or combined into a single command:
```
conda install topaz cuda80 -c tbepler -c soumith
conda install topaz cudatoolkit=9.1 -c tbepler -c pytorch
```
See [here](https://pytorch.org/get-started/locally/) for additional pytorch installation instructions.

That's it! Topaz is now installed in your anaconda environment.

</p></details>

**<details><summary> Click here to install *using Pip*</summary><p>**

We strongly recommend installing Topaz into a _virtual environment_. See [installation instructions](https://virtualenv.pypa.io/en/latest/installation/) and [user guide](https://virtualenv.pypa.io/en/latest/userguide/) for virtualenv.

## Install Topaz

To install Topaz for Python 3.X
```
pip3 install topaz
```

for Python 2.7
```
pip install topaz
```
See [here](https://pytorch.org/get-started/locally/) for additional pytorch installation instructions, including how to install pytorch for specific CUDA versions.

That's it! Topaz is now installed through pip.

</p></details>

**<details><summary>Click here to install *using Docker*</summary><p>**

**<details><summary>Do you have Docker installed? If not, *click here*</summary><p>**
Expand Down Expand Up @@ -117,7 +146,7 @@ Easy installation of dependencies with conda
conda install numpy pandas scikit-learn
conda install -c pytorch pytorch torchvision
```
For more info on installing pytorch for your CUDA version see http://pytorch.org
For more info on installing pytorch for your CUDA version see https://pytorch.org/get-started/locally/

#### Download the source code
```
Expand Down
33 changes: 33 additions & 0 deletions conda-build/meta-v0.1.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package:
name: "topaz"
version: {{ GIT_DESCRIBE_TAG }}

source:
git_url: https://github.com/tbepler/topaz.git
git_tag: v0.1.0

requirements:
build:
- python
- setuptools
run:
- python
- argparse #[py26]
- numpy>=0.11
- pandas
- scikit-learn>=0.19.0
- pillow
- pytorch=0.2.0
- torchvision


build:
noarch: python
number: 0
script: "{{ PYTHON }} setup.py install --single-version-externally-managed --record=record.txt"


about:
home: https://github.com/tbepler/topaz
license: GPLv3
license_file: LICENSE
2 changes: 1 addition & 1 deletion conda-build/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ requirements:
- pandas
- scikit-learn>=0.19.0
- pillow
- pytorch=0.2.0
- pytorch>=0.4.0
- torchvision


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

name = 'topaz'
version = '0.1.0'
version = '0.2.0a'

description = 'Particle picking with positive-unlabeled CNNs'
long_description = 'Particle picking software for single particle cryo-electron microscopy using convoluational neural networks and positive-unlabeled learning.'
Expand Down
2 changes: 1 addition & 1 deletion topaz/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0"
__version__ = "0.2.0a"
2 changes: 1 addition & 1 deletion topaz/commands/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import topaz.mrc as mrc

name = 'denoise'
help = 'denoise micrographs using different denoising algorithms'
help = 'denoise micrographs with various denoising algorithms'

def add_arguments(parser):

Expand Down
4 changes: 3 additions & 1 deletion topaz/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def load_model(name):
path = 'pretrained/denoise/' + name
f = pkg_resources.resource_stream(pkg, path)

model = torch.load(f)
state_dict = torch.load(f)
model = UDenoiseNet()
model.load_state_dict(state_dict)

return model

Expand Down
Binary file modified topaz/pretrained/denoise/unet_L0_v1.sav
Binary file not shown.
Binary file modified topaz/pretrained/denoise/unet_L1_v1.sav
Binary file not shown.
Binary file modified topaz/pretrained/denoise/unet_L2_v1.sav
Binary file not shown.

0 comments on commit 31cbbeb

Please sign in to comment.