Closed LjIA26 closed 1 year ago
Hi, thanks for using MMPose. Would you provide the version of the demo script you are using?
In the image_demo.py
of the 1.x version, there is an argument --kpt-thr
, you may refer to the use of it for more details.
It doesn't have the option
# Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser
from mmcv.image import imread
from mmpose.apis import inference_topdown, init_model
from mmpose.registry import VISUALIZERS
from mmpose.structures import merge_data_samples
from mmpose.utils import register_all_modules
def parse_args():
parser = ArgumentParser()
parser.add_argument('img', help='Image file')
parser.add_argument('config', help='Config file')
parser.add_argument('checkpoint', help='Checkpoint file')
parser.add_argument('--out-file', default=None, help='Path to output file')
parser.add_argument(
'--device', default='cuda:0', help='Device used for inference')
parser.add_argument(
'--draw-heatmap',
action='store_true',
help='Visualize the predicted heatmap')
args = parser.parse_args()
return args
def main(args):
# register all modules in mmpose into the registries
register_all_modules()
# build the model from a config file and a checkpoint file
if args.draw_heatmap:
cfg_options = dict(model=dict(test_cfg=dict(output_heatmaps=True)))
else:
cfg_options = None
model = init_model(
args.config,
args.checkpoint,
device=args.device,
cfg_options=cfg_options)
# init visualizer
visualizer = VISUALIZERS.build(model.cfg.visualizer)
visualizer.set_dataset_meta(model.dataset_meta)
# inference a single image
results = inference_topdown(model, args.img)
results = merge_data_samples(results)
# show the results
img = imread(args.img, channel_order='rgb')
visualizer.add_datasample(
'result',
img,
data_sample=results,
draw_gt=True,
draw_bbox=True,
draw_heatmap=args.draw_heatmap,
show=True,
out_file=args.out_file)
if __name__ == '__main__':
args = parse_args()
main(args)
I just wanted to add, that I am using the '1.0.0rc0' mmpose version
You can refer to this argument for more details.
Prerequisite
Environment
Hello,
I would like to be able to set the threshold for visualization during the demo or inference stage to 0.5, what file should I modify to set it to 0.5?
I tried updating to the latest mmpose, but it didn't seem to work for me. So, I rather stay with the january version of mmpose.
Thank you!!
Reproduces the problem - code sample
Reproduces the problem - command or script
Reproduces the problem - error message
Additional information
No response