Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. initial_backbone, rpn, head = frcnn_split(frcnn_model)
  2. compressed_backbone = copy.deepcopy(initial_backbone)
  3.  
  4.  
  5. device = 'cpu'
  6. train_iters = 10
  7. val_iters = 10
  8.  
  9. for ft_iter in range(1):
  10.  
  11.     layer_names = get_layer_names(MODEL_NAME, initial_backbone)
  12.     ranks = [None]*len(layer_names)
  13.    
  14.     # compress backbone
  15.     compressed_backbone = get_compressed_model(compressed_backbone, MODEL_NAME,
  16.                                    ranks=ranks, layer_names = layer_names,
  17.                                     decomposition = decomposition,
  18.                                     vbmf_weaken_factor = 0.7)
  19.    
  20.     # add new backbone to od model
  21.     compressed_frcnn_model = frcnn_glue(compressed_backbone, rpn, head, device)
  22.    
  23.     # finetune od model
  24.     compressed_frcnn_model = fine_tune(compressed_model, loaders, device, save_dir,
  25.               train_iters = train_iters, val_iters = val_iters)
  26.  
  27.     # get backbone for the next iteration
  28.     compressed_backbone, rpn, head = frcnn_split(compressed_frcnn_model)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement