Skip to content

train

Train a pose regression model.

Usage:

train [OPTIONS]

Options:

  -v, --volpath PATH              A single CT or a directory with multiple
                                  volumes for pretraining  [required]
  -m, --maskpath PATH             Optional labelmaps corresponding to the CTs
                                  passed in `volpath`
  -c, --ckptpath PATH             Checkpoint of a pretrained pose regressor
  -o, --outpath PATH              Directory in which to save model weights
                                  [required]
  --r1 <FLOAT FLOAT>...           Range for primary angle (in degrees)
                                  [required]
  --r2 <FLOAT FLOAT>...           Range for secondary angle (in degrees)
                                  [required]
  --r3 <FLOAT FLOAT>...           Range for tertiary angle (in degrees)
                                  [required]
  --tx <FLOAT FLOAT>...           Range for x-offset (in millimeters)
                                  [required]
  --ty <FLOAT FLOAT>...           Range for y-offset (in millimeters)
                                  [required]
  --tz <FLOAT FLOAT>...           Range for z-offset (in millimeters)
                                  [required]
  --sdd FLOAT                     Source-to-detector distance (in millimeters)
                                  [required]
  --height INTEGER                DRR height (in pixels)  [required]
  --delx FLOAT                    DRR pixel size (in millimeters / pixel)
                                  [required]
  --renderer [siddon|trilinear]   Rendering equation  [default: trilinear]
  --orientation [AP|PA]           Orientation of CT volumes  [default: AP]
  --reverse_x_axis                Enable to obey radiologic convention (e.g.,
                                  heart on right)
  --model_name TEXT               Name of model to instantiate from the timm
                                  library  [default: resnet18]
  --norm_layer TEXT               Normalization layer  [default: groupnorm]
  --pretrained                    Load pretrained ImageNet-1k weights
  --parameterization TEXT         Parameterization of SO(3) for regression
                                  [default: quaternion_adjugate]
  --convention TEXT               If `parameterization='euler_angles'`,
                                  specify order  [default: ZXY]
  --unit_conversion_factor FLOAT  Scale factor for translation prediction
                                  (e.g., from m to mm)  [default: 1000.0]
  --p_augmentation FLOAT          Base probability of image augmentations
                                  during training  [default: 0.333]
  --lr FLOAT                      Maximum learning rate  [default: 0.0002]
  --weight_ncc FLOAT              Weight on mNCC loss term  [default: 1.0]
  --weight_geo FLOAT              Weight on geodesic loss term  [default:
                                  0.01]
  --weight_dice FLOAT             Weight on Dice loss term  [default: 1.0]
  --weight_mvc FLOAT              Weight on multiview consistency loss term
                                  [default: 0]
  --batch_size INTEGER            Number of DRRs per batch  [default: 116]
  --n_total_itrs INTEGER          Number of iterations for training the model
                                  [default: 1000000]
  --n_warmup_itrs INTEGER         Number of iterations for warming up the
                                  learning rate  [default: 1000]
  --n_grad_accum_itrs INTEGER     Number of iterations for gradient
                                  accumulation  [default: 4]
  --n_save_every_itrs INTEGER     Number of iterations before saving a new
                                  model checkpoint  [default: 1000]
  --disable_scheduler             Turn off cosine learning rate scheduler
  --reuse_optimizer               If ckptpath passed, initialize the previous
                                  optimizer's state
  -w, --warp PATH                 SimpleITK transform to warp input CT to the
                                  checkpoint's reference frame
  --invert                        Whether to invert the warp or not
  --patch_size TEXT               Optional random crop size (e.g., 'h,w,d');
                                  if None, return entire volume
  --num_workers INTEGER           Number of subprocesses to use in the
                                  dataloader  [default: 4]
  --pin_memory                    Copy volumes from the dataloader into CUDA
                                  pinned memory before returning
  --sample_weights PATH           Probability for sampling each volume in
                                  `volpath`
  --name TEXT                     WandB run name
  --id TEXT                       WandB run ID (useful when restarting from a
                                  checkpoint)
  --project TEXT                  WandB project name  [default: xvr]
  -h, --help                      Show this message and exit.