add social distancing argument

This commit is contained in:
Lorenzo 2021-01-06 15:56:39 +01:00
parent e1d0ef2f12
commit 339793d6b4
4 changed files with 13 additions and 12 deletions

View File

@ -201,8 +201,8 @@ def predict(args):
boxes, keypoints = preprocess_pifpaf(annotations, im_size, enlarge_boxes=False)
dic_out = monoloco.forward(keypoints, kk)
dic_out = monoloco.post_process(dic_out, boxes, keypoints, kk, dic_gt, reorder=False)
# Print
show_social(args, image_t, output_path, annotations, dic_out)
if args.social_distance:
show_social(args, image, output_path, annotations, dic_out)
print('Image {}\n'.format(cnt) + '-' * 120)
cnt += 1

View File

@ -17,9 +17,10 @@ from openpifpaf.predict import processor_factory, preprocess_factory
from openpifpaf import decoder, network, visualizer, show
from .visuals.printer import Printer
from .visuals.pifpaf_show import KeypointPainter, image_canvas
from .network import PifPaf, ImageList, Loco
from .visuals.pifpaf_show import KeypointPainter
from .network import Loco
from .network.process import factory_for_gt, preprocess_pifpaf
from .activity import show_social
LOG = logging.getLogger(__name__)
@ -132,7 +133,10 @@ def predict(args):
if args.net == 'monoloco_pp':
print("Prediction with MonoLoco++")
dic_out = net.forward(keypoints, kk)
dic_out = net.post_process(dic_out, boxes, keypoints, kk, dic_gt)
reorder = False if args.social_distance else True
dic_out = net.post_process(dic_out, boxes, keypoints, kk, dic_gt, reorder=reorder)
if args.social_distance:
show_social(args, cpu_image, output_path, pifpaf_out, dic_out)
else:
print("Prediction with MonStereo")

View File

@ -59,8 +59,7 @@ def cli():
predict_parser.add_argument('--show_all', help='only predict ground-truth matches or all', action='store_true')
# Social distancing and social interactions
predict_parser.add_argument('--social', help='social', action='store_true')
predict_parser.add_argument('--activity', help='activity', action='store_true')
predict_parser.add_argument('--social_distance', help='social', action='store_true')
predict_parser.add_argument('--json_dir', help='for social')
predict_parser.add_argument('--threshold_prob', type=float, help='concordance for samples', default=0.25)
predict_parser.add_argument('--threshold_dist', type=float, help='min distance of people', default=2)
@ -117,10 +116,7 @@ def cli():
def main():
args = cli()
if args.command == 'predict':
if args.activity:
from .activity import predict
else:
from .predict import predict
from .predict import predict
predict(args)
elif args.command == 'prep':

View File

@ -18,7 +18,8 @@ setup(
'monstereo.utils'
],
license='GNU AGPLv3',
description='MonStereo: When Monocular and Stereo Meet at the Tail of 3D Human Localization',
description=' Perceiving Humans: from Monocular 3D Localization to Social Distancing '
'/ MonStereo: When Monocular and Stereo Meet at the Tail of 3D Human Localization',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='Lorenzo Bertoni',