Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

deephdc/conus-classification-theano

Repository files navigation

Conus Classification with Lasagne/Theano

Author Ignacio Heredia, Lara Lloret Iglesias

Date August 2018

This repository contains the code used to train a ResNet50 convolutional network on conus classification. Here is the paper describing the work (arxiv version).

Contents

  • ./data Data files
  • ./plan_classification Core code
  • ./webpage Independent folder which contains the essential files/functions to run a simple webpage to host your trained net and make predictions. For example the conus classification app is running at http://deep.ifca.es/.

This has been tested in Ubuntu 14.04 with Python 2.7.12 with the Anaconda 4.2.0 (64-bit) distribution, Theano 0.9.0.dev2 and Lasagne 0.2.dev1.

Resusing this framework

This framework is quite flexible to retrain a ResNet50 with your image dataset (in .jpg format).

1) Providing the dataset files

First you need add to the ./data/data_splits path the files:

Mandatory files

  • synsets.txt
  • train.txt

Optional files

  • val.txt
  • test.txt
  • tags.txt

The train.txt, val.txt and test.txt files associate an image to a label number (that has to start at zero). The synsets.txt file translates those label numbers to label names. Finally the tags.txt enables you to provide a tag to each training image to custom the data augmentation operations you apply to each image (see the docstring of the data_augmentation function in the ./plan_classification/data_utils.py file).

You can find examples of these files at ./data/data_splits/dataset_demo.

2) Downloading the pretrained model

You have to download the Lasagne Model Zoo pretrained weights with ImageNet from here and copy them to ./data/data_splits/pretrained_weights.

3) Launching the training

Then you can launch the training executing ./plan_classification/train_runfile.py once you have updated the parameters of the training inside the script (like the number of epochs, the folder path containing your images, etc). If you want to train with gpu you should create a .theanorc file in your ~ dir with a content similar to the following:

[global]
device=gpu
floatX=float32
[cuda]
root = /usr/local/cuda-8.0
[lib]
cnmem=.75

The weights of the trained net will be stored in ./conus_classification/training_weights (in an .npz file) and the training information in ./plan_classification/training_info (in a .json file).

To learn how to use your freshly trained conus_classification for making predictions or plotting your training information, take a look at ./plan_classification/test_scripts/test_demo.py. If you prefer to have a graphical interface, you can run a simple webpage to query your model. For more info check the webpage docs.

References

About

Deep Learning for marine snails (Conus) classification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published