MitoNet: a scalable framework for automated mitochondria segmentation
Table of contents
Install Pytorch Connectomics
To prepare your Windows computer for the installation, first install these applications:
- Install Visual Studio
- Install CUDA Toolkit
- Install Anaconda
- Install Git
conda install -c anaconda git
Now follow the steps below to install the package:
1) Open your Anaconda Prompt (click Start, then search, or select Anaconda Prompt from the menu) and run the follow commands in sequence:
conda create -n py3_torch python=3.8
activate py3_torch
conda install pytorch torchvision cudatoolkit=11.0 -c pytorch
2) Check your Pytorch version (we want the version to be >1.80):
pip3 show torch
3) Check if Pytorch is installed with CUDA support:
activate py3_torch
python
import torch
torch.cuda.is_available() # output would be True or False
- Note: if you get a False, try to reinstall pytorch with CUDA in different ways; also, you should go to the official website for detailed instructions; solutions that worked for us:
- using conda:
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
- using pip:
pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
4) Verify if nvcc is accessible from terminal:
nvcc --version
5) Finally, install the Pytorch Connectomics package:
git clone https://github.com/zudi-lin/pytorch_connectomics.git
cd pytorch_connectomics
pip install --editable .
For installation on Linux machines, follow the instructions here.
Semantic Segmentation
Before running the model, first install wget for Windows - a free network utility to retrieve files from the World Wide Web using HTTP and FTP. This post provides a detailed tutorial for installing wget. In general, follow the steps below in sequence:
- Download wget: https://eternallybored.org/misc/wget/
- Copy wget.exe to C:\Windows\System32 folder
- In your command line, type:
wget -h
Now start the training process:
1) Download the sample dataset:
wget http://rhoana.rc.fas.harvard.edu/dataset/lucchi.zip
Note: wget downloads files in the current working directory where it is run
2) Configure the model for training:
# start anaconda prompt
conda activate py3_torch
python
import torch
print(f"Is CUDA supported by this system? {torch.cuda.is_available()}")
# Returns True if CUDA is supported by your system, else False
print(f"ID of current CUDA device: {torch.cuda.current_device()}")
# Returns ID of current device (you need this info for configuration)
3) Run the script for training: