mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
[Fix] Fix no revert_sync_batchnorm in image_demo of master branch (#2489)
Fix: https://github.com/open-mmlab/mmsegmentation/issues/2478
This commit is contained in:
parent
ed83982876
commit
ba7608cefe
@ -1,6 +1,8 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from mmcv.cnn.utils.sync_bn import revert_sync_batchnorm
|
||||
|
||||
from mmseg.apis import inference_segmentor, init_segmentor, show_result_pyplot
|
||||
from mmseg.core.evaluation import get_palette
|
||||
|
||||
@ -26,6 +28,8 @@ def main():
|
||||
|
||||
# build the model from a config file and a checkpoint file
|
||||
model = init_segmentor(args.config, args.checkpoint, device=args.device)
|
||||
if args.device == 'cpu':
|
||||
model = revert_sync_batchnorm(model)
|
||||
# test a single image
|
||||
result = inference_segmentor(model, args.img)
|
||||
# show the results
|
||||
|
Loading…
x
Reference in New Issue
Block a user