We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed83982 commit ba7608cCopy full SHA for ba7608c
demo/image_demo.py
@@ -1,6 +1,8 @@
1
# Copyright (c) OpenMMLab. All rights reserved.
2
from argparse import ArgumentParser
3
4
+from mmcv.cnn.utils.sync_bn import revert_sync_batchnorm
5
+
6
from mmseg.apis import inference_segmentor, init_segmentor, show_result_pyplot
7
from mmseg.core.evaluation import get_palette
8
@@ -26,6 +28,8 @@ def main():
26
28
27
29
# build the model from a config file and a checkpoint file
30
model = init_segmentor(args.config, args.checkpoint, device=args.device)
31
+ if args.device == 'cpu':
32
+ model = revert_sync_batchnorm(model)
33
# test a single image
34
result = inference_segmentor(model, args.img)
35
# show the results
0 commit comments