Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,16 @@ from detectron2.data import MetadataCatalog, DatasetCatalog
|
|
| 21 |
|
| 22 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 23 |
|
|
|
|
| 24 |
def setup_model():
|
| 25 |
cfg = get_cfg()
|
| 26 |
cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 27 |
cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
|
|
|
|
| 28 |
cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
|
| 29 |
-
|
| 30 |
-
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # Set a threshold for this model
|
| 31 |
predictor = DefaultPredictor(cfg)
|
|
|
|
| 32 |
return predictor
|
| 33 |
predictor = setup_model()
|
| 34 |
|
|
|
|
| 21 |
|
| 22 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 23 |
|
| 24 |
+
dist = distutils.core.run_setup("./detectron2/setup.py")
|
| 25 |
def setup_model():
|
| 26 |
cfg = get_cfg()
|
| 27 |
cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 28 |
+
cfg = get_cfg()
|
| 29 |
cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
|
| 30 |
+
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5
|
| 31 |
cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
|
|
|
|
|
|
|
| 32 |
predictor = DefaultPredictor(cfg)
|
| 33 |
+
|
| 34 |
return predictor
|
| 35 |
predictor = setup_model()
|
| 36 |
|