This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
pipeline:window:cryolo [2019/09/17 13:40] twagner [Evaluate your results] |
pipeline:window:cryolo [2020/02/13 14:02] twagner [Installation] |
||
---|---|---|---|
Line 29: | Line 29: | ||
< | < | ||
< | < | ||
- | <a href=" | + | <a href=" |
</ | </ | ||
</ | </ | ||
Line 37: | Line 37: | ||
You can find the download and installation instructions here: [[howto: | You can find the download and installation instructions here: [[howto: | ||
+ | {{page> | ||
+ | ===== Release notes ===== | ||
+ | {{page> | ||
===== Tutorials ===== | ===== Tutorials ===== | ||
Depending what you want to do, you can follow one of these self-contained Tutorials: | Depending what you want to do, you can follow one of these self-contained Tutorials: | ||
- | - I would like to train a model from scratch for picking my particles | + | - [[pipeline: |
- | - I would like to train a model from scratch for picking filaments. | + | - [[pipeline: |
- | - I would like to refine a general model for my particles. | + | - [[pipeline: |
+ | - [[pipeline: | ||
- | The **first and the second | + | The **first, second |
- | ===== Picking particles - Using a model trained for your data ===== | ||
- | This tutorial explains you how to train a model specific for you dataset. | ||
- | If you followed the installation instructions, | ||
- | < | ||
- | source activate cryolo | ||
- | </ | ||
- | ==== Data preparation ==== | ||
- | {{page> | ||
- | ==== Start crYOLO ==== | ||
- | {{page> | ||
- | |||
- | ==== Configuration ==== | ||
- | {{page> | ||
- | |||
- | < | ||
- | <div style=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | {{page> | ||
- | |||
- | ==== Training ==== | ||
- | |||
- | {{page> | ||
- | ==== Picking ==== | ||
- | {{page> | ||
- | |||
- | |||
- | ==== Visualize the results ==== | ||
- | {{page> | ||
- | |||
- | ==== Evaluate your results ==== | ||
- | {{page> | ||
- | ===== Picking particles - Without training using a general model ===== | ||
- | Here you can find how to apply the general models we trained for you. If you would like to train your own general model, please see our extra wiki page: [[: | ||
- | |||
- | Our general models can be found and downloaded here: [[howto: | ||
- | |||
- | If you followed the installation instructions, | ||
- | |||
- | < | ||
- | source activate cryolo | ||
- | </ | ||
- | ==== Start crYOLO ==== | ||
- | {{page> | ||
- | |||
- | ==== Configuration==== | ||
- | In the GUI choose the //config// action. Fill in your target box size and leave the // | ||
- | |||
- | {{ : | ||
- | |||
- | [[: | ||
- | |||
- | * General model trained for low-pass filtered images : Select //filter// " | ||
- | * General model trained for JANNI-denoised images: Select //filter// " | ||
- | * General model for negative stain images: Select filter " | ||
- | |||
- | < | ||
- | <div style=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | |||
- | <hidden **Create the configuration file using the command line**> | ||
- | In the following I assume that you target box size is 220. Please adapt if necessary. | ||
- | |||
- | For the general **[[: | ||
- | < | ||
- | cryoloo.py config config_cryolo_.json 220 --filter LOWPASS --low_pass_cutoff 0.1 | ||
- | </ | ||
- | |||
- | For the general model trained with **neural-network denoised cryo images** (with [[: | ||
- | < | ||
- | cryoloo.py config config_cryolo_.json 220 --filter JANNI --janni_model / | ||
- | </ | ||
- | |||
- | For the general model for **negative stain data** please run: | ||
- | < | ||
- | cryoloo.py config config_cryolo_.json 220 --filter NONE | ||
- | </ | ||
- | </ | ||
- | |||
- | ==== Picking ==== | ||
- | {{page> | ||
- | |||
- | ==== Visualize the results ==== | ||
- | {{page> | ||
- | ===== Picking particles - Using the general model refined for your data ===== | ||
- | |||
- | |||
- | Since crYOLO 1.3 you can train a model for your data by // | ||
- | |||
- | What does // | ||
- | |||
- | The general model was trained on a lot of particles with a variety of shapes and therefore learned a very good set of generic features. The last layers, however, learn a pretty abstract representation of the particles and it might be that they do not perfectly fit for your particle at hand. Fine-tuning only traines the last two convolutional layers, but keep the others fixed. This adjusts the more abstract representation for your specific problem. | ||
- | |||
- | Why should I // | ||
- | - From theory, using fine-tuning should reduce the risk of overfitting ((Overfitting means, that the model works good on the training micrographs, | ||
- | - The training is much faster, as not all layers have to be trained. | ||
- | - The training will need less GPU memory ((We are testing crYOLO with its default configuration on graphic cards with >= 8 GB memory. Using the fine tune mode, it should also work with GPUs with 4 GB memory)) and therefore is usable with NVIDIA cards with less memory. | ||
- | |||
- | However, the fine tune mode is still somewhat experimental and we will update this section if see more advantages or disadvantages. | ||
- | |||
- | If you followed the installation instructions, | ||
- | |||
- | < | ||
- | source activate cryolo | ||
- | </ | ||
- | |||
- | ==== Data preparation ==== | ||
- | {{page> | ||
- | |||
- | ==== Start crYOLO ==== | ||
- | |||
- | {{page> | ||
- | ==== Configuration ==== | ||
- | {{page> | ||
- | |||
- | {{ : | ||
- | Furthermore, | ||
- | |||
- | < | ||
- | <div style=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | <hidden **Create the configuration file using the command line:**> | ||
- | |||
- | I assume your box files for training are in the folder '' | ||
- | |||
- | < | ||
- | cryoloo.py config config_cryolo.json 160 --train_image_folder train_image --train_annot_folder train_annot --pretrained_weights gmodel_phosnet_20190516.h5 | ||
- | </ | ||
- | |||
- | To get a full description of all available options type: | ||
- | < | ||
- | cryoloo.py config -h | ||
- | </ | ||
- | |||
- | If you want to specify seperate validation folders you can use the %%--%%valid_image_folder and %%--%%valid_annot_folder options: | ||
- | |||
- | < | ||
- | cryoloo.py config config_cryolo.json 160 --train_image_folder train_image --train_annot_folder train_annot --pretrained_weights gmodel_phosnet_20190516.h5 --valid_image_folder valid_img --valid_annot_folder valid_annot | ||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | ==== Training ==== | ||
- | |||
- | Now you are ready to train the model. In case you have multiple GPUs, you should first select a free GPU. The following command will show the status of all GPUs: | ||
- | |||
- | < | ||
- | nvidia-smi | ||
- | </ | ||
- | |||
- | For this tutorial, we assume that you have either a single GPU or want to use GPU 0. | ||
- | |||
- | In the GUI choose the action //train//. In the //" | ||
- | {{ : | ||
- | |||
- | In the //" | ||
- | {{ : | ||
- | <note important> | ||
- | The number of layers to fine tune (specified by layers_fine_tune in the //" | ||
- | </ | ||
- | |||
- | |||
- | <note tip> | ||
- | |||
- | **Training on CPU** | ||
- | |||
- | The fine tune mode is especially useful if you want to [[downloads: | ||
- | </ | ||
- | |||
- | <hidden **Run training with the command line**> | ||
- | In comparison to the training from scratch, you can skip the warm up training ( -w 0 ). Moreover you have to add the // | ||
- | |||
- | < | ||
- | cryolo_train.py -c config.json -w 0 -g 0 --fine_tune -lft 2 | ||
- | </ | ||
- | </ | ||
- | |||
- | ==== Picking ==== | ||
- | {{page> | ||
- | |||
- | ==== Visualize the results ==== | ||
- | {{page> | ||
- | |||
- | ==== Evaluate your results ==== | ||
- | {{page> | ||
- | ===== Picking filaments - Using a model trained for your data ===== | ||
- | Since version 1.1.0 crYOLO supports picking filaments. | ||
- | |||
- | Filament mode on Actin: | ||
- | |||
- | {{: | ||
- | |||
- | Filament mode on MAVS (EMPIAR-10031) : | ||
- | |||
- | {{: | ||
- | |||
- | If you followed the installation instructions, | ||
- | |||
- | < | ||
- | source activate cryolo | ||
- | </ | ||
- | |||
- | |||
- | ==== Data preparation ==== | ||
- | {{ : | ||
- | |||
- | The first step is to create the training data for your model. Right now, you have to use the e2helixboxer.py for this: | ||
- | < | ||
- | e2helixboxer.py --gui my_images/ | ||
- | </ | ||
- | |||
- | After tracing your training data in e2helixboxer, | ||
- | |||
- | For projects with roughly 20 filaments per image we successfully trained on 40 images (=> 800 filaments). | ||
- | |||
- | ==== Start crYOLO ==== | ||
- | {{page> | ||
- | |||
- | |||
- | ==== Configuration ==== | ||
- | {{page> | ||
- | |||
- | |||
- | < | ||
- | <div style=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | {{page> | ||
- | ==== Training ==== | ||
- | |||
- | {{page> | ||
- | ==== Picking ==== | ||
- | Select the action prediction and fill all arguments in the “Required arguments” tab: | ||
- | {{ : | ||
- | |||
- | Now select the " | ||
- | |||
- | {{ : | ||
- | |||
- | Press the start button to start the picking. The directory '' | ||
- | |||
- | You can find a detailed description [[: | ||
- | |||
- | <hidden **Run prediction in commmand line**> | ||
- | Let's assume you want to pick a filament with a width of 100 pixels (-fw 100). The box size is 200x200 and you want a 90% overlap (-bd 20). Moreover, you wish that each filament has at least 6 boxes (-mn 6). The micrographs are in the '' | ||
- | < | ||
- | cryolo_predict.py -c cryolo_config.json -w cryolo_model.h5 -i full_data --filament -fw 100 -bd 20 -o boxes/ -g 0 -mn 6 | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ==== Visualize the results ==== | ||
- | {{page> | ||
- | |||
- | |||
- | ===== Advanced parameters ===== | ||
- | During **training** (// | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | * //%%-%%lft NUM_LAYER_FINETUNE//: | ||
- | |||
- | During **picking** (// | ||
- | * //-t CONFIDENCE_THRESHOLD//: | ||
- | * //-d DISTANCE_IN_PIXEL//: | ||
- | * //-pbs PREDICTION_BATCH_SIZE//: | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | * // | ||
- | * //-sr SEARCH_RANGE_FACTOR//: | ||
- | |||
===== Help ===== | ===== Help ===== |