GithubHelp home page GithubHelp logo

yejg2017 / plantvillage-challenge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chsasank/plantvillage-challenge

1.0 0.0 0.0 28 KB

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

Lua 100.00%
torch7 deep-learning

plantvillage-challenge's Introduction

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

plantvillage-challenge's People

Contributors

chsasank avatar

Stargazers

Stevie Yeh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.