MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / speed_up_process

Function speed_up_process

detrsmpl/utils/demo_utils.py:369–436  ·  view source on GitHub ↗

Speed up the process with the specified speed up type. Args: x (np.ndarray): Shape should be (frame,num_person,K,C) or (frame,K,C). speed_up_type (str, optional): Speed up type. choose in ['deciwatch', 'deciwatch_interval5_q1',

(x,
                     speed_up_type='deciwatch',
                     cfg_base_dir='configs/_base_/post_processing/')

Source from the content-addressed store, hash-verified

367
368
369def speed_up_process(x,
370 speed_up_type='deciwatch',
371 cfg_base_dir='configs/_base_/post_processing/'):
372 """Speed up the process with the specified speed up type.
373
374 Args:
375 x (np.ndarray): Shape should be (frame,num_person,K,C)
376 or (frame,K,C).
377 speed_up_type (str, optional): Speed up type.
378 choose in ['deciwatch',
379 'deciwatch_interval5_q1',
380 'deciwatch_interval5_q2',
381 'deciwatch_interval5_q3',
382 'deciwatch_interval5_q4',
383 'deciwatch_interval5_q5',
384 'deciwatch_interval10_q1',
385 'deciwatch_interval10_q2',
386 'deciwatch_interval10_q3',
387 'deciwatch_interval10_q4',
388 'deciwatch_interval10_q5',]. Defaults to 'deciwatch'.
389 cfg_base_dir (str, optional): Config base dir.
390 Defaults to 'configs/_base_/post_processing/'
391
392 Raises:
393 ValueError: check the input speed up type.
394
395 Returns:
396 np.ndarray: Completed data. The shape should be
397 (frame,num_person,K,C) or (frame,K,C).
398 """
399
400 if speed_up_type == 'deciwatch':
401 speed_up_type = 'deciwatch_interval5_q3'
402 assert speed_up_type in [
403 'deciwatch_interval5_q1',
404 'deciwatch_interval5_q2',
405 'deciwatch_interval5_q3',
406 'deciwatch_interval5_q4',
407 'deciwatch_interval5_q5',
408 'deciwatch_interval10_q1',
409 'deciwatch_interval10_q2',
410 'deciwatch_interval10_q3',
411 'deciwatch_interval10_q4',
412 'deciwatch_interval10_q5',
413 ]
414
415 cfg = os.path.join(cfg_base_dir, speed_up_type + '.py')
416 if isinstance(cfg, str):
417 cfg = mmcv.Config.fromfile(cfg)
418 elif not isinstance(cfg, mmcv.Config):
419 raise TypeError('config must be a filename or Config object, '
420 f'but got {type(cfg)}')
421 x = x.clone()
422
423 assert x.ndim == 4 or x.ndim == 5
424
425 cfg_dict = cfg['speed_up_cfg']
426 cfg_dict['device'] = x.device

Callers

nothing calls this directly

Calls 3

build_post_processingFunction · 0.90
cloneMethod · 0.80
fromfileMethod · 0.45

Tested by

no test coverage detected