Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,11 +29,12 @@ cfg.MODEL.DEVICE='cpu'
|
|
29 |
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5
|
30 |
cfg.MODEL.WEIGHTS = "model_weights/chatswood_buildings_poc.pth"
|
31 |
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 8
|
|
|
32 |
|
33 |
def segment_buildings(im):
|
34 |
|
35 |
outputs = predictor(im)
|
36 |
-
v = Visualizer(im[:, :, ::-1],
|
37 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
38 |
return Image.fromarray(np.uint8(out.get_image())).convert('RGB')
|
39 |
|
|
|
29 |
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5
|
30 |
cfg.MODEL.WEIGHTS = "model_weights/chatswood_buildings_poc.pth"
|
31 |
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 8
|
32 |
+
predictor = DefaultPredictor(cfg)
|
33 |
|
34 |
def segment_buildings(im):
|
35 |
|
36 |
outputs = predictor(im)
|
37 |
+
v = Visualizer(im[:, :, ::-1], scale=1.2)
|
38 |
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
|
39 |
return Image.fromarray(np.uint8(out.get_image())).convert('RGB')
|
40 |
|