Table of Contents

How to use SPHIRE's Cinderella for 2D class selection

This tutorial describes how to use Cinderella to classify 2D class averages. You can either use a pretrained model (see section Classify) or train your own model (see section Training).

Download & Install

You can find the download and installation instructions here: Download and Installation

Classify

I suppose you downloaded the latest classification model.

To run the classification I suppose you want to separate good and bad classes in classes_after_isac.hdf (or any other .mrcs / .hdf file with classes) and you want to save your new .hdf (.mrcs) files into the folder output_folder. Furthermore you want to use the model model.h5 and the GPU with ID=1. Classes with a confidence bigger than 0.7 should be classified as good class.

This is the command to run:

sp_cinderella_predict.py -i path/to/classes_after_isac.hdf -w model.h5 -o output_folder/ -t 0.7 --gpu 1

You will find the files classes_after_isac_good.hdf and classes_after_isac_bad.hdf in your output_folder.

Training

If you would like to train Cinderella with your own classes, you can easily do it. First you have to separate your good and bad classes into separate files. Create two folders, one containing good classes (e.g GOOD_CLASSES/) and one contain bad classes (e.g BAD_CLASSES/). Both folders can contain multiple .hdf / .mrcs files.

Then specify the paths into a config file like this:

config.json
{
	"model": {
		"input_size": [64,64]
	},
 
	"train": {
		"batch_size": 32,
		"good_path": "GOOD_CLASSES/",
		"bad_path": "BAD_CLASSES/",
		"pretrained_weights": "",
		"saved_weights_name": "my_model.h5",
		"learning_rate": 1e-4,
		"nb_epoch": 100,
		"nb_early_stop": 15
	}
}

The fields in the section model have the following meaning:

The fields in the section train have the following meaning:

The next step is to run the training:

sp_cinderella_train.py -c example_config.json --gpu 1

This will train a classification network on the GPU with ID=1. After the training finishes, you get a my_model.h5 file. This can then be used to predict good / bad classes.