Giter VIP home page Giter VIP logo

dogsvscats's Introduction

Caffe - dogsvscats

Preparation

  1. Follow Caffe instruction to install all necessary packages and build it.

Execute the command below to enable Python interface of Caffe.

export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH
  1. Get the code and store them under $CAFFE_ROOT.
git clone xxxx

dogsvscats/ is organized as follows.

+ dogsvscats/
    + data/
    + scripts/
    + models/
        + caffenet
        + resnet50

Data Preparation

  1. Download Dogs vs. Cats data from Kaggle.
    Unzip the files and store them under $CAFFE_ROOT/dogsvccats/data/.
    data/ should be organized as follows.
+ data/
    + train
    + test1
  1. Create lmdb data and generate the mean file of training data.
    create_lmdb_meanfile.sh creates train, val, trainval data in lmdb format and generates meanfile for train and trainval, respectively.
bash create_lmdb_meanfile.sh

Train the network

Two networks are provided: CaffeNet and ResNet50. The network definitions and training scripts are stored under $CAFFE_ROOT/dogsvscats/models/.

  1. Download IMAGENET pretrained models and put them under corresponding directory.
  2. Finetune on dogsvscats data.
bash train.sh
or
bash trainval.sh

train.sh will finetune the pretrained models on train and report accuracy on val. trainval.sh will finetune the pretrained models on trainval (the whole training data).

Trained models will be stored under $CAFFE_ROOT/dogsvscats/moedels/caffnet/exp/.

Plot curves

The logs generated during training can be exploited to plot training and testing curves.

python plot_learning_curve.py

This will generate curve.png which visualizes the training process.

Prediction

Finally we can predict on unseen data. Test dataset is provided under $CAFFE_ROOT/dogsvscats/data/test1. We can predict on them based on trained models.

python make_predictions.py

make_predictions.py will generate submission.csv which can be submitted to Kaggle Dogs vs. Cats challenge.


Reference

  1. A Practical Introduction to Deep Learning with Caffe and Python
  2. 【caffe源码研究】第二章:实战篇(1) : 字符识别项目

dogsvscats's People

Contributors

hhwxxx avatar

Watchers

James Cloos 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.