|
1 | 1 | # Copyright (c) OpenMMLab. All rights reserved.
|
2 | 2 | import copy
|
| 3 | +import platform |
3 | 4 |
|
4 | 5 | import numpy as np
|
5 | 6 | from mmcv.utils import assert_dict_has_keys
|
@@ -408,34 +409,35 @@ def test_rawframe_decode(self):
|
408 | 409 | 240, 320)
|
409 | 410 | assert results['original_shape'] == (240, 320)
|
410 | 411 |
|
411 |
| - # test frame selector in turbojpeg decoding backend |
412 |
| - # when start_index = 0 |
413 |
| - inputs = copy.deepcopy(self.frame_results) |
414 |
| - inputs['frame_inds'] = np.arange(0, self.total_frames, 5) |
415 |
| - # since the test images start with index 1, we plus 1 to frame_inds |
416 |
| - # in order to pass the CI |
417 |
| - inputs['frame_inds'] = inputs['frame_inds'] + 1 |
418 |
| - frame_selector = RawFrameDecode( |
419 |
| - io_backend='disk', decoding_backend='turbojpeg') |
420 |
| - results = frame_selector(inputs) |
421 |
| - assert assert_dict_has_keys(results, target_keys) |
422 |
| - assert np.shape(results['imgs']) == (len(inputs['frame_inds']), 240, |
423 |
| - 320, 3) |
424 |
| - assert results['original_shape'] == (240, 320) |
425 |
| - |
426 |
| - # test frame selector in turbojpeg decoding backend |
427 |
| - inputs = copy.deepcopy(self.frame_results) |
428 |
| - inputs['frame_inds'] = np.arange(1, self.total_frames, 5) |
429 |
| - frame_selector = RawFrameDecode( |
430 |
| - io_backend='disk', decoding_backend='turbojpeg') |
431 |
| - results = frame_selector(inputs) |
432 |
| - assert assert_dict_has_keys(results, target_keys) |
433 |
| - assert np.shape(results['imgs']) == (len(inputs['frame_inds']), 240, |
434 |
| - 320, 3) |
435 |
| - assert results['original_shape'] == (240, 320) |
436 |
| - assert repr(frame_selector) == (f'{frame_selector.__class__.__name__}(' |
437 |
| - f'io_backend=disk, ' |
438 |
| - f'decoding_backend=turbojpeg)') |
| 412 | + if platform.system() != 'Windows': |
| 413 | + # test frame selector in turbojpeg decoding backend |
| 414 | + # when start_index = 0 |
| 415 | + inputs = copy.deepcopy(self.frame_results) |
| 416 | + inputs['frame_inds'] = np.arange(0, self.total_frames, 5) |
| 417 | + # since the test images start with index 1, we plus 1 to frame_inds |
| 418 | + # in order to pass the CI |
| 419 | + inputs['frame_inds'] = inputs['frame_inds'] + 1 |
| 420 | + frame_selector = RawFrameDecode( |
| 421 | + io_backend='disk', decoding_backend='turbojpeg') |
| 422 | + results = frame_selector(inputs) |
| 423 | + assert assert_dict_has_keys(results, target_keys) |
| 424 | + assert np.shape(results['imgs']) == (len(inputs['frame_inds']), |
| 425 | + 240, 320, 3) |
| 426 | + assert results['original_shape'] == (240, 320) |
| 427 | + |
| 428 | + # test frame selector in turbojpeg decoding backend |
| 429 | + inputs = copy.deepcopy(self.frame_results) |
| 430 | + inputs['frame_inds'] = np.arange(1, self.total_frames, 5) |
| 431 | + frame_selector = RawFrameDecode( |
| 432 | + io_backend='disk', decoding_backend='turbojpeg') |
| 433 | + results = frame_selector(inputs) |
| 434 | + assert assert_dict_has_keys(results, target_keys) |
| 435 | + assert np.shape(results['imgs']) == (len(inputs['frame_inds']), |
| 436 | + 240, 320, 3) |
| 437 | + assert results['original_shape'] == (240, 320) |
| 438 | + assert repr(frame_selector) == ( |
| 439 | + f'{frame_selector.__class__.__name__}(io_backend=disk, ' |
| 440 | + f'decoding_backend=turbojpeg)') |
439 | 441 |
|
440 | 442 | def test_audio_decode_init(self):
|
441 | 443 | target_keys = ['audios', 'length', 'sample_rate']
|
|
0 commit comments