Skip to content

orlandobcr/plantvillage-challenge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code in Torch for PlantVillage challenge

I wrote a blog post describing the code here: http://chsasank.github.io/plantvillage-tutorial.html

Requirements

See the installation instructions for a step-by-step guide.

If you already have Torch installed, update nn, cunn, and cudnn.

Divide the training data in to train and val folders. You can use a bash script like this:

cd directory/contaning/c_0c_1...etcdirectories
mkdir -p train val
for i in {0..37}; do mkdir val/c_$i; done
mv c_* train

Training

The training scripts come with several options, which can be listed with the --help flag.

$ th main.lua --help
Torch-7 PlantVillage Challenge Training script

  -learningRate initial learning rate for sgd [0.01]
  -momentum     momentum term of sgd [0.9]
  -maxEpochs    Max # Epochs [120]
  -batchSize    batch size [32]
  -nbClasses    # of classes [38]
  -nbChannels   # of channels [3]
  -backend      Options: cudnn | nn [cudnn]
  -model        Options: alexnet | vgg | resnet [alexnet]
  -depth        For vgg depth: A | B | C | D, For resnet depth: 18 | 34 | 50 | 101 | ... Not applicable for alexnet [A]
  -retrain      Path to model to finetune [none]
  -save         Path to save models [.]
  -data         Path to folder with train and val directories [datasets/crowdai/]

Example usage

Train alexnet:

$ th main.lua -model alexnet -data path/to/train-val-directories

Train alexnet on CPU (not recommended):

$ th main.lua -model alexnet -data path/to/train-val-directories -backend nn

Train resnet 34

$ th main.lua -model resnet -depth 34 -learningRate 0.1 -data path/to/train-val-directories

This checkpoints the model every 10 epochs. It also saves the best model as per validation set. You can use these to make a submission.

Submission

Create a submission using model.t7:

th submission.lua model.t7 path/to/test > submission.csv

About

Code in Torch for PlantVillage challenge: https://www.crowdai.org/challenges/1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%