Skip to content

Commit

Permalink
Update 'README.md'
Browse files Browse the repository at this point in the history
Former-commit-id: 22631a6b4c0251784007ed7e5be14bcdb42d0ade
  • Loading branch information
Javier Ribera committed May 9, 2018
1 parent 8e16c56 commit ca755b9
Showing 1 changed file with 66 additions and 40 deletions.
106 changes: 66 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,105 @@
# Table of Contents
# Object location

## Table of Contents
1. [Using Conda (recommended)](#conda)
1. [Installation](#installation)
1. [Usage](#usage)
2. [Usage](#usage)
1. [Test/evaluate](#test)
2. [Train](#train)
2. [Using Docker](#docker)


## Using Conda (recommended) <a name="conda"></a>
### Installation

You need to have CUDA 8 installed before proceeding with these installation instructions. This will depend greatly on the specific model of your NVIDIA card and your operating system version.
<a name="installation"></a>
### Installation

1. Install Conda (if you already have it you can go to step 2)
<ol>
<li>Download and install Anaconda as described in <a href="https://docs.anaconda.com/anaconda/install/">https://docs.anaconda.com/anaconda/install</a></li>
<li>Download the object location tool from <a href="https://github.rcac.purdue.edu/jprat/object-location-whd/archive/v1.2.0.zip">this link</a>, and decompress the zip.
<li>Open the terminal in Linux/MacOS. In Windows, open the Anaconda prompt.</li>
<li>"cd" into the decompressed directory</li>
<li>Install the dependencies using the environment.yml file:</li>
<pre>
curl -L https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh
bash /tmp/miniconda.sh -bf
rm -rf /tmp/miniconda.sh
</pre>
2. Make sure you have access to Conda with `which conda`. If not, maybe the conda directory is not in your path. Make sure that in your `~/.bash.rc` file you have a line such as
<pre>
export PATH="~/miniconda3/bin:$PATH"`
</pre>
3. Create the provided conda environment (and also install all the dependencies) with
<pre>
conda env create -f environment.yml
conda env create
</pre>

4. Activate it
<pre>
source activate object-location
</pre>
5. Install the object locator software in this environment
<li>For Linux/MacOS, activate the environment with</li>
<pre>
pip install object_locator-1.1.0-py3-none-any.whl
source activate object-locator
</pre>

### Usage
1. Activate the environment
<li>For Windows, activate the environment with</li>
<pre>
source activate object-location
source activate object-locator
</pre>

#### Train (optional)
If you do not want to use one of the provided pretrained models, you can train your own model. Run the following command to get the full help message on how to train, with an explanation of all available training parameters.
<li>Install the object-locator:</li>
<pre>
python -m object-locator.train -h
pip install .
</pre>

This is a simple example:
<a name="usage"></a>
### Usage


Activate the environment:
<pre>
CUDA_VISIBLE_DEVICES="0,1,3" python -m object-locator.train \
--train-dir ~/data/20160613_F54_training_256x256 \
--batch-size 32 \
--env-name sorghum \
--lr 1e-3 \
--val-dir ~/data/plant_counts_random_patches/20160613_F54_validation_256x256 \
--optim Adam \
--save unet_model.ckpt
source activate object-location
</pre>

<a name="test"></a>
#### Test/evaluate
Use a model/checkpoint to evaluate, i.e, to locate all the objects in a dataset. Run the following command to get the full help message on how to evaluate, with an explanation of all available evbaluation parameters.
To use a pre-trained model/checkpoint.

Run this to get help (usage instructions):
<pre>
python -m object-locator.locate -h
</pre>

Example:

<pre>
python -m object-locator.locate \
--model ~/checkpoints/unet_model.ckpt \
--dataset ~/data/20160613_F54_testing_256x256 \
--radius 5 \
--out results

</pre>

## Using Docker <a name="docker"></a>


<a name="train"></a>

#### Train (optional)
If you do not want to use one of the provided pretrained models, you can train your own model. Run the following command to get the full help message on how to train, with an explanation of all available training parameters.
You need to have a NVIDIA card and CUDA 8 installed to train your own model. This depends greatly on the specific model of your NVIDIA card and operating system.

Run this to get help (usage instructions):
<pre>
python -m object-locator.train -h
</pre>

Example:

<pre>
python -m object-locator.train \
--train-dir ~/data/20160613_F54_training_256x256 \
--batch-size 32 \
--env-name sorghum \
--lr 1e-3 \
--val-dir ~/data/plant_counts_random_patches/20160613_F54_validation_256x256 \
--optim Adam \
--save unet_model.ckpt
</pre>


<a name="docker"></a>
## Using Docker


(only for expert users)

1. Install docker-ce as described in https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
2. Install NVIDIA drivers
3. Run the following commands
Expand Down

0 comments on commit ca755b9

Please sign in to comment.