PDG commited on
Commit
11bf99e
·
1 Parent(s): 76c1707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -27,13 +27,13 @@ setup_logger()
27
 
28
  # -- load rcnn model ---------------------------------------------------------------------------------------------
29
  cfg = get_cfg()
30
- # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library
31
  cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
32
  cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model
33
- # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well
34
  cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
35
- cfg.MODEL.DEVICE= 'cpu'
36
- predictor = DefaultPredictor(cfg)
37
 
38
  # -- load design modernity model for classification --------------------------------------------------------------
39
  DesignModernityModel = torch.load("DesignModernityModel.pt")
 
27
 
28
  # -- load rcnn model ---------------------------------------------------------------------------------------------
29
  cfg = get_cfg()
30
+ # load model config
31
  cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
32
  cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model
33
+ # set model weights
34
  cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
35
+ cfg.MODEL.DEVICE= 'cpu' # move to cpu
36
+ predictor = DefaultPredictor(cfg) # create model
37
 
38
  # -- load design modernity model for classification --------------------------------------------------------------
39
  DesignModernityModel = torch.load("DesignModernityModel.pt")