Args: @id: (int) marker image id, for logging @scene_images: (list) test scene images @marker: (array) marker image @source: source image to calculate metrics when blend_type=='lighting' @estimator: twins-onestage @flow_estimator & est
(args, id, scene_images, marker, source=None,
estimator=None,
coarseModel=None, network=None,
flow_estimator=None, estimate_uncertainty=None,
matching=None,
)
| 353 | return blends, masks, blends_colormap |
| 354 | |
| 355 | def eval(args, id, scene_images, marker, source=None, |
| 356 | estimator=None, |
| 357 | coarseModel=None, network=None, |
| 358 | flow_estimator=None, estimate_uncertainty=None, |
| 359 | matching=None, |
| 360 | ): |
| 361 | ''' |
| 362 | Args: |
| 363 | @id: (int) marker image id, for logging |
| 364 | @scene_images: (list) test scene images |
| 365 | @marker: (array) marker image |
| 366 | @source: source image to calculate metrics when blend_type=='lighting' |
| 367 | @estimator: twins-onestage |
| 368 | @flow_estimator & estimate_uncertainty: pdc |
| 369 | @coarseModel & network: ransac-flow |
| 370 | @matching: SPSG |
| 371 | @args: other args |
| 372 | ''' |
| 373 | if args.blend_method == 'twins-onestage': |
| 374 | if estimator is None: |
| 375 | raise ValueError('estimator not set') |
| 376 | out, mask, out_colormap = blend_life(scene_images=scene_images, marker=marker, source=source, estimator=estimator, warp=args.warp, |
| 377 | blend_type=args.blend_type, use_colormap=args.use_colormap) |
| 378 | |
| 379 | elif args.blend_method == 'homography': |
| 380 | out, mask, out_colormap = blend_homography(scene_images=scene_images, marker=marker, source=source, detector=args.detector, |
| 381 | blend_type=args.blend_type, use_colormap=args.use_colormap) |
| 382 | elif args.blend_method == 'pdc': |
| 383 | if flow_estimator is None: |
| 384 | raise ValueError('estimator not set') |
| 385 | out, mask, out_colormap = blend_pdc(scene_images=scene_images, marker=marker, source=source, flow_estimator=flow_estimator, estimate_uncertainty=estimate_uncertainty, |
| 386 | blend_type=args.blend_type, use_colormap=args.use_colormap) |
| 387 | |
| 388 | elif args.blend_method == 'ransac-flow': |
| 389 | if coarseModel is None or network is None: |
| 390 | raise ValueError('coarseModel not set') |
| 391 | out, mask, out_colormap = blend_RANSAC(scene_images=scene_images, marker=marker, source=source, coarseModel=coarseModel, network=network, |
| 392 | blend_type=args.blend_type, use_colormap=args.use_colormap) |
| 393 | |
| 394 | elif args.blend_method == 'SPSG': |
| 395 | out, mask, out_colormap = blend_SPSG(scene_images=scene_images, marker=marker, source=source, matching=matching, |
| 396 | blend_type=args.blend_type, use_colormap=args.use_colormap) |
| 397 | |
| 398 | |
| 399 | if args.blend_type == 'L': |
| 400 | result = metrics(args=args, id=id, output_images=out, masks=mask, source=source) |
| 401 | else: |
| 402 | result = metrics(args=args, id=id, output_images=out, masks=mask, scene_images=scene_images) |
| 403 | |
| 404 | if args.draw or args.save: |
| 405 | # save_root = os.path.join(save_root, str(id).zfill(4)) |
| 406 | # if save and not os.path.exists(save_root): |
| 407 | # os.makedirs(save_root) |
| 408 | for i in range(len(scene_images)): |
| 409 | if out[i] is None: |
| 410 | continue |
| 411 | |
| 412 | if not args.with_mask: |
no test coverage detected