User Tools

Site Tools

This version (2019/07/15 17:04) was approved by twagner.


crYOLO - training: Training of crYOLO, a deep learning high accuracy particle picking procedure.


Usage in command line particle_diameter training_dir annot_dir --cryolo_train_path=CRYOLO_PATH --architecture=architecture --input_size=input_size --num_patches=num_patches --overlap_patches=overlap_patches --train_times=train_times --pretrained_weights_name=PRETRAINED_NAME --saved_weights_name=SAVE_WEIGHTS_NAME --batch_size=batch_size --learning_rate=learning_rate --np_epoch=np_epoch --object_scale=object_scale --no_object_scale=no_object_scale --coord_scale=coord_scale --valid_image_dir=valid_image_dir --valid_annot_dir=valid_annot_dir --warmup=warmup --gpu=gpu --fine_tune --gpu_fraction=GPU_FRACTION --num_cpu=NUM_CPU

Typical usage

To train crYOLO for a specific dataset, one have to specify the path to training data in the config file. Then the training typcial happens in two steps:

1. Warmup: particle_diameter training_dir annot_dir --architecture="YOLO" --warmup=5

2. Actual training: --conf=config_path --warmup=0 --gpu=0


Main Parameters

crYOLO train executeable
Path to the crYOLO executeable (default none)
Particle diameter [Pixel]
Particle diameter in pixel. This size will be used for as box size for picking. Should be as small as possible. (default required int)
Training image directory
Folder which contain all images. (default required string)
Annotation directory
Box or star files used for training. The should have the same name as the images. (default required string)

Advanced Parameters

Network architecture: Type of network that is trained. (default PhosaurusNet)
Input image dimension [Pixel]
Dimension of the image used as input to network. (default 1024)
Number of patches
The number of patches (e.g 2×2) the image is divided and classified separately. (default 1)
--overlap_patches: Patch overlap [Pixel]: The amount of overlap the patches will overlap (default 0)
Repeat images
How often a images is augmented and repeadet in one epoch. (default 10)
--pretrained_weights_name: Pretrained weights name
Name of the pretrained model (default cryolo_model.h5)
--saved_weights_name: Saved weights name
Name of the model to save (default cryolo_model.h5)
Batch size
How many patches are processed in parallel. (default 5)
Fine tune mode
Set it to true if you only want to use the fine tune mode. (default False)
Learning rate
Learning rate used during training. (default 0.0001)
Number of epochs
Maximum number of epochs. (default 100)
Object loss scale
Loss scale for object. (default 5.0)
--no_object_scale: Background loss scale: Loss scale for background. (default 1.0)
--coord_scale: Coordinates loss scale: Loss scale for coordinates. (default 1.0)
Path to validation images
Images used (default none)
Path to validation annotations
Path to the validation box files (default none)
Warm up epochs
Number of warmup epochs. (default 5)
--gpu: GPUs
List of GPUs to use. (default 0)
--gpu_fraction: GPU memory fraction
Specify the fraction of memory per GPU used by crYOLO during training. Only values between 0.0 and 1.0 are allowed. (default 1.0)
--num_cpu: Number of CPUs
Number of CPUs used during training. By default it will use half of the available CPUs. (default -1)


It will write a .h5 file (default yolo_model.h5) into your project directory.


The training is divided into two parts. 1. Warmup: It prepares the network with a few epochs of training without actually estimating the size of the particle. 2. Actual training: The training will stop when the loss on the validation data stops to improve.


See the reference below.

Time and Memory

Training needs a GPU with ~8GB memory. Training on 20 micrographs typicall needs ~20 minutes.

Developer Notes

2019/09/19 Thorsten Wagner

  • Initial creation of the document


Author / Maintainer

Thorsten Wagner





See also




None right now.

pipeline/window/sp_cryolo_train.txt ยท Last modified: 2019/04/02 11:40 by lusnig