Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import torch
  2.  
  3. import sys
  4. sys.path.append('/workspace/home/jgusak/maxvol_objects/maskrcnn-benchmark/')
  5. from maskrcnn_benchmark.config import cfg
  6. from maskrcnn_benchmark.modeling.detector import build_detection_model, glue_detection_model
  7.  
  8. initial_dir = '/workspace/raid/data/jgusak/maxvol_objects/pretrained'
  9. initial_path = '{}/facebook_frcnn_resnet50.pth'.format(initial_dir)
  10.  
  11. compressed_dir = '/workspace/raid/data/eponomarev/results/musco_voc/resnet50_fasterrcnn/tucker2/rank_selection:nx/ranks:/2x_layer_groups:1'
  12.  
  13. suffix = '_iter:{}-{}'.format(0, 1)
  14. backbone_path = '{}/backbone{}.pth'.format(compressed_dir, suffix)
  15. state_path = '{}/state{}.pth'.format(compressed_dir, suffix)
  16.  
  17. model = build_detection_model(cfg)
  18.  
  19. initial_backbone, rpn, head  = model.backbone, model.rpn, model.roi_heads
  20.  
  21. compressed_backbone = torch.load(backbone_path)
  22. compressed_frcnn_model = glue_detection_model(compressed_backbone, rpn, head)
  23.  
  24. compressed_frcnn_model.eval()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement