# How to use SPHIRE's Cinderella

### Classify

This is the corresponding configuration file:

config.json
{
"model": {
"input_size": [75,75]
},

"train": {
"batch_size": 32,
"good_classes": "GOOD_CLASSES/",
"pretrained_weights": "",
"saved_weights_name": "my_model.h5",
"learning_rate": 1e-4,
"nb_epoch": 100,
"nb_early_stop": 5
}
}

Copy this into a new file called config.json. During classification, the options in the “train” section are ignored.

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/ -c config.json -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, on 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": [75,75]
},

"train": {
"batch_size": 32,
"good_classes": "GOOD_CLASSES/",
"pretrained_weights": "",
"saved_weights_name": "my_model.h5",
"learning_rate": 1e-4,
"nb_epoch": 100,
"nb_early_stop": 5
}
}

The fields have the following meaning:

• input_size: This is the image size to which each class is resized to.
• batch_size: How many classes are in one mini-batch. If you have memory problems, you can try to reduce this value.
• good_classes: Path to folder with good classes.
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.